Page 1 of 3

Beat Detection using an op-amp

Posted: Sun Feb 27, 2011 2:15 am
by bitfogav
I thought I would make this new post as it might be usful for anyone looking through the forum and who might be looking for using beat detection in there project, the original post was from my DMX controller.

I like to thank Brad for his input and Graham at digital-diy.com, but I found this circuit works fine for the application I was making.

the circuit:
ElectretmicVer2.jpg
ElectretmicVer2.jpg (13.87 KiB) Viewed 30035 times
The Microphone and the Amplifier (op-amp on the left)
As you can see from the picture above, we have an electret microphone connected to the ground line, and to one end of a 10k resistor. The other end of the resistor is tied to the 5v line. when an audio sound is sensed by the micrpphone, it changes that audio signal into a voltage that emulates the tone picked up. We AC-couple the signal using a coupling capacitor. This signal will be extremely small, so we must first amplify it. I am doing that using a LM385 dual op-amp IC.

Go here for the data sheet:
http://www.national.com/ds/LM/LM158.pdf

The pull-down resistor to the right of the coupling capacitor is necessary for the operation of the non-inverting amplifier stage to work. In fact, all components in the above diagram are crutial. The way a non-inverting op-amp works, is it takes two values RA, which is the 1k resistor connected to the (-) input and ground, and RF (100k potentiometer), which is the feedback resistor, which is connected between the (-) input, and the output, and creates a voltage gain factor.
The voltage gain factor (AV) is a multiplier. Once we determine the AV, we multiply the voltage at the input by the AV, and we have our output voltage.
The 100k pot is used to vary the voltage gain. This will either increase the sensitivity or decrease the sensitivity of the circuit. The equation for AV = RF/RA in a non-inverting amplifier circuit.

The Comparator (op-amp on the right)
I wanted to turn our now amplified waveform into a 0-5VDC square wave that can be used by a I/O Pin of a microcontroller.
What im going to emply here is the comparator circuit. A comparator does exactly as you'd think. It compares voltages. If the voltage at the (-) input is higher than the voltage at the (+) input, then the output will be 0v. If the voltage at the (+) input is higher than the voltage at the (-) input, then the output will be 5v.

We have a resistor voltage divider network at the negative (-) input. This will keep a constant 1.5v at the negative input. When a loud sound is generated and amplified to a voltage higher than 1.5v, then the output will go from 0-5v until the voltage at the (+) falls below 1.5v. We only need for the output of the comparator to be high for a micro second or so, so don't worry too much about the time duration of the output of the comparator being high.



a video showing the circuit in operation:

Re: Beat Detection using an op-amp

Posted: Sun Feb 27, 2011 8:38 pm
by brad
Very helpful post with a great explanation of the circuit operation.

Thanks for sharing :D

Re: Beat Detection using an op-amp

Posted: Fri Mar 04, 2011 7:44 am
by bitfogav
Ive found using something more like this gives the circuit more detection to bass beats or low frequencies, using a low pass filter.

Electretmic Low pass rev2.jpg
Electretmic Low pass rev2.jpg (18.08 KiB) Viewed 30024 times

Re: Beat Detection using an op-amp

Posted: Sat Mar 05, 2011 12:56 pm
by brad
You could even make that a variable cap to 'fine tune' your frequency response.

Re: Beat Detection using an op-amp

Posted: Sun Mar 06, 2011 8:20 am
by bitfogav
Do they do a Variable cap with a high capacitance?.

Re: Beat Detection using an op-amp

Posted: Sun Mar 06, 2011 11:51 am
by brad
Yep, you can get all sorts of values.

Perhaps you could even use a varicap diode / varactor diode?

Re: Beat Detection using an op-amp

Posted: Thu Mar 31, 2011 6:46 am
by odessa
Hi Guys n Gals :)

This is the design I'm using for a similar project
Beat detector.png
Beat detector.png (9.13 KiB) Viewed 29999 times
I decided to make the comparator adjustable ... Any comments or suggestions welcomed :)

Re: Beat Detection using an op-amp

Posted: Thu Mar 31, 2011 6:56 am
by bitfogav
I like your circuit Jay,

Thank you for posting it. I will have to make this up and compare it with my mic circuit, I like how you adjust the ref voltage on the comparator. :)


cheers Gav

Re: Beat Detection using an op-amp

Posted: Thu Mar 31, 2011 5:35 pm
by brad
What would happen if you made the schmidt trigger variable?

Re: Beat Detection using an op-amp

Posted: Thu Mar 31, 2011 6:15 pm
by odessa
Thats what I've done isn't it ? Or have I done something wrong :lol:

Re: Beat Detection using an op-amp

Posted: Fri Apr 01, 2011 7:57 am
by brad
You have a variable comparator but a fixed UTP and LTP for the schmidt trigger :)

Re: Beat Detection using an op-amp

Posted: Fri Apr 01, 2011 8:14 am
by bitfogav
brad wrote:You have a variable comparator but a fixed UTP and LTP for the schmidt trigger :)
Im guessing you mean Brad ,

The turn ON voltage is usually called the upper trigger point or UTP and the turn OFF voltage is called lower trigger point or LTP.

UTP is always greater than LTP since the voltage required to turn ON a device is more than that required to turn it OFF.

I guess if Jay(odessa) changes the 100k resistor (R3) in the circuit with a 100k pot? then it would be a variable schmidt trigger?

Re: Beat Detection using an op-amp

Posted: Fri Apr 01, 2011 4:35 pm
by odessa
Yes exactly. The voltage into the comparator varies depending whats coming out of the the amp.... JP3 is the socket for my electret mic. Adjusting the 100k variable sets the voltage between 0 and 2.5. The comparator is the schmit trigger so its an adjustable schmit trigger ( isnt it ? ) . It works fine :)

Re: Beat Detection using an op-amp

Posted: Fri Apr 01, 2011 9:10 pm
by brad
While a schmidt trigger and comparator both work on open loop gain, the schmidt trigger uses positive feedback via a voltage divider to give you two separate trigger points. and you are correct as you say LTP and UTP are lower trigger point and upper trigger point respectively.

While they are both very similar, the disadvantage of a comparator over a schmidt trigger is that they only have one trigger point which means if our signal happens to be sitting spot on the trigger point - any noise present on the signal will cause it jump over the trigger point and then under and then over etc... etc...

Separating the two trigger points essentialy gets rid of this problem. Having said that, it shouldn't really matter for this particular project.

Now that I think about it (seeing that it is a single supply opamp) do you think it would be an advantage to have a positive clamper circuit just before the input of the first opamp?

Re: Beat Detection using an op-amp

Posted: Fri Apr 01, 2011 10:03 pm
by odessa
Hi Brad

:lol: I'm still very new to all this. I don't know what you mean by a positive clamper circuit. But if you tell me how to make it I'll be very happy to do so and test it :)

Jay