Voltage Measuring Problem


My problem is that when measuring voltage with the Arduino, the numbers (0-1023) vary greatly. They jump around from values like 93 to 330. But when I measure the same node with a multimeter, my voltage is a nice constant 1.1153V plus or minus .0009V.

Why is the Arduino giving me these values?

What are you measuring and how do you have it connected?

If you connect the multimeter to the Arduino analog pin and the arduino Gnd pin do you still get a stable reading?

The Arduino and the external circuit are connected to the same ground. Using the multimeter, i measure from the node to ground, and the Arduino just has a line coming from the node going to the analog input pin.

This is my circuit below less the 9V supply (its 4 AA’s so ~ 6V). I am measuring from the collector node of the NPN transistor.

If you ground the base of the npn (or disconnect the .02uf cap) does the voltage on Arduino stabalize? I wonder if the multimeter may be smoothing any variations in the voltage.

Depends greatly on the multimeter as well…

Many higher end models are “True RMS” meters, so they will average your voltage.

Try oversampling the data and see if it comes close to what your meter reads.

Remember to also delay slightly before reading analog as any digital transitions will introduce switching noise.

Try reading the pin 10 times adding values together then dividing by ten. This helps smooth out our temp sensor readings.

connecting the base to the ground does no good. It makes the voltage constant but it makes it so there is no sound coming from my speaker. Also, removing the .02 cap didn’t work because I believe the npn acts as a highpass filter so removing the cap doesn’t work either.

I’ll try the oversampling.

If I remove the speaker, and leave the negative end of the 10uf (the one in series with the speaker) cap floating, there is a recognizable discharge waveform from the capacitor (measured from an oscilloscope in my lab).

Freq: 156kHz
max: 2.72v
min: -3.6v

So maybe this waveform is the reason for the random readings on the Arduino?

The suggestion to ground the base was to confirm that varying readings are because the voltage is changing. The Arduino values are correct. What is it that you want to do in your sketch?