Analog input jittering

Hi,
I have been trying to read an input voltage for the whole day but without much luck.

I have connected a rate gyro to the Arduino Uno using the 5V and GND pins and connected the signal pin to A5.
As per specs, I should record constant 2.5V when the measured rotation rate is 0.

I have measured the voltage across the signal pin with a multimeter and I’m getting a steady 2.498V.

When I try and measure it with the Arduino input pin, however, I get values that vary between 460 and 500 (i.e. 2.248V and 2.443V).

No idea why.
I tried to power the whole thing via USB, then I tried with a separate power source at 5V and common GND, then I tried with a 9V source into Vin and the 5V pin of the Arduino for the rate gyro… Nothing.
(The rate gyro draws <35mA, so the Arduino should be fine)

Any ideas on what might be causing jitter in the analog input?

Here’s the code I’ve been using.

int gyroExtPin = A5;

void setup()
{ 
    Serial.begin(9600);
}

void loop()
{
     double extVoltage = (analogRead(gyroExtPin) * 5)/1023;
     Serial.println(extVoltage);
     delay(500);
}

Any help would be extremely appreciated.
Thanks
Nick

Yes, you are seeing the noise because the Arduino ADC has a much higher bandwidth (10's
of kHz) than a multimeter (a few Hz at best).

Noise voltage is roughly proportional to square root of bandwidth. Gyros are very noisy,
just like accelerometers, so some low pass filtering is often needed.

However with a rate gyro you are going to integrate the output anyway which is a form
of low pass filtering, so do just that, sample frequently and sum the output (or
rather the difference between current output and calibrated zero rate output)

If you want the best noise reduction you have to low-pass filter in hardware before
sampling to remove frequencies above half the sampling frequency.

Can you tell us which gyro you are using ?
And which Arduino board ?
Do you use a breadboard, those have sometimes bad contacts.

I prefer to do the calculation for the voltage with float, not with integers.
In the normal Arduino boards, there is no 'double', the 'double' is a 'float'.

int gyroExtPin = A5;

void setup()
{ 
    Serial.begin(9600);
}

void loop()
{
    int rawADC = analogRead(gyroExtPin);
    Serial.print(rawADC);
    Serial.print(", ");
    float extVoltage = (float) rawADC / 1023.0 * 5.0;
    Serial.println(extVoltage);
    delay(500);
}

If your voltages are okay (the Arduino 5V pin is actually 5.0V) and the gyro is connected okay, the result should be good. There could be some offset.

Don't forget to put a bypass capacitor on the Aref pin. 0.1uF or even 0.01uF should do. Atmel suggests that even if you are using Vcc as the reference voltage.

Hi,
Thank you all very much for the replies!

I will be integrating the signal so that should cancel out since the noise is probably similar above and below the zero rate reference.

The gyro I'm using is the Silicon Sensing CRS03-01, Arduino Uno.

Finally, can you explain about putting a capacitor on the Aref pin?
What is the advantage/difference? Do I need to set analogReference(...) to anything else than the default?
And should I just connect it to the 5V in?

Thanks
Nick

I have read the datasheet.
It can have some offset, are you sure the multimeter is okay ?

That gyro sensor is developed more than 10 years ago. It is possible that it is outperformed by new gyro sensors of a few dollars.
The sensor can have 981 m/s2 for "operatable acceleration". The MPU-9150 for example, can have 10,000g for 0.2ms. I don't know how to compare those.

The 5V power supply for the sensor seems to be critical. So if you power the Arduino only via usb, the 5V is not a good 5.0V. You need to power the Uno with a power supply to the DC jack.

It's output impedance of the sensor is 100 ohm. That is okay, not a cause of jitter. Perhaps the jitter is something of the sensor itself and is normal. A low pass RC-filter or software average (or both) should fix it.

By default, the Atmel chip uses Vcc as the reference voltage. Do NOT make an external connection to Aref when using the default setting.

AVcc should also have a bypass capacitor from it to ground. It isn't enough to just integrate the input - if the reference voltage has noise on it, which Vcc normally does, it also shows as noise in the digitized signal.

Thank you for all your inputs!

Which solution do you recommend:

  1. Put a capacitor across Aref and GND (and again, do I need to modify analogReference?)
  2. Measure Vcc before reading the input: http://hacking.majenko.co.uk/making-accurate-adc-readings-on-arduino
  3. A mix of both?

Thanks
Nick

The Arduino can measure its own Vcc (by testing it against the internal reference), but the internal reference might not be exactly 1.1V.
You need a good multimeter to be sure that the sensor gets a good 5.0V.

Using the internal reference, and lowering the range of the sensor with a voltage divider (two resistors) is no use I think.
Since the sensor is analog, and the output is with regard to the 5V (I think). So both the Arduino and the sensor have the 5V as reference.

Have you tried bypassing the Aref and AVcc pins yet? That may solve the problem to your satisfaction with nothing else needing to be done.

Check your gnd connection between the sensor and the arduino.