Sub topic 1
A tour of the Arduino Uno board
Prerequisites
This chapter assumes you understand voltage, current, and resistance, can read a simple breadboard diagram, and have the Arduino IDE installed. You should also know that a sketch has a setup() function that runs once and a loop() function that repeats.
The board at a glance
The Arduino Uno R3 is a printed circuit board with female headers along its edges. Each header is a row of sockets that accepts jumper wires. The main groups are:
- Digital pins 0 to 13, which read or drive HIGH and LOW signals.
- Analog inputs A0 to A5, which measure voltage.
- Power pins 5V, 3.3V, VIN, GND, and IOREF.
- A reset button, a USB-B port, and a barrel jack connector.
The microcontroller at the center
The large black chip is an ATmega328P microcontroller. It runs one sketch at a time at 16 MHz, reads and drives its pins, and stores the compiled program in flash memory. The rest of the board exists to power the chip, connect it to a computer, and expose its pins.
The power pins and what each one does
- 5V: A regulated 5-volt output for sensors and modules. The board's regulator limits how much current it can supply.
- 3.3V: A second regulated output, rated for about 50 mA. Use it only for parts that need 3.3V.
- VIN: The unregulated input voltage. It carries the voltage from the barrel jack or an external supply.
- GND: Ground. Every circuit you build must share a ground with the board.
- IOREF: Reports the board's logic voltage to shields. Do not draw power from it.
Powering the board: USB, barrel jack, and VIN
The Uno accepts three power sources. USB supplies about 5V. The barrel jack accepts 7 to 12V DC and is the better choice when your project needs more current than USB provides. VIN accepts the same voltage range directly on its header. The diagram shows how these inputs reach the regulator.
What the USB cable provides
The USB cable carries three things: 5V power, a connection for uploading sketches, and a serial data link. On the R3, a separate ATmega16U2 chip acts as a USB-to-serial bridge. It translates USB traffic into serial signals for the ATmega328P. The code below sends text through this bridge to the Serial Monitor.
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("LED on");
delay(500);
digitalWrite(LED_BUILTIN, LOW);
Serial.println("LED off");
delay(500);
}Exercise
Your sensor needs 5V. The barrel jack is connected to a 9V supply. Which pin should you use to power the sensor, and why?
Show answer
Use the 5V pin. It is a regulated output from the board's regulator, so it provides 5V whether the board is powered by USB or the barrel jack. Do not feed 5V into the 5V pin as an input.