Table of Contents
There is something deeply satisfying about making an LED blink for the first time. Not because the LED cares, but because you just told electricity where to go — and it listened. This post is a companion to my arduino-uno-starter project on GitHub, where you will find a full board-test sketch, pin reference, command cookbook, and more ASCII art than is probably responsible. The theory sections lean on Paul Rosenberg’s Audel Basic Electronics (2005, Wiley) because no one explains conductors and Ohm’s Law more clearly than a guy who has been wiring things since before I was born.
Why start with the Uno?
The Arduino Uno R3 is the “Hello World” of embedded systems. It has enough I/O to be useful, enough constraints to be educational, and enough community support that any problem you hit has been solved twelve times on Stack Overflow. The ATmega328P at its heart is an 8-bit AVR microcontroller running at 16 MHz with 32 KB of flash, 2 KB of SRAM, and 1 KB of EEPROM. It is not fast. It is not powerful. It is comprehensible — and that is the point.
Pins — tiny conductors, big consequences
Rosenberg (2005) defines the concept at its most fundamental level: “A conductor is any material that will allow an electrical current to flow through it” (p. 7). Every pin on the Uno is exactly that — a tiny conductor connected through the ATmega328P’s internal circuitry to registers you control with a few lines of C++.
The Uno gives you three flavors of pin:
Digital pins (0–13) operate in two states: HIGH (5 V) and LOW (0 V). They map directly to binary logic. Six of them (3, 5, 6, 9, 10, 11) double as PWM outputs — they can simulate analog voltages by switching on and off thousands of times per second.
Analog input pins (A0–A5) connect to a 10-bit ADC that reads voltages between 0 V and 5 V and maps them to integers 0–1023. Resolution works out to about 4.88 mV per step. Rosenberg (2005) notes that practical circuits produce continuously varying voltages: “In an AC circuit, the voltage is constantly changing” (p. 29). The ADC bridges that analog-to-digital gap.
Power pins (5V, 3.3V, Vin, GND) complete the circuit. Rosenberg (2005) describes the requirement simply: “a source of voltage, a load, and a conductor to carry the current from the source to the load and back again” (p. 10). Every component you attach to the Uno needs a path from power to ground.
Analog pins A0–A5 can also serve as digital I/O (pins 14–19). Call pinMode(A0, OUTPUT) and they behave identically to the digital pins. Handy when you run out of room.
Ohm’s Law on the Uno
“The current flowing in a circuit is directly proportional to the applied voltage and inversely proportional to the resistance of the circuit” (Rosenberg, 2005, p. 18).
This is the law that keeps your LEDs alive. Each digital pin on the Uno can source or sink up to 40 mA, but the recommended operating current is 20 mA. The math is simple:
I = V / R
For an LED on a 5 V pin:
I = 5 V / 220 Ω ≈ 23 mA ← safe
I = 5 V / 100 Ω = 50 mA ← exceeds the pin's rating
The Ohm’s Law triangle is the quickest way to remember all three forms:
V
─┬─
/ | \
/ | \
/ V=I×R \
/ | \
I ────┴──── R
I=V/R R=V/I
Cover the variable you want —
the other two show you the formula.
When in doubt, start with a 220 Ω resistor for standard LEDs. It keeps current in the safe zone and wastes very little power (about 0.11 W — well within a 1/4 W resistor’s rating).
Kirchhoff’s Voltage Law in practice
The sum of all voltages around a closed loop equals zero.
Rosenberg (2005) frames this as conservation of energy: “the energy given to the circuit by the source equals the energy used by the loads” (p. 25). On the Uno, if pin 9 supplies 5 V and your red LED drops 2 V, the resistor must drop the remaining 3 V:
Pin 9 (5V)
│
▼
┌───┐
│ R │ 220 Ω → drops 3.0 V
└─┬─┘
│
▼
┌───┐
│LED│ Red → drops 2.0 V
└─┬─┘
│
▼
GND (0V)
KVL check: 5 V - 3 V - 2 V = 0 V ✓
ASCII circuit tour
The full project on GitHub has four circuit diagrams. Here are two favorites.
Button with internal pull-up:
Arduino Uno
┌───────────┐
│ D7 ├────────┐ Internal to ATmega328P:
│ (INPUT │ │ ┌─────┐
│ _PULLUP) │ │ │20 kΩ│ pull-up
│ │ │ └──┬──┘
│ │ │ │
│ │ │ 5 V
│ │ ┌─┴─┐
│ │ │ ○ │ ← Pushbutton
│ │ └─┬─┘
│ GND ├────────┘
└───────────┘
Button OPEN → pin reads HIGH (5 V via pull-up)
Button CLOSE → pin reads LOW (shorted to GND)
Potentiometer on A0:
Arduino Uno
┌───────────┐
│ 5V ├──────────┐
│ │ ┌─┴─┐
│ │ │ P │ 10 kΩ Pot
│ │ │ O │
│ │ │ T │
│ │ ├─┬─┤
│ A0 ├────────┘ │
│ GND ├──────────┘
└───────────┘
Voltage at A0 = 5 V × (wiper position / total travel)
ADC reading = voltage × (1023 / 5)
The board-test sketch
The board_test.ino sketch runs five sequential tests:
- Digital output — blinks the on-board LED three times
- PWM fade — ramps an external LED up and down on pin 9
- Digital input — reads a button on pin 7 with
INPUT_PULLUP - Analog read — samples a potentiometer on A0 and prints voltage
- Serial echo — waits for characters and echoes them back
Upload it, open the Serial Monitor at 9600 baud, and follow the prompts. Each test prints PASS criteria so you know what to look for.
Command quick-reference
Here are the core Arduino functions, grouped by subsystem:
// -- Digital I/O --
pinMode(pin, INPUT | OUTPUT | INPUT_PULLUP);
digitalWrite(pin, HIGH | LOW);
int val = digitalRead(pin);
// -- Analog I/O --
int raw = analogRead(pin); // 0–1023
analogWrite(pin, dutyCycle); // 0–255 (PWM pins only)
// -- Serial --
Serial.begin(9600);
Serial.println("message");
char c = Serial.read();
// -- Timing --
delay(ms);
unsigned long t = millis();
// -- Interrupts (pins 2, 3 only) --
attachInterrupt(digitalPinToInterrupt(pin), ISR, FALLING);
Where to go from here
The full project on GitHub includes six use-case recipes: custom blink rates, sensor thresholds, button debouncing with millis(), breathing LED effects, emergency-stop interrupts, and a serial command interface. Each one builds on the pin theory above and can be wired on a breadboard in under five minutes.
If you want to go deeper on the theory, Rosenberg’s book is worth owning:
Rosenberg, P. (2005). Audel basic electronics. Wiley Publishing.
It covers everything from atomic structure to AC motor theory in plain language, and it costs less than a pack of resistors. Pair it with an Arduino and you have a lab course on your desk.
The source code and complete documentation live at github.com/rifezacharyd/electronics. Clone it, wire it up, and let me know what you build.