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.
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.
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?
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
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"
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.
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.
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).