Go Down

Topic: need some assistant on the op-amp circuit attached in the thread. (Read 4957 times) previous topic - next topic

dc42

OK then, the diagram I posted can do that. You don't want to feed the audio signal through the Arduino because it can barely digitise audio fast enough and it doesn't have a DAC for generating an audio output that follows the input. The diagram I gave feeds the audio from the op amp straight to the audio amplifier, and uses the Arduino to control the volume control pin of the amplifier.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

dc42

That is a 1K potentiometer in series with a 2K resistor (2.2K in my original). A potentiometer doesn't have Vcc and ground pins, it has two end pins and a slider pin.

If you don't want to pass the sound to the speaker, then you don't need the audio amp. Either connect a piezo buzzer between a digital output pin and ground and drive it high to make the buzzer sound, or connect the speaker to an Arduino output pin in one of the two ways shown in the diagram (the right hand one provides more volume) and use the Tone library to drive the pin.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

yaantey


yaantey

#18
Jan 01, 2012, 02:45 pm Last Edit: Jan 01, 2012, 02:47 pm by yaantey Reason: 1
I have few questions which I need answers.
1) Voltage from electret microphone is AC, right?
2) I have a speaker with 8 ohms, 0.5 W and using P=(V^2)/R, I found that the voltage is 2V's. Is it the output voltage from the speaker or the voltage needed for the speaker to function?
3) Op-amp produce DC voltage, right?
4) If the electret microphone produce AC and this is the input to the Op-Amp, how do I calculate the output from Op-Amp (can I use Vout = [1+rf/r1]]Vin) considering a non-inverting amplifier where rf is the feedback resistor and r1 connected to it in voltage divider circuit)
5) Since arduino Uno has an ADC range of 0 - 5V do I need to amplify the voltage from microphone to exactly to 5V to get the best resolution?

dc42

1. Yes, although the mic needs a DC bias to power the preamplifier in the mic.

2. 2v is the maximum RMS voltage you should feed the speaker, so as not to exceed its rated power. You will get some sound out of the speaker at a much lower voltage than this.

3. The output of that op amp circuit is the amplified AC signal superimposed on a DC voltage of half the supply voltage.

4. That calculation will give you the AC component of the op-amp output

5. The resolution of the Arduino analog input (using the default 5v analog reference) is around 5mV. I suggest you amplify the signal enough so that the AC component is at least 100mV peak to peak at the level you wish to detect, preferably more.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

dc42

100mV p-p is enough, 1v would be better. Use the circuit you posted in your first post in this thread, and change the values of the feedback resistors if you need to alter the gain.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

yaantey

#21
Jan 01, 2012, 04:33 pm Last Edit: Jan 01, 2012, 04:45 pm by yaantey Reason: 1
Ok, since LM358N is dual op-amp, will it be better if I take advantage of the two op-amp inside the chip in order to amplify? Or just one will do? Also I found (http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/) where LM386N is used and the circuit is much simpler. So what is the best option?

1) should i use lm358n as in the 1st attachment.
2) use dual lm358n for higher gain
3) use lm386n since it is simpler.

dc42

One op amp in an LM358 should be able to give you a gain of up to about 100 before the gain drops at the upper end of the audio frequency range. So you only need to use both halves if you need a gain of more than 100. I would try using just one half.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

ajofscott

Seeing as you want to know when YOUR baby is crying, you should record him/her crying so you have a repeatable cry to tweak your filters that you have not yet implemented so the gadget you are building does not put your spouse in hommicide mode with you as the unlucky victim.
To disambiguate my last statement... simply selecting a level for trip will drive your wifeee insane with nuisance trips from any noise....albeit the lawn mower next door, the front door opening and closing, ect. Filtering before the trip detection will allow you to tailor the heuristics of your preamp to match that of your baby's cry, thus making it less sensitive to ambient noises you don't want trips from. Such as dog shock collars are filtered for the unique content of a dog bark so the poor animal doesn't get a jolt when he scratches his head. (I owned a cheap one, it couldn't discern the clank of the d-ring from a bark, so the dog pretty much hid under the bed whenever the collar was on..)

yaantey

#24
Jan 01, 2012, 05:31 pm Last Edit: Jan 01, 2012, 05:39 pm by yaantey Reason: 1
Hehe, no actually its just a simple project that will enable me to learn few things. I don't intend to use it but maybe if it became that good, why not :)
Right now i am just trying to amplify the voltage from microphone. Maybe once I master it use filtering.

Since LM358 has maximum gain of 100, I should atleast get 10mv input. But the electret microphone only produce few hundred uV. So I guess getting 1V is impossible. Same goes to LM 386 which has a gain of maximum 200. So, i guess just getting 100mV output will do the job.

dc42


Hehe, no actually its just a simple project that will enable me to learn few things. I don't intend to use it but maybe if it became that good, why not :)
Right now i am just trying to amplify the voltage from microphone. Maybe once I master it use filtering.

Since LM358 has maximum gain of 100, I should atleast get 10mv input. But the electret microphone only produce few hundred uV. So I guess getting 1V is impossible. Same goes to LM 386 which has a gain of maximum 200. So, i guess just getting 100mV output will do the job.


More specifically, if you set the feedback resistors to get a higher gain (say 1000), that gain will be provided at the lower end of the audio frequency range but not at the higher end. It may still be adequate for the purpose. If not, then you can use one op amp to amplify the output of the other, with each set to give a gain of (say) 32. The datasheet suggests that the gain-bandwith product of one op amp is around 500K at 10v to 15v supply voltage, but unfortunately doesn't give the value with a 5v supply.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

ajofscott

Ft is typically 1MHz for a GP op amp. A term gain bandwidth product comes into play Ft = GAIN*F. So at Dc-20KHz Bandwidth you max closed loop gain is 1+1MHz/20KHz or 501. Higher gain can be set with the understanding that the gain will roll off above the GBP.


I got beaten to the punch...lol

yaantey

Quote
that gain will be provided at the lower end of the audio frequency range but not at the higher end


I didn't get this piece of theory at all (about the lower and higher frequency range). Can you explain to me in a simple manner if you can. From what I received before I don't necessarily need to amplify to 5V, just 1V will be enough, right?

Grumpy_Mike

Basically you don't get as higher gain at high frequencies as you do at low ones with an op amp.
Therefore if you ask too much gain from a device it will not delver it at the high end.

http://en.wikipedia.org/wiki/Gain%E2%80%93bandwidth_product

Techone

@yaantey

Quote
Seeing as you want to know when YOUR baby is crying, you should record him/her crying so you have a repeatable cry to tweak your filters that you have not yet implemented so the gadget you are building does not put your spouse in hommicide mode with you as the unlucky victim.
To disambiguate my last statement... simply selecting a level for trip will drive your wifeee insane with nuisance trips from any noise....albeit the lawn mower next door, the front door opening and closing, ect. Filtering before the trip detection will allow you to tailor the heuristics of your preamp to match that of your baby's cry, thus making it less sensitive to ambient noises you don't want trips from. Such as dog shock collars are filtered for the unique content of a dog bark so the poor animal doesn't get a jolt when he scratches his head. (I owned a cheap one, it couldn't discern the clank of the d-ring from a bark, so the dog pretty much hid under the bed whenever the collar was on..)


What ajofscott is saying, you need to add a "band pass filter", the sound of a baby is around 2 kHz to 6 kHz. ( I maybe wrong ), I know it is a hight pitch sound anyway. A LM358 is fine, it got a dual op-amp in it.

Go Up