# Arduino - accessing extra analog pins on 32-pin SMT package

I've got a 32-pin ATMega328 on a breadboard. I have its analog pin #6 as an input pin from another IC on my board. The IC sends data to this analog pin.

Now, the ATMega328 DIP package (used on the Uno, and other default arduino boards), has 28 pins (instead of 32), and only 6 analog pins (numbered 0-5) total.

I don't get any complaints from the compiler, and am able to upload code successfully to the arduino.

Problem

Using my scope, I expect to see signals coming from the IC, but I just see a flat-line signal. My guess is that, by choosing 'Arduino Uno' as my board from within the Arduino IDE, the code dealing with setting up the analog pin 6 is ignored, because the compiler assumes there is no analog pin 6 on this board. Therefore, the analog pin is automatically just pulled down to zero, and any variations in voltage coming from the IC output pin are brought down to 0 by virtue of being connected to analog pin 6.

Attempted Solution

I tried switching the board I use from the Uno to the Nano (with ATMega328), since the Nano actually runs on the same 32-pin SMT package I'm using.

But now I can't get even the most basic sketch to upload to the board. I tried selecting a few other boards from the menu in the Arduino IDE, and am unable to upload code using any selection besides the Uno.

I'll keep hacking away and researching. Any solutions popping out?

• Try using low level port access for the pin: If you see the Arduino source code, there is some housekeeping code in the GPIO library functions that validates pin numbers as per whichever board you build for. The actual hardware does not get disabled by the libraries, so it's still there for you to use. – Anindo Ghosh Aug 27 '13 at 19:11
• You are on the right track in selecting a board that has that analog input. Since its on a breadboard, can you disconnect the the other IC that is putting out the analog signal and see if the signal looks good? That will tell you if the Arduino pin is not correctly configured as an input. – BrianK Aug 27 '13 at 19:12
• In the particular case of ADC6 & ADC7 on an ATmega328, there is no GPIO functionality, and no need to configure them as an input, because they are exclusively hooked up to the A/D MUX. Reading through the analogRead() source code in github.com/arduino/Arduino/blob/master/hardware/arduino/cores/…, I don’t see any overzealous validation that would prevent ADC6/7 from being usable even in a 6 analog input board configuration. – microtherion Aug 27 '13 at 22:20
• You are probably unable to program your Uno as a Nano because the Uno uses a 115200 baud bootloader and the Nano uses a 57600 baud. Create a new entry which is a synthetic combination with the appropriate properties of each in your boards.txt, restart the IDE, select the custom board, and you should be fine. Or just edit the uno ADC setting and remember that yours is custom. – Chris Stratton Sep 26 '13 at 20:29