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?

asked May 28, 2013 at 5:43
\$\endgroup\$
5
  • 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\$ Commented May 28, 2013 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\$ Commented May 28, 2013 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\$ Commented May 28, 2013 at 15:15
  • 1
    \$\begingroup\$ A desirable or undesirable temperature? Immaterial really - sounds liked you've cooked A0 somehow \$\endgroup\$ Commented May 28, 2013 at 15:17
  • \$\begingroup\$ oh undesirable** and yes if it's reading solely the A0 pin it's becomes extremely hot. \$\endgroup\$ Commented May 28, 2013 at 15:21

6 Answers 6

5
\$\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.

answered Jan 3, 2016 at 22:49
\$\endgroup\$
4
  • \$\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\$ Commented Jan 3, 2016 at 22:58
  • \$\begingroup\$ This answer solved my problem perfectly \$\endgroup\$ Commented Mar 21, 2017 at 18:03
  • \$\begingroup\$ You were certainly not running into the same issue. Your issue is different. \$\endgroup\$ Commented Mar 24, 2017 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\$ Commented Feb 2, 2018 at 19:02
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?

answered May 28, 2013 at 17:48
\$\endgroup\$
2
  • \$\begingroup\$ A0 = D14 on the Uno, so yes, a digital write test can be done. \$\endgroup\$ Commented Jun 28, 2013 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\$ Commented Nov 11, 2017 at 22:09
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.

answered May 29, 2013 at 6:03
\$\endgroup\$
1
  • 1
    \$\begingroup\$ I don't see how a short could clamp the pin to 50-730 range. \$\endgroup\$ Commented Mar 24, 2017 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...

Ricardo
6,22420 gold badges56 silver badges90 bronze badges
answered Jul 8, 2014 at 10:21
\$\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.

answered Mar 1, 2017 at 21:03
\$\endgroup\$
2
  • 1
    \$\begingroup\$ I see no relation to the issue described in the question. \$\endgroup\$ Commented Mar 24, 2017 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\$ Commented Mar 24, 2017 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

answered Mar 24, 2017 at 12:04
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Who said anything about a joystick? \$\endgroup\$ Commented Mar 24, 2017 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\$ Commented Mar 27, 2017 at 13:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.