Sub topic 1
A tour of the Arduino Uno board
This chapter walks around the Arduino Uno R3, the reference board for this tutorial. It names each visible part and says which later chapter covers it in detail. When you finish, you should be able to look at a board and say what every connector, chip, and header is for.
Prerequisites
This chapter assumes you already have the following:
- A basic idea of voltage, current, and resistance, such as what a volt and a milliamp are.
- Some familiarity with the Arduino IDE and the
setup()andloop()structure of a sketch. - The ability to read a simple breadboard circuit diagram.
You do not need a board in hand, but it helps. Hold the Uno with the USB connector on the left and the long headers facing up and down. The chapter describes it in that orientation.
The big picture
The Uno is a small circuit board built around one chip, a microcontroller. A microcontroller is a computer on a single chip. It contains a processor, program memory, working memory, and input/output hardware. Almost everything else on the board supports that chip in one of three ways:
- It supplies power.
- It talks to your computer over USB.
- It brings the chip's pins out to sockets that you can plug wires into.
The microcontroller
The large black rectangular chip, usually in a socket, is the ATmega328P. On the Uno it runs at 16 MHz and has these resources:
| Resource | Size |
|---|---|
| Flash memory (stores your sketch) | 32 KB, of which about 0.5 KB is used by the bootloader |
| SRAM (variables while running) | 2 KB |
| EEPROM (data that survives power-off) | 1 KB |
Next to it sits a silver 16 MHz crystal (or a ceramic resonator on some boards), which provides the clock signal. The microcontroller is covered fully in the next chapter. For now, remember that every pin you use on the headers is a pin of this chip, passed through a socket. That is why pin limits belong to the chip and not to the board.
The power section
Power enters the board in two places.
- The USB-B connector is the squarish metal port at one end. It provides 5V from your computer and carries data.
- The barrel jack is the round black socket. It takes a 2.1 mm plug with the positive voltage on the center pin. The recommended input is 7 to 12V.
Voltage from the barrel jack goes through a 5V linear regulator, a part that reduces a higher voltage to a steady 5V. A second, smaller regulator makes 3.3V from the 5V rail. USB power passes through a resettable fuse rated at about 500 mA. A circuit on the board picks the barrel jack over USB when both are connected.
The green LED labeled ON lights when the board has power. The power pins and the choices among power sources are the subject of the next several chapters.
The USB-to-serial chip
Near the USB connector is a second, smaller chip. On genuine Uno R3 boards it is an ATmega16U2. Many clones use a CH340 or CP2102 instead. The ATmega328P cannot talk USB directly, so this chip converts between USB and the simple serial signals that the microcontroller does understand.
Two small LEDs labeled TX and RX blink when data moves through it. They blink during sketch uploads and whenever your sketch uses Serial. The same serial lines connect to pins 0 and 1 on the headers, which is why those pins are best left alone when you use the Serial Monitor.
The reset button and ICSP headers
The red or tan button near the USB connector is the reset button. Pressing it restarts the sketch from the beginning and gives the bootloader a short window to accept a new upload. The bootloader is a small program that lives in flash and receives sketches over serial.
The board has two 2×3 blocks of pins labeled ICSP, short for In-Circuit Serial Programming:
- One block belongs to the main microcontroller. It lets you program the chip with an external programmer, which bypasses the bootloader.
- The other block belongs to the USB chip.
Most beginners never touch these. The ICSP block for the main chip also exposes the SPI pins, which is a useful fact in the chapter on shared pins.
The headers
The Uno's headers are rows of female sockets around the board edge. Hold the board in the orientation described above to read the labels.
| Header | Position | Pins, in order |
|---|---|---|
| Power | Bottom edge, left part | (reserved), IOREF, RESET, 3.3V, 5V, GND, GND, VIN |
| Analog in | Bottom edge, right part | A0, A1, A2, A3, A4, A5 |
| Digital (low) | Top edge, right part | 0 (RX), 1 (TX), 2, 3, 4, 5, 6, 7 |
| Digital (high) | Top edge, left part | 8, 9, 10, 11, 12, 13, GND, AREF, SDA, SCL |
Some points about these headers are easy to miss:
- Digital pins 0 to 13 number 14 in total. Pins 3, 5, 6, 9, 10, and 11 are marked with a tilde (
~). These six support PWM output throughanalogWrite(). - Analog pins A0 to A5 can read voltages through the 10-bit analog-to-digital converter (ADC). They can also work as ordinary digital pins, numbered 14 to 19.
- SDA and SCL near AREF are the same signals as A4 and A5. They are duplicated for convenience with I2C devices.
- Pin 13 is connected to the built-in LED, marked L, through a small buffer. You can blink without any external parts.
- GND appears several times: three on the headers. They are all one connection.
- IOREF tells add-on boards which voltage the logic uses. AREF sets the reference voltage of the ADC. VIN is the raw input voltage from the barrel jack, or an input point for external power.
Checking the names from code
Pin names like A0 and LED_BUILTIN are not special syntax. They are constants defined for the board you selected in the IDE. This sketch prints their values, so you can confirm the numbering above on your own board.
void setup() {
Serial.begin(9600);
Serial.print("LED_BUILTIN = ");
Serial.println(LED_BUILTIN);
Serial.print("A0 = ");
Serial.println(A0);
Serial.print("A5 = ");
Serial.println(A5);
Serial.print("SDA = ");
Serial.println(SDA);
Serial.print("SCL = ");
Serial.println(SCL);
}
void loop() {
}On an Uno, the Serial Monitor at 9600 baud shows these values:
LED_BUILTIN = 13A0 = 14A5 = 19SDA = 18SCL = 19
This confirms that A4 and A5 share their numbers with SDA and SCL. If you choose a different board in the Tools menu and the numbers change, that is the point. Names are portable, and raw numbers often are not.
Common mistakes on a first tour
- Reading the header order backwards. The power header lists 3.3V before 5V. Plugging a 5V wire into the neighboring pin by accident is easy. Check the label, not the position.
- Treating the sockets as the limit. Anything that fits a header socket will plug in. That does not make it electrically safe. Current and voltage limits belong to the microcontroller and the regulators, and later chapters cover them.
- Assuming the board is only powered by USB. The board can run from the barrel jack or VIN with no computer. Check which source is feeding it before you measure anything.
- Using pins 0 and 1 for general wiring while uploading. These pins share the serial link with the USB chip. A wire attached to them can make uploads fail.
How this chapter maps to the rest
| Part you saw | Chapter that covers it |
|---|---|
| ATmega328P | The microcontroller at the center |
| 5V, 3.3V, VIN, IOREF, AREF, GND | The power pins |
| Barrel jack, USB power | Powering the board |
| USB-B connector, USB chip, TX/RX LEDs | What the USB cable provides, and the USB-to-serial bridge |
| Reset button, ICSP | How a sketch gets to the board |
| Digital, analog, and `~` pins | The three pin chapters |
| SDA, SCL, pins 0 and 1, ICSP SPI | Pins with a second job |
Exercise
You plug a sensor wire into the socket labeled A4 and a second device into the socket labeled SDA. Why might both devices interfere with each other, and which pin number does your sketch see for each on an Uno?
Show answer
A4 and SDA are the same signal on the ATmega328P, brought out to two sockets, so the two devices share one wire and can conflict. In a sketch, A4 is pin 18 and SDA is also 18 on the Uno R3, so both names refer to the same pin.
Exercise
A friend says the Uno has six PWM pins and six analog inputs, so twelve special pins in total. Is that count correct?
Show answer
No. The six PWM pins (3, 5, 6, 9, 10, 11) are a subset of the 14 digital pins, and the six analog inputs (A0 to A5) are separate pins that can also act as digital pins. They do not overlap with each other, so there are twelve distinct pins with special features, but all of them can serve as digital I/O. The count of twelve is therefore right, but calling them separate from the digital pins is wrong.