analog waveform comparison. I don't know where to start..

Discussion in 'The Projects Forum' started by jr102893, Nov 30, 2011.

  1. jr102893

    Thread Starter New Member

    Jan 18, 2011
    15
    0
    How would i make an analog circuit that can produce an output signal upon the intersection(where they are of = voltage) of 2 waveforms
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You would use a comparator. If one signal is higher than the other, the output will be in one state (high or low), if that signal then goes lower than the other input, the output will go to the other state.

    A Wiki entry on comparators: http://en.wikipedia.org/wiki/Comparator
    Rob Paisley's page on comparator circuits: http://home.cogeco.ca/~rpaisley4/Comparators.html

    It is frequent that people will use operational amplifiers aka opamps as comparators. While this does work, it's like using a hammer to install screws.

    Comparators are not internally compensated, while opamps usually are. Comparators are usually much faster than opamps.
     
  3. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    What will the frequency of the two signals be? Keep that in mind when choosing a comparator. 1/f is period, so you will want a comparator faster than the shortest period/highest frequency.
     
  4. wayneh

    Expert

    Sep 9, 2010
    12,153
    3,059
    Are you wanting the output to be proportional to the difference? The comparator approach is a thumbs up or thumbs down, 0 or 1, essentially digital output. If you need proportionality, you'll need op amps. A difference amplifier. You need to provide more detail for anyone to help you further.
     
  5. jr102893

    Thread Starter New Member

    Jan 18, 2011
    15
    0

    The actual goal of my project is to allow strobing triggered by the circuit to light up a a speaker in a slowly oscillating pattern (lets say a sign wave that cycles every 2 seconds) theoretically if i triggered the strobe every time the two waveforms are at = voltage i should be able to produce this effect regardless of the audio being played. I have no doubt that the early attempts will fail but this the goal would look pretty neat...
     
  6. wayneh

    Expert

    Sep 9, 2010
    12,153
    3,059
    Well, the two signals are equal when they're both off, so that might be a problem. And audio signals are at high enough frequencies that you'll probably be triggering several times per second, almost continuously.

    You might want to look at a window comparator setup. A window comparator triggers when a voltage falls within a window. You can set the min and max for the window. And you could set different windows for the two audio streams.
     
  7. jr102893

    Thread Starter New Member

    Jan 18, 2011
    15
    0
    for the first test the audio will all be at a permanent amplitude as to prevent the need to adjust the comparison wave levels(the comparison wave is at a constant frequency) so that it never falls outside of the maximum audio volume(later on i hope to compensate for volume though that might require use of digital programing as analog may be to slow and it may need to have a slight delay so the comparison wave can be adjusted before the sound is produced)
    and as the comparison waveform will be very slow(again something like one cycle every 2 seconds) it will trigger on every peak of the audio (possibly multiple thousands of times per second(depending on the limits of the electronic components i may have to try a different method to get this effect))
    {keeping in mind that the audio wave theoretically represents the position of the cone at that moment in time}
    here is my mock up just to illustrate. the audio wave would be at a much higher frequency compared to the comparison wave than drawn

    (not sure if the photo will work) heres a link too ( https://sites.google.com/site/picksightjr102893/pics/winterferance%20pattern.gif?attredirects=0 )


    I am somewhat new to electrical engineering and have no formal training of any kind so my main question here is, Is this possible? and if so any additional ideas that could help me as i fiddle with this idea for the next few weeks would be helpful.

    [​IMG]
     
    Last edited: Nov 30, 2011
  8. wayneh

    Expert

    Sep 9, 2010
    12,153
    3,059
    Maybe not. What will be producing the low Hz wave? To most audio, that looks like DC and won't be passed through most pieces of audio equipment.

    But assuming you could, what's the point of triggering so many times a second? You won't be able to see it. You'd get much the same effect from a peak detector set to a low level, so that triggering is frequent. You need to trigger no more than ~10Hz or so, to be perceived as individual flashes.

    I'm guessing you want to trigger the strobe but have it appear "random", not synchronized to the beat or the peaks? What would you really like to accomplish? What is the desired connection of the sound you're hearing and the effect you're seeing?

    Oh wait, maybe I just got it. This would automatically vary the strobe effect, so that sometimes it's triggered almost continuously even at low volume and sometimes it only triggers at high volume. Is that what you're looking for? You might want to learn about the "control" pin on a 555 timer.
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Your link didn't work; I had to trim off the ?attredirects=0 from the end:

    [​IMG]

    I didn't read your original problem statement closely enough. If you want the output to indicate just when the two signals are equal (within a small range) you need what is called a "window comparator" or "voltage window detector".

    If you go to Rob Paisley's page, and search for "Voltage Window Detector Circuit", you will find one; it's about 1/2 the way down the page.

    I'm not quite certain what you're expecting to see as a result of this kind of circuit - but your output will be brightest with higher frequency sounds, or things like cymbal crashes or drum hits.
     
  10. jr102893

    Thread Starter New Member

    Jan 18, 2011
    15
    0
    It seams to me like no one is visualizing the goal of this circuit.
    It is meant to produce a constant stroboscopic effect on the speaker cone making it appear to oscillate in and out slowly. I know this effect can be produced by playing a constant tone and flashing a strobe at a slight variance to the frequency being played on the speaker but the goal of my project is to produce the same effect regardless of the audio being played, which theoretically could be accomplished by the above idea.
     
  11. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    If you wanted the speaker cone to look like it was moving slowly, say the orange line above, the strobe would be triggered on each intersection and would work.

    The more difficult part then becomes recharging the strobe fast enough.
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here's an example circuit.
    See the attached circuit and simulation. I simply used a pair of sine waves as input; one 0.5Hz and one 100Hz.
     
    jr102893 likes this.
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here's the same simulation, but the 100Hz In signal was reduced to 20Hz so you can see the output transitions more clearly.
     
    jr102893 likes this.
  14. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718

    That could still work if it were driving an LED for the strobe, rather than a full Xenon strobe, just a bright 1W or so LED focused at the cone. It'd be a cool effect.
     
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes, it would be a cool effect.

    Of course, the LM393/LM2903 comparators are only rated to sink 6mA worst case, so you'd need to use a MOSFET to drive the LED; and the MOSFET itself would need a driver.
     
  16. wayneh

    Expert

    Sep 9, 2010
    12,153
    3,059
    Critical information, thanks for making it clear. Next time, put it in your first post to get higher quality responses, like the circuit proposed. ;)
     
  17. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Just kind of thinking out loud here...

    In the simulation, I deliberately showed the hi/low "window" going outside the voltage limits of the audio signal; as you can see, there will be no stroboscopic effect when this occurs.

    In order to reduce/avoid the "dark times", it might be necessary to add a peak or envelope detector circuit, and multiply the threshold wave by the peak/envelope. Audio that has been processed using compression techniques will likely exhibit fewer "dark times" than unprocessed audio.
     
  18. jr102893

    Thread Starter New Member

    Jan 18, 2011
    15
    0
    Thanks for all the help and feel free to post any additional ideas. If i am not to busy I'll give updates on my progress. I'll definitely be back when i hit the amplitude problems and I'm sure the circuit will not be as straightforward in reality as in simulations.
     
Loading...