Go Down

Topic: LM358 Voltage Follower / Buffer (Read 9734 times)previous topic - next topic

tocpcs

Dec 29, 2010, 01:02 amLast Edit: Dec 29, 2010, 01:07 am by tocpcs Reason: 1
I'm trying to setup a buffer using the LM358 dual op amp.
I'm supplying it 5V from arduino, connected ground to arduino ground.

+ Input = Pin9 on arduino, analogWrite = 127
- Input = Connected to output
Output - connected to + of multimeter.

Then I have ground from the multimeter to ground of the circuit, which as above goes to the ground on arduino.

Basic Math - 5V is what is put out on the pins at analogWrite 255, so if I use 127, I expect to find ~2.5V.

At the arduino this is the case, I put the multimeter to it and got 2.46V.
I expect to find 2.46V at the output of the LM358.

I find 1.83V.

Why is that?  :-?

Interesting also, I put 3.3V into the opamp (from arduino 3V3 pin) and the multimeter = 3.30V

So it has to be something related to PWM :S

Hooked up 9V batteries to the circuit, 3.3V from arduino registers as 7.2V through op amp.

retrolefty

#1
Dec 29, 2010, 01:11 amLast Edit: Dec 29, 2010, 01:13 am by retrolefty Reason: 1
Your multimeter is probably not designed to accuratly measure a PWM waveform duty cycle, but rather just DC or sine wave AC voltages.

What is missing in your setup is a simple low pass filter between the pwm output pin and the + input of your opamp. Try a 5k ohm resistor between the pwm pin that the + input to the op amp and a 10mfd capacitor from the + input pin of the opamp pin to ground. This should filter out the PWM frequency and give you a pretty good DC voltage out of the opamp.

Lefty

tocpcs

#2
Dec 29, 2010, 01:29 am
But why do I get 7V when it's 3.3V from arduino (no PWM), and 9V batteries to the op amp circuit?

retrolefty

#3
Dec 29, 2010, 01:58 am
Quote
But why do I get 7V when it's 3.3V from arduino (no PWM), and 9V batteries to the op amp circuit?

I would first have to see a actual schematic drawing of what you have before I speculate on that. Sounds like you are forcing the op-amp to it's positive rail limit, which on many opamps is somewhat less then it's +vcc value.

Lefty

tocpcs

#4
Dec 29, 2010, 02:13 am

I also removed 3.3V (leaving input open), and that gives 7.24V on output to multimeter.

retrolefty

#5
Dec 29, 2010, 02:22 am
First thing to fix is adding a wire from the 9 volt battery's negitive terminal to a Arduino ground pin. Your external circuitry and the arduino must share the same common reference ground.

Also about that meter? does it really measure something using just one lead?

Lefty

tocpcs

#6
Dec 29, 2010, 02:26 amLast Edit: Dec 29, 2010, 02:27 am by tocpcs Reason: 1
Quote
First thing to fix is adding a wire from the 9 volt battery's negitive terminal to a Arduino ground pin. Your external circuitry and the arduino must share the same common reference ground.

That did it!
I'll have to look up why !

Quote
Also about that meter? does it really measure something using just one lead?

Nah (I wish), it's negative is to the breadboard's ground

tocpcs

#7
Dec 29, 2010, 02:29 am
Hmm, I didn't need the resistor or the capacitor with the external 9V supply.

Pin 9 PWM = 2.49V from the op amp output

pwillard

#8
Dec 29, 2010, 02:44 amLast Edit: Dec 29, 2010, 02:47 am by pwillard Reason: 1
Quote
I'll have to look up why !

EASY.  Very basic concepts related to circuits.

If two different circuits with different DC voltages will never interact... there is no need for common ground.  Like 2 different flashlights... they just don't care about each other.

BUT

When two essentially different circuits need to work together that each have a different voltage potential for a power source... they NEED a  common ground, or a point of reference if you will to be able to correctly interact.

Without that common point of reference...  you just don't have a completed circuit.  The value coming from your op amp to the Arduino essentially is invisible until there is a common point of reference... "ground"

retrolefty

#9
Dec 29, 2010, 02:49 am
Quote
Hmm, I didn't need the resistor or the capacitor with the external 9V supply.

Pin 9 PWM = 2.49V from the op amp output

Again your meter is really not designed to measure other then pure DC or sine wave AC on the ac volt function. So it's reading what you expect that's nice, but it's not the correct way to measure PWM waves. One uses either an oscilloscope or as I said pass the signal through a low pass filter and measure the resulting duty cycle as a pure DC voltage.

Quote
I'll have to look up why !

Yes, it is important that you understand the why a common reference is needed when two different circuits are going to be working together. If the circuits are sharing the same DC power supply that happens without having to think or understand it, but if they are being powered by different voltage sources then there must be a common reference connections made between them. Ground (or common) can be more complex then many beginners realize.

Lefty

pwillard

#10
Dec 29, 2010, 12:15 pm

Being self taught... I struggled with this when I was young... (I guess I was 13 or so).   I asked around and finally got this answer from an engineer.

Ok, it was eons before the Internet but we really could get questions answered before 1992...

He said think of "ground" like a large flat surface such as you would find stepping out onto a nearby street.  Think of voltage as height above that surface... like 5 volts = height of 5 feet.   5 feet above the street ( Your ground)  is consistent and we all know what that it looks like... but it's because we know the reference point... the street or  "ground".

Soo... what if your buddy calls you and says "I'm at 10 feet!" but you don't know where he is?  He could be 10 feet above you...   10 feet above the street. 10 feet below the street... 10 feet up in his house.

Until you have the same common reference point... the street... 10 feet has no meaning to you sitting 5 feet about your street... (ground).

Well...  it worked for me since this is how I have been thinking about it since I was young.

newman

#11
Dec 29, 2010, 12:23 pm
Quote
I'll have to look up why !

Hane a look here http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html
Scroll down ! until you find multiple power supply
GrumpyMike is really Cool

tocpcs

#12
Dec 29, 2010, 12:46 pm
That raises questions

I want to read the voltage across a thermistor from another device.
The other device has resistors and the like providing power across the thermistor, so I just want to read that voltage and make my own conclusions from it using the arduino.

So, the 'signal' ground of the sensor, does that need ground in my op amp circuit (the purpose of the buffer circuit, I take it, is to not affect the resistance of the circuit being checked).

If so, should I take the ground and attach it to the circuit ground? Will this impact on the resistance of the circuit being monitored (ideally this will not even know it's being monitored).

Go Up