MyRoboPathOpen Robotics Lab
Arduino Uno #1 of 35
Est. 0.5 Hours
Budget: $1 - $3
Beginner

Blink LEDs & Programmable Timing Patterns

Master digital GPIO output, current-limiting resistor math, and non-blocking LED blink patterns on the Arduino Uno R3.

Kick off your embedded electronics journey by driving external LEDs from Arduino Uno digital pins. You will calculate safe series resistance using Ohm's Law, wire a clean breadboard circuit, and write non-blocking timing code for rhythmic indicators and sequence patterns.

Arduino Uno R3Digital GPIOLED Current Limitingmillis() TimingBreadboard Prototyping
Blink LEDs & Programmable Timing Patterns Blueprint
Blink LEDs & Programmable Timing PatternsCAD Blueprint

Key Learning Objectives & Robotics Concepts

By building and programming this project, you will master the following core engineering skills:

1Apply Ohm's Law (R = (Vs - Vf) / I) to select safe current-limiting resistors for LEDs.
2Identify LED polarity using lead length (longer anode) and the flat cathode casing rim.
3Configure ATmega328P pins with pinMode() and drive logic levels with digitalWrite().
4Replace blocking delay() loops with millis() timers for responsive multi-LED sequences.

Power Architecture & Voltage Staging

5V / 3.3V Regulated Power

Powered directly from the Arduino Uno USB 5V rail. Each LED anode connects through a 220Ω quarter-watt current-limiting resistor so forward current stays around 13–15mA (assuming 2.0V LED forward drop), safeguarding the ATmega328P I/O drivers. 220Ω series resistors cap forward current near 13.6mA, well below the ATmega328P 40mA absolute pin limit.

Blink LEDs & Programmable Timing Patterns Power Architecture Schematic
Figure: Regulated Arduino Uno supply rails, current budget, and component protection.Power Schematic

Bill of Materials (BOM) & Hardware Components

Bill of Materials for Blink LEDs & Programmable Timing Patterns
ComponentSpecifications & AlternativeQtyApprox Cost
Arduino Uno R3 (ATmega328P)5V logic microcontroller board with USB-B cable1$8.00
5mm Standard LEDs (Red & Green/Blue)Vf ≈ 2.0V–3.0V, 20mA max continuous current2$0.20
220Ω Carbon Film Resistors (1/4W)±5% tolerance current-limiting series resistors2$0.10
Half-Size Solderless Breadboard400 tie-points with dual power rails1$2.00
Male-to-Male Jumper Wires22 AWG solid-core breadboard leads4$0.50

Electrical & System Architecture

Digital pins D8 and D9 drive two 5mm LEDs through dedicated 220Ω series resistors, with both LED cathodes tied to the shared breadboard GND rail returning to Arduino GND.

Figure: Complete Arduino Uno R3 pin-to-pin wiring schematic for Blink LEDs & Programmable Timing Patterns.
Figure: Complete Arduino Uno R3 pin-to-pin wiring schematic for Blink LEDs & Programmable Timing Patterns.Wiring Schematic

Autonomous Behavior & Finite State Machine (FSM)

Deterministic Arduino loop handling 5mm Red & Cyan LEDs + 220Ω Resistors acquisition, filtering, and real-time output updates.

Figure: Firmware execution flow and state transitions for Blink LEDs & Programmable Timing Patterns.
Figure: Firmware execution flow and state transitions for Blink LEDs & Programmable Timing Patterns.Control Algorithm

Step-by-Step Physical Assembly & Wiring Tutorial

Follow each of the 5 sequential milestone stages with technical photos, wiring checks, and pre-flight tests.

1

Inspect LED Polarity & Resistor Color Bands

Duration: 5 Mins

Verify LED anode/cathode orientation and confirm each resistor reads 220Ω (Red-Red-Brown-Gold).

Blink LEDs & Programmable Timing Patterns hardware layout diagram
Stage 1: 5mm Red & Cyan LEDs + 220Ω Resistors hardware inspection & pinout overview.Stage 1 Diagram
Step Action Checklist:
  • Locate the longer leg (anode +) and shorter flat-edge leg (cathode -) on both 5mm LEDs.
  • Check resistor color bands or verify 220Ω with a digital multimeter.
  • Confirm the Arduino Uno is disconnected from USB before wiring.
Engineering & Tuning Tip: Never connect an LED directly across 5V and GND without a resistor—excess current destroys the semiconductor junction instantly.
2

Seat LEDs & Resistors on the Breadboard

Duration: 10 Mins

Place both LEDs across separate breadboard rows and bridge each anode through a 220Ω resistor.

Blink LEDs & Programmable Timing Patterns breadboard wiring check diagram
Stage 2: Breadboard layout & Arduino Uno pin-to-pin wiring audit.Stage 2 Diagram
Step Action Checklist:
  • Insert LED 1 cathode into the negative blue GND rail and anode into row 10.
  • Bridge a 220Ω resistor from row 10 to row 14; repeat for LED 2 on rows 18–22.
  • Wire Arduino D8 to row 14, D9 to row 22, and Arduino GND to the breadboard GND rail.
Engineering & Tuning Tip: Keep jumper leads neatly flat against the breadboard so accidental tugs do not loosen connections.
3

Continuity & Short-Circuit Safety Audit

Duration: 5 Mins

Confirm no direct 5V-to-GND bridge exists and that resistor legs sit in distinct electrically isolated rows.

Blink LEDs & Programmable Timing Patterns power rail protection diagram
Stage 3: Supply rail check (USB 5.0V Regulated Rail (≈15mA per LED)) and circuit protection verification.Stage 3 Diagram
Step Action Checklist:
  • Trace from D8 → 220Ω resistor → LED 1 anode → LED 1 cathode → GND.
  • Trace from D9 → 220Ω resistor → LED 2 anode → LED 2 cathode → GND.
  • Plug in the USB cable and confirm the Arduino ON indicator lights steadily.
Engineering & Tuning Tip: If the Arduino power LED dims or flickers when plugged in, unplug immediately and check for a breadboard short.
4

Upload Non-Blocking Dual-LED Firmware

Duration: 5 Mins

Select Arduino Uno and the correct COM port in Arduino IDE, then flash the timing sketch.

Blink LEDs & Programmable Timing Patterns serial telemetry verification diagram
Stage 4: Firmware upload & 115200 baud Serial Monitor verification.Stage 4 Diagram
Step Action Checklist:
  • Open Arduino IDE and choose Tools → Board → Arduino Uno.
  • Paste the production sketch below and click Upload.
  • Open Serial Monitor at 115200 baud to observe live state transitions.
Engineering & Tuning Tip: Non-blocking millis() scheduling lets you add buttons or sensors later without freezing LED blinks.
5

Verify Cadence & Run Pattern Experiments

Duration: 10 Mins

Observe alternating blinks and experiment with interval modulation for strobe or Fibonacci rhythms.

Blink LEDs & Programmable Timing Patterns live operational logic diagram
Stage 5: Live operational logic flow & calibration verification.Stage 5 Diagram
Step Action Checklist:
  • Confirm LED 1 and LED 2 alternate cleanly every 400 milliseconds.
  • Watch Serial Monitor log each state toggle with exact timestamp.
  • Modify BLINK_INTERVAL_MS to 100ms or 1000ms and re-upload to verify timing precision.
Engineering & Tuning Tip: A 220Ω resistor yields bright visibility indoors; swap to 470Ω or 1kΩ if you prefer softer indicator brightness.

Subsystem Benchtop Verification Scripts

Test each hardware subsystem independently before deploying the full autonomous firmware.

1Bench Diagnostic: 5mm Red & Cyan LEDs + 220Ω Resistors Hardware Check

Subsystem Diagnostic

Minimal standalone sketch to verify pin wiring and signal response for 5mm Red & Cyan LEDs + 220Ω Resistors before running the full project firmware.

Arduino IDE Diagnostic ScriptC++ / Arduino
// Diagnostic: Built-in & External Pin D8 Verification
const uint8_t TEST_LED = 8;
void setup() {
  pinMode(TEST_LED, OUTPUT);
  Serial.begin(115200);
}
void loop() {
  digitalWrite(TEST_LED, HIGH);
  Serial.println("D8 -> HIGH (5V)");
  delay(500);
  digitalWrite(TEST_LED, LOW);
  Serial.println("D8 -> LOW (0V)");
  delay(500);
}
Expected Output: D8 -> HIGH (5V) / D8 -> LOW (0V) alternating every 500ms while LED 1 blinks.

Complete Production Firmware

Full working C++ source code with pin mappings, non-blocking timers, and FSM avoidance routines.

arduino_uno_blink_led_patterns.ino
arduino_uno_blink_led_patterns.inoArduino C++
/**
 * Project 1: Non-Blocking Dual LED Pattern Controller
 * Board: Arduino Uno R3 | Pins: D8 (LED1), D9 (LED2)
 */
const uint8_t LED_A = 8;
const uint8_t LED_B = 9;
const unsigned long BLINK_INTERVAL_MS = 400;

unsigned long lastToggleMs = 0;
bool phaseA = true;

void setup() {
  pinMode(LED_A, OUTPUT);
  pinMode(LED_B, OUTPUT);
  Serial.begin(115200);
  Serial.println(F("Dual LED Pattern Controller Ready"));
}

void loop() {
  unsigned long now = millis();
  if (now - lastToggleMs >= BLINK_INTERVAL_MS) {
    lastToggleMs = now;
    phaseA = !phaseA;

    digitalWrite(LED_A, phaseA ? HIGH : LOW);
    digitalWrite(LED_B, phaseA ? LOW : HIGH);

    Serial.print(F("t="));
    Serial.print(now);
    Serial.print(F("ms | LED_A="));
    Serial.print(phaseA ? F("ON") : F("OFF"));
    Serial.print(F(" | LED_B="));
    Serial.println(phaseA ? F("OFF") : F("ON"));
  }
}

Firmware Architecture Explanation:

  • Uses unsigned long subtraction (now - lastToggleMs) so millis() rollover after 49.7 days never glitches.
  • Drives complementary HIGH/LOW levels on D8 and D9 to create clean alternating status signaling.
  • Prints timestamped state updates over 115200 baud Serial for hardware debugging.

Operational Verification & Pin State Matrix

1Double-check all 3 Arduino Uno pin connections against the wiring schematic before plugging in USB.
2Upload the Bench Diagnostic sketch first and confirm Serial Monitor at 115200 baud matches: D8 -> HIGH (5V) / D8 -> LOW (0V) alternating every 500ms while LED 1 blinks.
3Upload the complete production sketch and verify every condition in the operational truth table below.

Input Signal vs. System Output Truth Table:

Operational truth table for Blink LEDs & Programmable Timing Patterns
Input / StatePin / SignalDetected ConditionExpected Output
phaseA = trueD8=HIGH, D9=LOWFirst half-cycleLED 1 ON, LED 2 OFF
phaseA = falseD8=LOW, D9=HIGHSecond half-cycleLED 1 OFF, LED 2 ON

Engineering Troubleshooting Matrix

Engineering troubleshooting matrix for Blink LEDs & Programmable Timing Patterns
ProblemLikely CauseDiagnostic CheckEngineering Solution
LED never illuminatesReversed LED polarity (anode/cathode swapped)Verify longer lead goes toward resistor/D8 and flat rim toward GNDRotate the LED 180 degrees in the breadboard.
LED glows extremely dimWrong resistor value (e.g., 10kΩ or 100kΩ installed instead of 220Ω)Measure resistor with DMM or check color bandsReplace with a 220Ω–330Ω resistor.
Upload fails with stk500_recv errorIncorrect COM port or board selection in IDEInspect Tools → Port and Device ManagerSelect Arduino Uno and the active USB-Serial COM port.

Engineering Challenges & Upgrades

Take your build to the next level with these progressive engineering upgrades:

Level 1Fibonacci Blink Sequence

Program LED 1 to blink in Fibonacci counts (1, 1, 2, 3, 5, 8) separated by a 1.5-second pause.

Level 2Accelerating Strobe Ramp

Gradually shorten the blink interval from 500ms down to 40ms, then reset smoothly.

Level 3Prime Number Indicator

Iterate integers 2–30 over Serial and flash the green LED only when the number is prime.