Adjusting this schematic to remove the two 9v batteries.

Joël Huser

Joined Jun 30, 2019
42
If you want to digitize the waveform, this circuit should do what you want. Use the 5 volt supply from the Arduino. The output, with no input signal will be approximately 2.5 volts which can be connected directly to the analog input. Adjust R2 to give a good amplification without clipping.

This circuit should do what you want. Use the +5V supply from the Arduino. The output will be at approximately 2.5 volts DC. Adjust R2 for maximum gain without clipping.
View attachment 180456
Hi KeithWalker, I would have done a circuit like yours, also with a virtual ground.

The TL082 won't work if VDD ‒ VSS < 10 [VDC] which is the case here. But there a many on the marked available for VDD ‒ VSS = 5 [VDC] power supply.

TL082_RecommandedSupplyVoltage_Joël Huser.jpg

Mods Note:
Modified the table and converted the file from .png to .jpg file, it will make the file smaller.
 
Last edited by a moderator:

Reloadron

Joined Jan 15, 2015
7,892
From the beginning here I am going to venture that your original circuit came from here. The link explains about the audio signal and shows a few illustrations. The author points out that the ADC (Analog to Digital Converter) in the Arduino is designed for a DC signal input of 0 to 5 Volts. So if I have an AC audio signal which oscillates or varies between +2 volts and -2 volts the Arduino is going to clip the negative portion since the analog ADC input can't go below 0. So we take the output of the operational amplifier and at the Arduino A0 Input we have a voltage divider consisting of two 100 K resistors tied to 5 volts and ground. This places your A0 input at 2.5 VDC. So now that +2 volt to -2 Volt audio signal is varying between 4.5 volt + peak and 0.5 Volt - peak. This places you now in the 0 to 5 VDC input range of the Arduino A0 ADC input. The link affords more detail and some real good explanations. The link also explains DC Offset which this is all about.

The only reason for the operational amplifier is to take the very low level from a microphone and get it to a usable level. If you plan to just run audio into the Arduino, such as a music file, your signal may already have enough amplitude. That said if you want a real simple amplifier scheme there are several chips which use a single supply, meet audio frequency requirements and are rail to rail operational amplifiers. Were I doing this I may consider a canned off the shelf solution like this one. While it does cost over $1.00 USD it is simple and includes a gain adjust which you may want.

If your objective with an audio signal is just to drive a LED which changes intensity with the music volume (what we called a color organ) your audio signal out from whatever you have may be adequate less any amplification, just pass the AC Audio in but using the resistive divider on the A0 input of the Arduino.

Ron
 

MisterBill2

Joined Jan 23, 2018
27,637
Most of the circuits that I have seen published for an arduino, especially those in "Nuts and Volts" are not what I would call good designs, and none of the words attached to the project deliver anything that will contribute to understanding the circuit function Those projects are only about programming that processor and not much else, except buying their products to go along with the processor boards.
To develop an understanding of an amplifier, and find a circuit that works, find an old copy of the National Semiconductor Analog Applications book. In general, the applications manuals from the semiconductor makers contain good information on how the products work, and how to avoid problems.

And if I am ever able to reload my drawing program onto a new computer I wll be able to deliver actual circuits instead of just detailed descriptions.
 

Thread Starter

Bod

Joined Sep 18, 2016
317
The LM358, connected like the circuit in post #6, with the same 100mfd capacitor and the two 100K resistors tied to the input pin of the arduino, should work. The important thing is that the + input of the opamp is biased to about 1/2 the supply voltage, so that the output can swing from zero to the supply voltage, or at least up and down by two volts. You can also try a model of your exact circuit in spice, to see how it should work.
Thanks, I will give that a try in spice first!

Stop thinking for a moment, and THINK. Two 9V batteries in series = 18VDC. If you connect between them, it means part of your circuit needs +9V, and another part of the circuit needs -9V. Audio is A/C (not D/C). Which means it rides on both sides of zero volts. Your arduino may be digital (using plus voltage), but your audio signal is analog, using both positive & negative voltage.
I understand that.
I get that two 9V batteries series creates a +-9V supply.
The Arduino can only take a positive voltage but I believe the original circuit I posted took the audio signal and made it ride on 2.5V, so it goes between 0V and 5V and never reaches below 0V.
It could still be wrong but I do understand how it works.

From the beginning here I am going to venture that your original circuit came from here. The link explains about the audio signal and shows a few illustrations. The author points out that the ADC (Analog to Digital Converter) in the Arduino is designed for a DC signal input of 0 to 5 Volts. So if I have an AC audio signal which oscillates or varies between +2 volts and -2 volts the Arduino is going to clip the negative portion since the analog ADC input can't go below 0. So we take the output of the operational amplifier and at the Arduino A0 Input we have a voltage divider consisting of two 100 K resistors tied to 5 volts and ground. This places your A0 input at 2.5 VDC. So now that +2 volt to -2 Volt audio signal is varying between 4.5 volt + peak and 0.5 Volt - peak. This places you now in the 0 to 5 VDC input range of the Arduino A0 ADC input. The link affords more detail and some real good explanations. The link also explains DC Offset which this is all about.

The only reason for the operational amplifier is to take the very low level from a microphone and get it to a usable level. If you plan to just run audio into the Arduino, such as a music file, your signal may already have enough amplitude. That said if you want a real simple amplifier scheme there are several chips which use a single supply, meet audio frequency requirements and are rail to rail operational amplifiers. Were I doing this I may consider a canned off the shelf solution like this one. While it does cost over $1.00 USD it is simple and includes a gain adjust which you may want.

If your objective with an audio signal is just to drive a LED which changes intensity with the music volume (what we called a color organ) your audio signal out from whatever you have may be adequate less any amplification, just pass the AC Audio in but using the resistive divider on the A0 input of the Arduino.

Ron
What you said is exactly what the circuit does. The reason for not using it in the first place is that it need two batteries in series to create a +- volt supply and I did not want to batteries in the end circuit.
The Sparkfun board you suggested looks to be what I could use. Looking closely it uses an LM385. This is exactly what I have. Surely I could just create that circuit, but on a bread board right?
Also, I will try out a resistive divider on the input.

Thanks for the replies,
Bod
 

Audioguru

Joined Dec 20, 2007
11,248
A single transistor would need an input coupling capacitor, two base bias resistors, an emitter resistor with a capacitor parallel with it and a collector load resistor to amplify audio from a microphone but it would need to load down the input source and draw a high power supply current all the time for it to provide enough output current to light an LED. Adding a second transistor and a resistor in series with the LED would be best.
But using an opamp to do it uses fewer parts.
 

Thread Starter

Bod

Joined Sep 18, 2016
317
I have tried both the resistive divider and the LM358 connected in a circuit like in #6. Both work, however, both give very little amplification. The values range between about 0 - 200, the latter being the least commonly occurring.

Bod
 

Reloadron

Joined Jan 15, 2015
7,892
Thanks, I will give that a try in spice first!


I understand that.
I get that two 9V batteries series creates a +-9V supply.
The Arduino can only take a positive voltage but I believe the original circuit I posted took the audio signal and made it ride on 2.5V, so it goes between 0V and 5V and never reaches below 0V.
It could still be wrong but I do understand how it works.


What you said is exactly what the circuit does. The reason for not using it in the first place is that it need two batteries in series to create a +- volt supply and I did not want to batteries in the end circuit.
The Sparkfun board you suggested looks to be what I could use. Looking closely it uses an LM385. This is exactly what I have. Surely I could just create that circuit, but on a bread board right?
Also, I will try out a resistive divider on the input.

Thanks for the replies,
Bod
Yeah but the circuit for what I suggested uses a LMV 358 which is a rail to rail single supply operational amplifier. Actually the complete board I suggested looks like this. Either of several operational amplifiers will do what you want. I only suggested the board as it comes as a turn key solution making for easy use, the same can be bread boarded easily also. Just a matter of how much you want to do to get to the end result.

A single transistor would need an input coupling capacitor, two base bias resistors, an emitter resistor with a capacitor parallel with it and a collector load resistor to amplify audio from a microphone but it would need to load down the input source and draw a high power supply current all the time for it to provide enough output current to light an LED. Adding a second transistor and a resistor in series with the LED would be best.
But using an opamp to do it uses fewer parts.
Yes, I agree but the objective is to just run an audio signal into the high impedance ADC input of an Arduino micro-controller board and not drive a LED directly.

Ron
 

Thread Starter

Bod

Joined Sep 18, 2016
317
Yeah but the circuit for what I suggested uses a LMV 358 which is a rail to rail single supply operational amplifier. Actually the complete board I suggested looks like this. Either of several operational amplifiers will do what you want. I only suggested the board as it comes as a turn key solution making for easy use, the same can be bread boarded easily also. Just a matter of how much you want to do to get to the end result.
My LM358 eBay order came with 5 Lm358's so that's not a problem. It's just the complimentary components that go along with them. It looks like I have everything apart from the two 100pf and the one 1uf capacitor. It's whether I'm willing to get them or not because during the whole project I have acquired many components that are unnecessary, and I don't want these to go into that pile.

Bod

EDIT: I have again been looking for other schematics and found this:
Summing-amplifier-circuit.png.html.png
It also uses two LM358's. The website calls it a 'summing opamp'. Surely I could just use one input, instead of three?
 

Audioguru

Joined Dec 20, 2007
11,248
EDIT: I have again been looking for other schematics and found this:

It also uses two LM358's. The website calls it a 'summing opamp'. Surely I could just use one input, instead of three?
It has a gain of only 1. It uses a plus and minus power supply.
 

BobTPH

Joined Jun 5, 2013
11,553
You do realize that the lm358 is not a rail to rail opamp and can output only sbout 0-3V with a 5 volt supply, right?

Bob
 

Reloadron

Joined Jan 15, 2015
7,892
My LM358 eBay order came with 5 Lm358's so that's not a problem. It's just the complimentary components that go along with them. It looks like I have everything apart from the two 100pf and the one 1uf capacitor. It's whether I'm willing to get them or not because during the whole project I have acquired many components that are unnecessary, and I don't want these to go into that pile.

Bod

EDIT: I have again been looking for other schematics and found this:
View attachment 180981
It also uses two LM358's. The website calls it a 'summing opamp'. Surely I could just use one input, instead of three?
In the schematic link I gave you the 100 pF caps are not required, only the 1 uF caps used for coupling are necessary. It is a schematic of the circuit I suggested you buy.

Ron
 

ebeowulf17

Joined Aug 12, 2014
3,307
I have tried both the resistive divider and the LM358 connected in a circuit like in #6. Both work, however, both give very little amplification. The values range between about 0 - 200, the latter being the least commonly occurring.

Bod
Implemented correctly, the circuit in post 6 should have widely variable gain. Did you use an adjustable trim pot as shown?

Can you measure the AC voltage levels of the input source you're feeding it as well as the resulting amplified output? From that you can calculate the gain and see if it matches expectations.

I'm having a hard time believing the circuit in post 6 won't do what you need. It really seems like the right answer.
 

djsfantasi

Joined Apr 11, 2010
9,237
Right, ok, I didn't see that.



0-3V is fine.
What if I use multiple in a row? How about a higher voltage supply?

Bod
There are other single supply op amps that can get closer to the rails. LT1013 for one, gets to within .3 to .5V of the positive supply rail (4.7v). I’m also looking at a new op amp, the TLV2462.

You can put another amplifier circuit in series as you suggested. Take a look at this
276DF426-45FB-454B-A67C-ABEF39187ECF.jpeg
The trace on top is a 5V supply line. The bottom trace is the input from the preceding stage (op amp). The gain is equal to R5/R2, in this case 4.7x the input voltage.

If your first stage outputs a max of 2.5V, then assuming Vr stands for the maximum positive voltage output of the op amp you choose at your chosen supply voltage , you need a gain of Vr/2.5... if you let R2=250k, then R5=Vr*100k...
 

ebeowulf17

Joined Aug 12, 2014
3,307
I have tried both the resistive divider and the LM358 connected in a circuit like in #6. Both work, however, both give very little amplification. The values range between about 0 - 200, the latter being the least commonly occurring.

Bod
You mention values of 0-200. Did i miss something in an earlier post? What units are those values? Are those raw ADC values, readings in mV, or some other thing?

Are you using the high sample rate code in the instructables article which delivers 8 bit outputs (values 0-255?) If you're getting values from 0-200 on a scale that goes from 0-255, that would correspond to about 0-3.9V, which is all you can expect from that op amp. Switching to an op amp with rail to rail outputs would get you much closer (the aforementioned LMV358 claims to get within 0.1V of the supply voltage.)
 

Thread Starter

Bod

Joined Sep 18, 2016
317
In the schematic link I gave you the 100 pF caps are not required, only the 1 uF caps used for coupling are necessary. It is a schematic of the circuit I suggested you buy.

Ron
Alright, that's even easier then. I will look around because I might have a cap or two lying around, of the correct value.

Implemented correctly, the circuit in post 6 should have widely variable gain. Did you use an adjustable trim pot as shown?

Can you measure the AC voltage levels of the input source you're feeding it as well as the resulting amplified output? From that you can calculate the gain and see if it matches expectations.

I'm having a hard time believing the circuit in post 6 won't do what you need. It really seems like the right answer.
Here's the voltages:
At full phone volume, the highest I saw was 100mV, of course, the lowest being 0mV.
The output of the amplifier was about 0.12V at max, which is way to low.

I did use an adjustable pot, but it wasn't 100K (only 10K). I have a feeling this could be why.
I did try with just a 100K resistor but that didn't change much.

You mention values of 0-200. Did i miss something in an earlier post? What units are those values? Are those raw ADC values, readings in mV, or some other thing?
I believe they are raw ADC values.
analogRead()
Reads the value from the specified analog pin. The Arduino board contains a 6 channel (8 channels on the Mini and Nano, 16 on the Mega), 10-bit analog to digital converter. This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023.
Are you using the high sample rate code in the instructables article which delivers 8 bit outputs (values 0-255?) If you're getting values from 0-200 on a scale that goes from 0-255, that would correspond to about 0-3.9V, which is all you can expect from that op amp. Switching to an op amp with rail to rail outputs would get you much closer (the aforementioned LMV358 claims to get within 0.1V of the supply voltage.)
I am not using the Instructables code, just the simple analogRead() function. Which, like I quoted above, outputs a value of 0-1023 with an input 0f 0-5v.

EDIT: That means an output of 200 is probably equivalent to about a volt.

Bod
 

MisterBill2

Joined Jan 23, 2018
27,637
Why oh why??? Is not a single BJT is suffice enough for such application?
The Short answer is SELDOM. A single transistor gain stage uses one transistor varying the current through a resistor. Thus the impedance varies with the output voltage, and the linear range of the device is limited. Also, the gain may not be adequate for the application, and the input impedance may be different from what the application requires. Those are the main reasons why a single transistor is often not an adequate substitute for an op-amp.
 
Top