Arduino Uno reads ~2V on all pins

Hello everyone,

A long time ago I was making things with my arduino. I bought the starter kit and did most of the projects that where standing in the book. I was quite young and it was just a bit too hard for me to understand everything.

Recently I found my old Arduino Uno and started working with it again. I gained some experience with programming and circuits because I also bought a Raspberry Pi B+ and did some projects with this.

But there is one problem, the Arduino Uno doesn't work like it is supposed to be working because if it reads one of the pins it will say there is a voltage on it when this is not true and when there is a voltage on the pin it will still say the same.

When i was inspecting the board i noticed the Atmega was not fully attached on the holder thingy, there was a gap, i think it was around 1 mm. I was scared of breaking it if I tried pushing it back in so I got a knive and took the whole thing (Atmega) out by putting the point of the knive in the gap (I had not enoug grip with my fingers) and applied pressure to the end.

I noticed that some legs of the Amega where curved, I bended them like the others and inserded the Atmega back in the holder.

The problem was not fixed and I don't know what todo.

I wrote a program that will check all the voltages on all of the pins, here are the results:

Pin 2 = 514, voltage = 2.51
Pin 3 = 517, voltage = 2.53
Pin 4 = 535, voltage = 2.61
Pin 5 = 535, voltage = 2.61
Pin 6 = 462, voltage = 2.26
Pin 7 = 409, voltage = 2.00
Pin 8 = 379, voltage = 1.85
Pin 9 = 341, voltage = 1.67
Pin 10 = 394, voltage = 1.93
Pin 11 = 463, voltage = 2.26
Pin 12 = 468, voltage = 2.29
Pin 13 = 518, voltage = 2.53

Pin 2 = 523, voltage = 2.56
Pin 3 = 530, voltage = 2.59
Pin 4 = 542, voltage = 2.65
Pin 5 = 529, voltage = 2.59
Pin 6 = 442, voltage = 2.16
Pin 7 = 394, voltage = 1.93
Pin 8 = 368, voltage = 1.80
Pin 9 = 331, voltage = 1.62
Pin 10 = 371, voltage = 1.81
Pin 11 = 444, voltage = 2.17
Pin 12 = 461, voltage = 2.25
Pin 13 = 480, voltage = 2.35

there is nothing in the pins of the Arduino, and the A0/5 pins also gave the same results.

I can how ever set a current on a pin.

is this fixable? do I need to buy a new Atmega or is it in the board itself?

That sounds like the chip is working correctly to me.

analogRead() on any pin other than A0~A5 (or 0 ~ 5) returns a non-meaningful value with the DIP version of the Atmega328p.

If there is nothing connected to the pin, it will be floating, and you can get basically any reading from the pin. - in the absence of other electrical noise, it will usually be around 2.5v - but things like touching the pins, or even moving your hand near them can change this (due to it picking up noise). You must connect something that applies a voltage to the pin in order to get meaningful values.

I think that below is the relevant section (line) in the analogRead function in wiring_analog.c

	// set the analog reference (high two bits of ADMUX) and select the
	// channel (low 4 bits).  this also sets ADLAR (left-adjust result)
	// to 0 (the default).
#if defined(ADMUX)
	ADMUX = (analog_reference << 6) | (pin & 0x07);
#endif

Only the lower 3 bits of the pin number that you pass are used. So passing 8 will (1000b) will result in reading analog channel 0, passing 9 will result in reading analog channel 1 etc.