5
\$\begingroup\$

One of my analog pins, A0, on my Arduino Uno, is not giving totally accurate results. Where as one of the other pins will do a full 0-1023 in a certain use case, the problem pin only seems to be outputting around 50-730.

Is this pin getting interference somehow, or is it perhaps defective?

\$\endgroup\$
  • 1
    \$\begingroup\$ Have you connected the two pins together so that there is indisputedly the same input to both pins? Are you still getting incorrect readings on A0 compared to the other pin? \$\endgroup\$ – Andy aka May 28 '13 at 7:09
  • \$\begingroup\$ I just set up a test where it read exactly the same input on all of the analog pins. These are the numbers I was consistently getting: 731, 1022, 1023, 1023, 1023, 1023. A0 was either at 731 or 732 and all the other pins were at 1022 or 1023. \$\endgroup\$ – Adam Dally May 28 '13 at 15:02
  • \$\begingroup\$ It also appears that when reading voltages off of A0 that the Atmega heats up to an desirable temperature. At first my test was putting a 1000ms delay between each of the reads, but reducing it down to 100ms keeps the board consistently hot while A0 is plugged in. \$\endgroup\$ – Adam Dally May 28 '13 at 15:15
  • 1
    \$\begingroup\$ A desirable or undesirable temperature? Immaterial really - sounds liked you've cooked A0 somehow \$\endgroup\$ – Andy aka May 28 '13 at 15:17
  • \$\begingroup\$ oh undesirable** and yes if it's reading solely the A0 pin it's becomes extremely hot. \$\endgroup\$ – Adam Dally May 28 '13 at 15:21
4
\$\begingroup\$

The chip is defective I would say. All analogue input pins tied together produces consistent results except for A0. The chips gets warm when focussing on reading A0 - this could be an over/under voltage on the input but this has been ruled-out by the previous test. This could have happened through a static discharge or it could be a random failure - these things are very rare in my experience but they will happen once in a while for someone.

If previously that pin was used as an output (I'm not too familiar with Arduinos) maybe it got over-stressed somehow. Being that it is A0 (and not A1, 2, 3 etc) that has failed makes me suspect a previous incarnation of its use but this is also a long shot.

Buy a new one I think is the best advice or live with the defective pin if you can avoid using it. If it also doubles up as a digital output maybe you can test to see if that side of things still works?

\$\endgroup\$
  • \$\begingroup\$ A0 = D14 on the Uno, so yes, a digital write test can be done. \$\endgroup\$ – Ron J. Jun 28 '13 at 13:24
  • \$\begingroup\$ The ATmega is probably getting warm because the clamping diodes are shot, conducting current from Vcc to gnd. That also explains the erroneous values, because the diodes form a low-impedance resistive divider. I had similar symptoms on an 328P after I accidentally fed 15V AC to one of the ADC pins (whoops). \$\endgroup\$ – marcelm Nov 11 '17 at 22:09
4
\$\begingroup\$

I was running into the same issue, I tried reading voltage input on A0 and A1 (just to see if A0 was bad) and I was getting values higher than expected.

3.6 instead of 3.4

so the line

voltage = sensorValue * (5.0 / 1023.0);

wasn't outputting the correct value

My Arduino mega 2560 was being powered by rasberry pi via USB

Solution:

Supply your arduino board with regulated dc input and don't rely on USB power for your 5v or 3.3v boards.

\$\endgroup\$
  • \$\begingroup\$ Implying that the usb supply was noisy, rippling, or too high. Just keep in mind that usb is valid between 4.75 and 5.25, 5V is just nominal. \$\endgroup\$ – Passerby Jan 3 '16 at 22:58
  • \$\begingroup\$ This answer solved my problem perfectly \$\endgroup\$ – Eric Johnson Mar 21 '17 at 18:03
  • \$\begingroup\$ You were certainly not running into the same issue. Your issue is different. \$\endgroup\$ – Dmitry Grigoryev Mar 24 '17 at 13:01
  • \$\begingroup\$ I was having issues with readings when the UNO was connected to a Raspberry USB without using UNO DC power supply. Problem solved after plugging in regulated dc. Thanks \$\endgroup\$ – Codex73 Feb 2 '18 at 19:02
1
\$\begingroup\$

The problem may be with your specific Arduino Uno board, not the microcontroller.

With the power off, check the resistance between the A0 pin and GND pin, and A0 and Vcc pin, respectively.

If either appears to be a short or (more likely) a low resistance, examine the A0 trace with a magnifier or microscope for a solder short somewhere.

The heating up of the board, and the lower-than-expected readings, lead to a possible conclusion of a short of some sort.

\$\endgroup\$
  • 1
    \$\begingroup\$ I don't see how a short could clamp the pin to 50-730 range. \$\endgroup\$ – Dmitry Grigoryev Mar 24 '17 at 13:04
1
\$\begingroup\$

I had some thing similar. One analogue input was showing a constantly odd value compared to the other three analogue inputs i was using. All resistance measurements where ok.

I used a trim resistor (slider) applying the ATmega2560 reference voltage to the ADC inputs. No idea why but this only worked on 3 of the 4 ADCs.

I then used the 5V supply at the slider and - surprise - all readings where as expected. I have no idea what went wrong there. I will read the spec of the Vref - but might not find this page thereafter... just in case...

\$\endgroup\$
1
\$\begingroup\$

I had a problem with the arduino uno where the A/D raw value would only go to 1022. The board was powered by the USB. When I switched to en external power supply set to 6V it fixed the problem.

\$\endgroup\$
  • 1
    \$\begingroup\$ I see no relation to the issue described in the question. \$\endgroup\$ – Dmitry Grigoryev Mar 24 '17 at 13:05
  • 1
    \$\begingroup\$ @DmitryGrigoryev - The issue in the question was an A/D value range being too low. Isn't that what this answer is about? \$\endgroup\$ – Bort Mar 24 '17 at 13:12
0
\$\begingroup\$

Decoupling capacitor will fix it for you. Place one across + and - rails on the breadboard before pins that you use for powering the joystick. Mind the polarity so you don't give yourself a booboo. 100uF usually does the trick and the trick is that it smooths out voltage spikes, ergo your joystick will spit back readings based on the normalized voltage.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • 1
    \$\begingroup\$ Who said anything about a joystick? \$\endgroup\$ – Bort Mar 24 '17 at 13:10
  • \$\begingroup\$ Oh, right. I was reading on the joystick issues whet I stumbled upon this post. Well it will work anyway. \$\endgroup\$ – yazjack Mar 27 '17 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.