Analog reads are erratic on Zero, 5 volt out makes it worse

Hello!

I got a Zero because I thought it would be a bit faster, more memory and handle my tasks a bit better. I ran my application on the Zero and things went sideways pretty quickly. The ADC return weird number to start with but it gets even weirder if you have anything plugged into the 5 volt output. As a test I ran the 5 volt out to a row in the breadboard with nothing drawing from it and the ADC numbers plummet. It appear that any load to the 5 volt taxes the on board power supply despite the 2 amp 9 volt power supply going in.

If I unplug everything from the 5 volt I see the ADC numbers bouncing around. I all the tricks from the Uno and oversampling and I just get back garbage.

I know everyone wants to see code so here;

  Serial.begin(115200);
  analogReadResolution(12);
  pinMode(A1, INPUT);
  pinMode(8, OUTPUT);

for(int i = 0 ; i < 1000; i++) {
   Serial.println(analogRead(A1));
}

Input to pin A1 is 1 volt. With the 5 volt pin connected to anything (like an empty row on the breadboard) I am reading 3.4 mV. Unplug the 5 volt pin and it reads .9 v, 1.1 v,etc… you get the point. The readings can be up to 1 volt off.

My volt meter says my power input is 1 volt, very little ripple. If I read down to 16 bits I see the ripple at about the 0.001 mark. Its gentle rolling that isn’t reflected in the Zero’s readings.

thanks,

–jb

PS. I purchased the Zero before I knew the difference between Arduino.cc and Arduino.org and so this is a board from Arduino.org and I added the Arduino.cc bootloader. I don’t know if this is the problem as it is suppose to foillow the Atmel design.

Hi,

I had this (or a similar) problem with the M0 Pro a few months back. It was solved with the help of this board :). See:

http://forum.arduino.cc/index.php?topic=338640.0 and also,
http://forum.arduino.cc/index.php?topic=341345.0

Basically an external +5 V supply is needed, especially if you want to run the ADC (or analogue comparetor) fast.

I got the program-initiated ADC conversion+readout time down to 6 µs in 12 bit mode. This was better than the standard analogue read function that takes over 200 µs. There is some example code in the 2nd post.

I wish you success!

Harry J. Whitlow

Thanks, Harry!