Instructables
loading
loading

How to add 6 extra pins to your Arduino with no extra hardware

Picture of How to add 6 extra pins to your Arduino with no extra hardware
arduino blink.gif
Hello, this is my second Instructable so please bear with me.
I am going to tell you how to get 6 extra Arduino digital pins.
I discovered this by playing with the Arduino IDE and tried setting up a LED on pin 14 (which does not exist on the board) And guess what? Analog pin 0 is pin 14!
 
Remove these adsRemove these ads by Signing Up

Step 1: How to get the other analog inputs working too

Picture of How to get the other analog inputs working too
It is pretty simple to get the others working too! Here is a list of all of the pins:

Pin 14 = Analog in 0
Pin 15 = Analog in 1
Pin 16 = Analog in 2
Pin 17 = Analog in 3
Pin 18 = Analog in 4
Pin 19 = Analog in 5

Unfortunately these are not PWM pins, but you can use the SoftPWM library to get software-based PWM, which is almost as good as native PWM.

Step 2: The example code

Here is just an example code i wrote for testing:

int ledPin = 14;
int gndPin = 15;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(gndPin, OUTPUT);

digitalWrite(gndPin, LOW);
}

void loop()
{
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}

coolersport27 days ago

If anyone would like more output pins, you could utilise a demultiplexer. See following:

http://en.wikipedia.org/wiki/Multiplexer

http://www.ebay.com.au/itm/10-pcs-CD4051BE-CD4051-4051-IC-16-pins-CMOS-Multiplexer-Switches-Demultiplexer-/371116027139?pt=LH_DefaultDomain_15&hash=item56683d2d03

http://pdf1.alldatasheet.com/datasheet-pdf/view/26882/TI/CD4051BE.html

Adding shift registers is also a inexpensive and easy option.

Fantastic!! I was trying to find out if I could sub the analogs for digitals. strangely I had no success in finding a straight forward answer and thus wrote it off, and now stumbled on this while looking for something else HAHA. This saves me from having to incorporate another board. Thanks a bunch for sharing. any idea how one might get them to chase like Christmas lights for a time period as a sub routine to a sketch?

GR0B1 year ago
Thanks for sharing, I knew you could control the pull up of an analog but didn't know it also had a digital pin number too.
DustinT GR0B4 months ago

Same here. The fact that analog pins can be used as digital is well documented. I was a bit annoyed by the title at first, but this is good info.

ReCreate5 years ago
Its nothing new, Its already on the board >_<

I actually found this instructable by Googling for the answer to my question I asked over on Sparkfun. So, I for one appreciate the time he spent making this. I'm new to hardware and EE. There is so much mystery in it (especially the Arduino) for me.

There is not many mystery in Arduino -_- study microcontrollers.These are all same

That's pretty arrogant. There is plenty of mystery. There are numerous resources dedicated to it. This happens to be one of them. The whole point of Arduino is to make microcontrollers approachable to the people who learn by doing. Finally, they are not all the same. They are subtly different and therein lies the mystery.

There was just nothing good or true in your comment. Why do people feel the need to leave comments like this? "Look, a person on the internet does not know something that I know. -_- Grr, that makes me angry. I must strike them down."

Actually Instructables is usually one of the better sites as far as not having comments from the electronics equivalent of the Comic Book Guy from the Simpsons. Unfortunately a couple of them squeeze through...

awesome just what i needed, more pins.

DouglasF5 months ago

I am Brazilian student. thanks for the help always has excellent tutorials

I'd like to point out that with the SparkFun Arduino Pro Micro it is:

A0 = D18

A1 = D19

A2 = D20

A3 = D21

For the Leonardo also gain:

A4 = D22

A5 = D23

A6 = D24

A7 = D25

A8 = D26

A9 = D27

A10 = D28

A11 = D29

Thanks!
btw, in SoftPWM, you can write it as pin A1 and it works just as well as pin 15.
oqla20003 years ago
Good info thanks !
'jaiswal4 years ago
thanks for the information.....as all know that "analog pin can be use as digital" is already on arduino.cc....... but helpful info. is that A0 is pin 14...that is not given on site... :)
neutron75 years ago
On the MEGA the anlog pins are digital  53,54,55 etc.
Grathio5 years ago
It's new to me!  Thanks for sharing!  I know this will come in handy!
davidbuzz5 years ago
it's also on this page:  www.arduino.cc/en/Guide/Board  whereit says :
" Most of the analog inputs can also be used as digital pins "
belectric235 years ago
News to me - thanks for the tip!
neat, but what about the arduino MEGA's?
they have digital pins up to 53 and analog pins upto 16
Dege5 years ago
 It's already in the arduino documentation but it's a bit hidden:
http://arduino.cc/en/Reference/PinMode
(watch the note at the end of the page...)
Noodle935 years ago
Yeah, this is pretty well known.
ikestarm175 years ago
that's pretty cool and is very helpful. Thanks!