LCD : L.S.B. jitter

I am using Adafruit ADS1015 (4 channel, 12 bit ADC, I2C…) https://www.adafruit.com/product/1083 in single-ended mode to monitor voltages and currents. This then outputs to Arduino pro-mini and LCD (via 74HC595, “3-wire”…).

The problem is that the least significant bit (LSB) on all 4 channels jitters. And of course, expected.

Now I tried reducing the programmable sample rate to minimum of 128SPS, and added “smoothing” with slight improvement, but still not right.

Relevant part of my sketch :

  int chgaV = ads1015.readADC_SingleEnded(0);
  int chgaVV = chgaV - 254.00 ;                    //   sensor bias
  float chgaVolts = chgaVV  *  1.00 / 95.00 ;       //  ratio
        totalC = totalC - readC[indexC] ;
    readC[indexC]  =  analogRead (chgaVolts) ;
    totalC = totalC + readC[indexC] ;
    indexC = indexC + 1 ;
    if  (indexC  >= numRsa)
    indexC = 0 ;
    averageC  =  totalC / numRsa ;
  lcd.setCursor(0, 0);
  lcd.print ("+     A");
  if (chgaVolts < 0.04)
  { chgaVolts = 0.00 ; }

Now my thinking is that a much lower sample rate would be the answer as speed plays no part : a short delay is insignificant. For display purposes 2 to 4 samples/second would be adequate, e.g. 2…4SPS in the “one-shot mode”. This is tricky because the chip’s input caps are so small.

The clue …

The ADS1013/4/5 have two available conversion

modes: single-shot mode and continuous conversion

mode. In single-shot mode, the ADC performs one
conversion of the input signal upon request and
stores the value to an internal result register. The
device then enters a low-power shutdown mode. This
mode is intended to provide significant power savings
in systems that only require periodic conversions or
when there are long idle periods between
conversions
. In continuous conversion mode, the

ADC automatically begins a conversion of the input

signal as soon as the previous conversion is

completed. The rate of continuous conversion is

equal to the programmed data rate. Data can be read

at any time and always reflect the most recent

completed conversion.

and ...

The ADS1013/4/5 operate either in continuous

conversion mode or a single-shot mode that

automatically powers down after a conversion and

greatly reduces current consumption during idle

periods.

My idea is to triggers the ADC to run and capture all 4 inputs, latch the values and then “sleep” for 250 … 500mS.

Has anybody achieved results in this way, or another way?

Thanks so much in advance.

So, you’ve got 1 LSB jitter on a maximum 5v signal.

1.220703125 mV of jitter.

A) How good is your PCB?

B) How good is your PSU?

C) How good is your RTFDS?

reply to skimask

Perhaps I didn’t make it clear in my post.

It seems that everything works okay, except that the LSB dances around - as I speak it flutters/jitters between 6, 7 and 8 so rapidly it’s difficult for another to read/understand. I understand that most ADCs will have +/- 1 LSB flutter. All I want is for that display to be stable, even briefly.

Your questions :

a. I am in trial stage and present model is veroboard using headers for ADS1015 and Pro-mini. The current input is direct from Hall-effect chip (ADS713) mounted 3cm from ADS1015 so I can’t imagine input impedance is a problem. The voltage input is 2K impedance voltage-divider with 0.1uF cap parallel.

b. PSU is MC34063 from 12V battery with additional choke at output and 470uF cap // 0.1uF to reduce ripple, and 0.1uF caps soldered really close to the sub-boards’ power connects. Even without my supply and using USB the jitter is there.

c. If RTFDS refers to data sheets I miss the point of your question. What could/should I be checking?

Newbie10:
It seems that everything works okay, except that the LSB dances around - as I speak it flutters/jitters between 6, 7 and 8 so rapidly it’s difficult for another to read/understand. I understand that most ADCs will have +/- 1 LSB flutter. All I want is for that display to be stable, even briefly.

Update the display at a slower rate then. Even better low pass filter the readings and display the result at a slower rate.

Update the display at a slower rate then.

This is exactly what I asked help for.

So, what’s the answer?

Huh ? W/o knowing the rest of your code it’s hard to say. Why not put a delay(999) at the bottom of your loop() ?

Or how about displaying a computated moving average:

http://en.wikipedia.org/wiki/Moving_average

Like an exponential moving average, based on a percentage of the current value and the remainder of the previous moving average value.

[EDIT] This will introduce lag though.

Your small portion of code shown already contains some sort of averaging. But I can’t make heads or tails out of how or why it does this.

Newbie10:
reply to skimask

Perhaps I didn’t make it clear in my post.

It seems that everything works okay, except that the LSB dances around - as I speak it flutters/jitters between 6, 7 and 8 so rapidly it’s difficult for another to read/understand. I understand that most ADCs will have +/- 1 LSB flutter. All I want is for that display to be stable, even briefly.

Your questions :

a. I am in trial stage and present model is veroboard using headers for ADS1015 and Pro-mini. The current input is direct from Hall-effect chip (ADS713) mounted 3cm from ADS1015 so I can’t imagine input impedance is a problem. The voltage input is 2K impedance voltage-divider with 0.1uF cap parallel.

b. PSU is MC34063 from 12V battery with additional choke at output and 470uF cap // 0.1uF to reduce ripple, and 0.1uF caps soldered really close to the sub-boards’ power connects. Even without my supply and using USB the jitter is there.

c. If RTFDS refers to data sheets I miss the point of your question. What could/should I be checking?

For one,

http://en.wikipedia.org/wiki/Effective_number_of_bits

a. Veroboard? And you’re expecting single bit steady-ish signals? Really? With 2K impedance?

b. USB has got enough jitter for everybody, and you have to pull that juice thru a cable. 5v Vref / 12bits = 1.22… mV. Think there’s not 1mV jitter on USB?

c. Everything. Then Google’ing all those acronyms you really don’t understand and understanding them.

Okay, jitter has been eliminated, so problem solved.

Newbie10:
Okay, jitter has been eliminated, so problem solved.

Not so fast! A bunch of people took time out of their day to help you for free. Give some feedback, what did you do to make it work?

Ignored the LSB or 2.

lyndon:
Not so fast! A bunch of people took time out of their day to help you for free. Give some feedback, what did you do to make it work?

It’s not the best way and if somebody can give a more elegant solution (software) it would be appreciated.

I am using 12-bit ADC because I want to display small changes in voltage/current inputs, so cutting the LSB off would spoil this. I referred to it previously that the answer was to freeze the display to avoid jitter.

The 74HC595 (used to reduce LCD-drive to 3 wires) datasheet function table shows a particularly useful condition : all input pins X (don’t care) while RCLK (pin 12 of DIP chip) rising functions as “Shift-register data is stored in the storage register”.

So I broke the connect to pin 12 of '595 and inserted a 4k7 in series resistor. Added a little pulse generator sketch, with on-period 200mS and off 3mS, and output via 1N4148 with cathode to '595 pin 12. The effect is then to latch LCD data keeping the display steady during HIGH but allowing update to '595 during LOW via 4k7.

I know that the effect could be achieved in software but I’m (Newbie) still not familiar enough with sketching to get it right.

Anyone want to help?

(and please try to avoid “Google it” - much better to point to something useful than a useless broad comment)

Thanks.

skimask’s comment may be a bit impatient, but his #1 item is likely your problem.

You are attempting to perform a precision measurement using unsuitable construction methods. Don’t feel bad: I found this out the hard way on my first job: after the first batch of PC boards for production had been made, the noise (also using a 12-bit ADC) in my design was too high. I then spent the next few days learning everything I could about proper analog layout techniques.

Don’t use a breadboard, Veroboard, or other point to point wiring method!

There are tiny voltages and high impedances in your circuit, leaving them very susceptible to noise. The first order of business is to improve your grounding. I suggest building the A/D converter section on a small piece of copper clad board. Use [deadbug construction or take a socket and bend all pins except the ground pin out horizontally except the ground. Solder the ground to the PC board. Connect all your grounds to this PC board, then you can plug the A/D chip into the socket so it’s easily replaceable. However, working without a socket (or at least using machine pin sockets) will give better performance.

I find it useful to separate a section of the copper clad with a hacksaw or an x-acto knife and use that part for power connections. So the flat area of copper is a low-resistance path for ground and power signals.

Next, clean up your power supply. If you are powering the circuit from a switching supply or your PC’s USB port, filter it well.

Make sure that any digital logic, Arduino, MCU, etc is being returned to ground downstream of your ADC circuit. That is, the power should flow into the A/D circuit, back out through the ground, and then the digital grounds are connected, then back to the power supply ground. This avoids noisy digital ground currents in your sensitive analog ground.

Hope that helps. I disagree with your comment that a 12-bit ADC at these voltage levels is expected to be jittery. You should get the occasional flicker, but it should be dead stable most of the time.](Programming & Web Design Articles - dummies)

Thanks, Lyndon for a very good, clear explanation.

I really appreciate it so I will try to give detailed feedback.

Yes, I built the first test cases on veroboard. I am not crazy about veroboard but what’s the alternative while building test projects?

I am unfamiliar with ADC so opted for the ready-made Adafruit job instead. (When it all works correctly I will attempt MCP3204, etc.)

  1. The DAC is the Adafruit breakout board https://www.adafruit.com/product/1083 which uses SMD chip, on-board ferrites, etc. so I imagine it has “clean” output. I use two channels for current measuring through Allegro ACS713 chips, mounted 3cm from the DAC with 0.1uF caps on supply and output leads. Even with 0A I get the jitter. Hence my code …
  if (chgaVolts < 0.03)
  { chgaVolts = 0.00 ; }

The 2 other channels are voltage measuring with voltage dividers (6k8 / 2k2) with again 0.1uF caps to GND to help clean input. (One input is direct from 12V lead-acid battery, not connected to anything else so unlikely source of noise. Second input not used at present and shorted to GND.)

  1. I am using LM35 temperature sensor feeding direct to Arduino analog input. Display is accurate, clear, steady = no problem there.

  2. I bypassed the MC34063 SMPS-regulator with a 7805 to check for noise. No difference, so I assume that power supply is not part of the problem.

I have tried various situations including caps and grounding to clean the ADC-board’s output without success. Still the only way to achieve good display is using my sledgehammer.

I appreciate reading your comments.

Perhaps I’m still missing a point. Your help is appreciated.

WRT the ACS713s … some “jitter” is to be expected. Look at the noise specs.

If you want to reduce their noise, put a proper LPF btw them and the ADC.

OK, that changes things. I did not realize you were using the ADC chip on a breakout board. The board looks OK and there seems to be a good ground plane on the bottom. LC filter on the power supply input is a good thing, but I’m not sure what the second inductor is for.

What is the amplifier’s gain set to? Also, you said one of the inputs is grounded. Are you also seeing LSB (from your description it’s more than just the LSB) jitter on that channel also? That could point to a problem with the chip or the board layout. If not, it’s likely a combination of the sensor being noisy and on the battery measurement channel, wires too long/unshielded.

Mee_n_Mac:
WRT the ACS713s … some “jitter” is to be expected. Look at the noise specs.

[attachment=0]ACS713noise.jpg[/attachment]

If you want to reduce their noise, put a proper LPF btw them and the ADC.

Yep, that is a noisy sensor, but he says he’s also seeing noise on the input from the 12V battery, so I think it’s either a wiring problem (picking up interference in his cables) or the ADC board is noisy.

Okay, I rebuilt on a new veroboard (how else?). It carries the MC34063 & associated SMPS, switch-on/off circuit, the Arduino pro-mini, the Adafruit ADC, etc. I.e. everything except the '595 and LCD which is remote.

But this time I anchored ALL the GND’s to one rail (especially MC34063 and associate ‘reduce ripple’-stuff) to make one common GND rail. Marked improvement but still jitter, i.e. no different driving directly from 7805 instead of SMPS-circuit.

(Forgot to check jitter on direct DC input [battery voltage with resistor divider network].)

Then simple R-C filter (4k7 series, 0.1uF parallel to GND) on ACS713 output before input to Adafruit ADC.

Some looking over shoulder would say an improvement.

Any suggestions? Perhaps, yes, I should spend an afternoon experimenting with different values. I will try that but right now I need progress, so I have reverted to the Sledghammer.

It still works better than any other I have tried.

Much thanks for positive help/information - it’s appreciated.

I begin to wonder how much more I can achieve on veroboard and when the Sledgehammer becomes the answer, possibly with improvement in the sketch?

That ADC board doesn’t look like a good layout. It has a long, thin VCC trace, no ADC ground near the input pins, and no access to the ADC ground except through a bead.

If you are really trying to get a low noise design, you must be VERY careful with routing, ground currents, supply isolation, noise coupling, for example. Switchers, poor routing, and veroboard don’t go along with low noise…

/mike