0
Offline
Full Member
Karma: 0
Posts: 122
Arduino rocks
|
 |
« on: December 28, 2010, 07:02:56 pm » |
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.
|
|
|
|
« Last Edit: December 28, 2010, 07:07:50 pm by tocpcs »
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15320
Measurement changes behavior
|
 |
« Reply #1 on: December 28, 2010, 07:11:51 pm » |
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
|
|
|
|
« Last Edit: December 28, 2010, 07:13:26 pm by retrolefty »
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 122
Arduino rocks
|
 |
« Reply #2 on: December 28, 2010, 07:29:38 pm » |
But why do I get 7V when it's 3.3V from arduino (no PWM), and 9V batteries to the op amp circuit?
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15320
Measurement changes behavior
|
 |
« Reply #3 on: December 28, 2010, 07:58:03 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 122
Arduino rocks
|
 |
« Reply #4 on: December 28, 2010, 08:13:13 pm » |
 Please forgive my poor drawing. I also removed 3.3V (leaving input open), and that gives 7.24V on output to multimeter.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15320
Measurement changes behavior
|
 |
« Reply #5 on: December 28, 2010, 08:22:46 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 122
Arduino rocks
|
 |
« Reply #6 on: December 28, 2010, 08:26:45 pm » |
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 ! 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 
|
|
|
|
« Last Edit: December 28, 2010, 08:27:24 pm by tocpcs »
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 122
Arduino rocks
|
 |
« Reply #7 on: December 28, 2010, 08:29:36 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Cumming, Ga
Offline
Edison Member
Karma: 12
Posts: 1389
Ultimate DIY: Arduino
|
 |
« Reply #8 on: December 28, 2010, 08:44:19 pm » |
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 c ommon 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"
|
|
|
|
« Last Edit: December 28, 2010, 08:47:51 pm by pwillard »
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15320
Measurement changes behavior
|
 |
« Reply #9 on: December 28, 2010, 08:49:53 pm » |
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. 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
|
|
|
|
|
Logged
|
|
|
|
|
Cumming, Ga
Offline
Edison Member
Karma: 12
Posts: 1389
Ultimate DIY: Arduino
|
 |
« Reply #10 on: December 29, 2010, 06:15:31 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Hyderabad , India
Offline
God Member
Karma: 5
Posts: 621
can't help not to think arduinaizing something !
|
 |
« Reply #11 on: December 29, 2010, 06:23:47 am » |
I'll have to look up why !
Hane a look here http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.htmlScroll down ! until you find multiple power supply GrumpyMike is really Cool 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 122
Arduino rocks
|
 |
« Reply #12 on: December 29, 2010, 06:46:13 am » |
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).
|
|
|
|
|
Logged
|
|
|
|
|
|