The four header strips
Thirty-two holes in four strips: fourteen digital pins along the top, six analogue inputs and the power pins along the bottom. Six of the digital pins carry a ~, and two of the top holes are the bottom's A4 and A5 a second time.
Four strips, by job
Along the top edge are two strips of digital pins: ten holes on the left (SCL, SDA, AREF, GND, then 13 down to 8) and eight on the right (7 down to 0). Along the bottom are the power strip, eight holes, and the analogue strip, six. The names are printed beside every hole, and the figure follows the print.
Pick a job and the holes that can do it light. Most holes do more than one, which is the thing to take from the figure: pin 11 is a digital pin, a PWM pin and SPI's MOSI, and which of those it is depends only on the sketch.
The digital strips
0 to 13 are the digital pins. Each can be an output, set HIGH (5 V) or LOW (0 V), or an input that reads which of the two it sees.
- The ~ marks PWM. 3, 5, 6, 9, 10 and 11 can switch on and off fast enough
to look half-on with
analogWrite(). The others cannot. - 0 and 1 are the USB line. They are wired straight to the CH340C, printed RX←0 and TX→1, and every upload and Serial Monitor byte crosses them. A sketch that uses them as ordinary pins, or a wire in them during an upload, breaks both.
- 13 is the L lamp's pin. The lamp follows it through a buffer, so 13 still works as an input.
- 2 and 3 can interrupt. They are the two pins
attachInterrupt()can use on an Uno, to run a function the instant they change.
At the left end of the top strip sit GND, AREF and SDA and SCL. GND next to 13 is the most useful hole on the board: a jumper wire from it reaches any pin on the top strip. AREF is an input for a reference voltage, which the reference covers.
SDA and SCL are A4 and A5
SDA and SCL were added in the R3 layout so I2C has a fixed place on every board. On the ATmega328P, I2C comes out on the same pins as A4 and A5, so the board joins them: SDA is A4 and SCL is A5, one wire each, reachable from two holes. The back of the board prints the same pairing. This board has no pull-up resistors on those two lines; an I2C module usually brings its own.
The power strip
From the left: a hole with no name, which is connected to nothing (the R3 layout reserved it); IOREF, which is the 5 V rail and tells a shield that this board's pins work at 5 V; RESET, which restarts the chip when pulled to GND; 3V3 and 5V, which are outputs; two GND; and VIN, which is the barrel jack's supply after its diode.
5V and 3V3 are for powering small parts. Wire them only to a pin that is an input, never to an output and never to each other or to GND. VIN is not for experiments at all. The 5V and 3V3 pins gives the budgets.
The analogue strip and ICSP
A0 to A5 read a voltage between 0 and 5 V as a number from 0 to 1023. They are also digital pins 14 to 19, which is why the sketch on this page can treat them like the rest.
The ICSP header, two rows of three at the right edge, carries 11, 12 and 13 again as MOSI, MISO and SCK, plus 5 V, GND and RESET. The print beside it reads MISO 5V, SCK MOSI, RST GND, in the order of the pins.
Find them with one wire
The sketch makes every safe hole an input with its pull-up on, so each reads HIGH until something pulls it to ground. A wire from GND is that something, and because the pins are inputs, there is no short. Touch a hole and the Serial Monitor names it: a way to learn the numbering with your hands before you need it.
The code
Makes 2 to 13 and A0 to A5 inputs with their pull-ups on, then reports any of them you connect to GND. Not one pin is an output, so no hole you touch can short. One jumper wire (or a straightened paper clip) is all it needs.
// Which_Hole_Is_Grounded.ino — names any hole you wire to GND
// Tools > Board: Arduino Uno (Arduino AVR Boards)
// Tools > Port: the CH340 port
// Serial Monitor: 9600 baud
// Wiring: one jumper wire from a GND hole, touched into 2 to 13
// or A0 to A5. Every one of those pins is INPUT_PULLUP, so a
// wire to GND is safe. Leave 0 and 1 alone: they are the USB line.
const byte PINS[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
A0, A1, A2, A3, A4, A5};
const char *NAMES[] = {"2", "~3", "4", "~5", "~6", "7", "8",
"~9", "~10", "~11", "12", "13 (L lamp)",
"A0", "A1", "A2", "A3", "A4 (SDA)",
"A5 (SCL)"};
const byte COUNT = sizeof(PINS) / sizeof(PINS[0]);
int last = -1; // the hole reported last time
void setup() {
Serial.begin(9600);
for (byte i = 0; i < COUNT; i++) {
pinMode(PINS[i], INPUT_PULLUP); // HIGH until wired to GND
}
Serial.println("Touch a hole with a wire from GND.");
}
void loop() {
int found = -1;
for (byte i = 0; i < COUNT; i++) {
if (digitalRead(PINS[i]) == LOW) {
found = i;
break;
}
}
if (found != last && found >= 0) {
Serial.print("GND is touching ");
Serial.println(NAMES[found]);
}
last = found;
delay(20);
}Put one end of the wire in the GND hole next to 13 and touch the other end into the holes one by one: the Serial Monitor names each. L stays lit, because 13 is pulled up and L follows it; touch 13 and L goes out. Touch SDA and it says A4 (SDA): the same pin, from the other strip.
When it does not work
That is right. SDA and A4 are one wire on the board, and so are SCL and A5, so a sketch cannot tell which of the two holes you used. It is also why a sketch using I2C cannot read A4 and A5 as analogue inputs.
Something else is in that strip: a shield, a wire left in a neighbouring hole, or a paper clip touching two holes at once. Unplug the board, take everything out of the headers, and try again.
The sketch leaves 0 and 1 out on purpose: they are the USB line, and 1 is an output while Serial runs, so keep the wire away from both. AREF is not a pin the sketch can read. Touching GND to GND does nothing either.
Read the white print beside the top strip, from the left: SCL, SDA, AREF, GND, 13, 12, then ~11 down to 8. GND is the fourth hole from the left, next to 13.
USB-C, the barrel jack, VIN and the 5V pin, and which one wins.
Four ways to power it →Edit this page — content/books/uno/the-header-strips.mdx
Questions about this product
See what other owners have asked, and read their solutions.
UNO R3 USB-C (ATmega328P)
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.