Analog input jitter.

G'day All

I need to monitor a battery voltage to control charge rate. I have set up the usual volt divider on the 12v battery I am monitoring and decoupled it with 1uF. The binary result is constantly going up and down by about 5 or 6 even with a regulated source. I have tried smoothing and averaging without any success. Since my interest is in the decimal part of the voltage being measured (the usual 13.80v) am I kidding myself or is it possible to tame whatever it is causing the jitter?? What is it that causes the jitter, say using the 3.3v ref on the duemillanova board ??

Cheers ....... Blakus

How are you regulating the voltage and current to the battery? Most use PWM. The "on-off" of the PWM circuit can cause jitter if you do not time the analog read correctly.

If you are talking about varying 5 or 6 on the binary analog read, that is not bad. A lamp (especially florescent) near your board will cause a 120 hertz "jitter".

The best way to tell is fire up the old o-scope and do some probing.

And just from experience: Breadboards cause more jitter than a properly designed circuit board. Longer leads cause more jitter than shorter leads. High impedance circuits are more sensitive to jitter than low impedance. Unshielded boards are more sensitive to jitter than shielded boards.

Thanks, Yes charge is PWM and I will take a look at the input waveform. Could you expand on the "Timing the analog read" please? At the moment I have the PWM output disabled whilst measuring the input, the fluke 3.5 digit VOM shows a steady input at the analog input but the binary value is going up and down as mentioned. I am viewing the voltage every second or so whilst I develop the code. Yes the circuit is on a breadboard and unshielded but I notice this effect in other projects I have made on veroboard enclosed in a diecast box.

Cheers ........ Mike B

If you are disabling the PWM during the analog read, that takes care of timing.

If you were using a 5 volt reference, one unit of change is only 4.9mv.

At 3.3v, that is 3.2mv per unit. If the input reading is changing 5 units, that is only a 16mv ripple.

Thanks again,

I am probably chasing my tail with the jitter, although I would like know if there is any caused internally in the chip. I can see a few millivolts on the input and since all my readings are being done next to a computer that is probably where some of the jitter is coming from. I can see that using the 5v ref will be better in terms of reducing the response to the jitter, maybe I'll take the input volts lower to see if that stabilises it a little.

Cheers ........ Mike B

did u read this from atmel about oversampling?

If you want to get rid of some jitters, why not trying a running average instead of an immediate reading?

Ground noise can cause this sort of jitter. I always use a separate analog ground for the ground side of any sensors, voltage dividers, filter capacitors etc. that are associated with analog inputs. This can be a dedicated ground pin on the Arduino, or even a direct connection to the AGND pin of the MCU socket. Use different ground pins for everything else.

Another cause of jitter in analog readings is noise on the analog reference, which by default is the 5v supply. This may be particularly bad if you are powering the Arduino from USB. Using the 3.3v supply as the analog reference may give better results.

Just found this as I had the same issue. It turned out to be the USB power supply to cause the jitter, just as dc42 pointed out.

As a matter of terminology, "jitter" refers to random variations in delay or time. You can think of it as noise on the horizontal time axis. Random variations in voltage or any signal displayed on the vertical axis is referred to as "noise".

Froggins: I have set up the usual volt divider on the 12v battery I am monitoring and decoupled it with 1uF.

What is the "usual volt divider"? What are the values of the resistors?

Many Arduinos have trouble with high impedance sources.

How often are you taking a reading from the analog pin?