Learning Goals 5 min
- Walk back through the eight clusters of Level 2 and name the single highest-leverage idea from each — the one that survives every future project.
- Update your "what I can do now" credentials card with the L2 additions: PWM, ADC, sensors-as-library-calls, LCDs, non-blocking time, persistence.
- Sketch out the architecture (on paper) for one Level 3 project you'll be ready to attempt — proof that the L2 skills compose into the next level's challenges.
Warm-Up 10 min
Forty-eight more lessons under your belt. You arrived at L02-01 with seven L1 building blocks (loop, button, LED, function, FSM, serial, planning). You leave L02-48 with another stack: PWM, ADC, sensor libraries, LCD displays, non-blocking time, EEPROM, SD cards, and the integration discipline to combine them. That's enough to build genuinely useful instruments — data loggers, alarms, controllers — without help from a computer or a cloud.
Quick-fire puzzle
- What was the first L2 project you ran unattended for more than 10 minutes? What was it doing?
- How many
delay()calls are in your current favourite L2 sketch? (If > 2, what would it take to remove them?) - Pick a real consumer product you use weekly. Which L2 cluster's skills would you most need to build a clone?
Reveal (your answers will vary)
- Likely the L02-20 Weather Station v1 or L02-26 Smart Bin Lid. Both stay running while you walk away — the first sign you've graduated from "sketch" to "product".
- If > 2, refactor toward the Cluster F tick-function pattern. Anything > 50 ms blocks you.
- Microwaves and dishwashers = Cluster F (timing) + Cluster E (LCD). Smart bulbs = Cluster A (PWM). Fitness trackers = Cluster G (persistence) + sensors. The mapping is direct.
New Concept — the eight big ideas of Level 2 25 min
Cluster A — Recap and PWM (L02-01 to L02-06)
Big idea: analogWrite is PWM — fast on/off pulses that average to a fake-analog voltage. 0–255 maps to a 0–100% duty cycle. Drives LED brightness, motor speed (later), servo position (in a way). Crossfading, breathing, smooth fading are all for-loop animations on PWM.
- Skills: compute duty cycle and average voltage; pick PWM pins (3, 5, 6, 9, 10, 11 on UNO); make an LED breathe with a for-loop ramp.
- Capstone: L02-06 Breathing Mood Lamp.
Cluster B — Analog Input Deep Dive (L02-07 to L02-12)
Big idea: analogRead returns 0–1023; the cluster pipeline is read → smooth → calibrate → map → classify → act. You learned the 10-bit ADC, the running-average filter, setup-time auto-calibration, the map()+constrain() pair, and the thermistor's β-equation. Capstone: a personal thermometer with status thresholds.
- Skills: map raw 0–1023 onto any range; smooth with a running average; calibrate sensor extremes during setup; convert thermistor R to °C.
- Capstone: L02-12 Personal Thermometer.
Cluster C — Environmental Sensors (L02-13 to L02-20)
Big idea: every sensor follows the same pipeline; libraries (DHT, etc.) handle the awkward protocol parts. TMP36 (3-pin linear), DHT11 (1-wire digital, third-party library), LDR (calibrated), soil probe (corrosion-aware), rain sensor (hysteresis), piezo as knock sensor (threshold + cooldown). Capstone: a multi-sensor Weather Station v1 with CSV output.
- Skills: install a third-party library; handle
NaNreadings; write hysteresis to kill threshold chatter; build a layered architecture (sensors → logic → output). - Capstone: L02-20 Weather Station v1.
Cluster D — Distance & Ultrasonic (L02-21 to L02-26)
Big idea: time-of-flight measurement using pulseIn; servos move via the Servo library; state machines coordinate multi-step behaviours. HC-SR04 physics → pulseIn(ECHO, HIGH, 25000) → wrap in readDistanceCm() helper → drive a buzzer alarm → 3-LED parking display → servo-driven smart bin. Capstone: hands-free smart bin.
- Skills: measure pulse widths in microseconds; convert µs to cm (÷ 58); wrap sensor reads in clean helpers; build 4-state machines with
enum+switch. - Capstone: L02-26 Smart Bin Lid.
Cluster E — LCD Displays (L02-27 to L02-32)
Big idea: an LCD turns a sketch into a product — no computer needed at run-time. HD44780 wiring (bare or I²C backpack), LiquidCrystal library, ghosting and cursor control, custom 5×8 characters, sprintf + dtostrf for tidy values. Capstone: digital thermometer with 2-screen LCD UI.
- Skills: wire and initialise a 16×2 LCD; design custom icons; format numbers with fixed width; build template-once layouts that never ghost.
- Capstone: L02-32 Digital Thermometer With LCD.
Cluster F — Non-Blocking Time (L02-33 to L02-38)
Big idea: millis() + safe-subtract = run many timed things in one loop without any delay(). The cluster systematically replaced every blocking pattern: timer scheduling, blink-without-delay, button debouncing, two-things-at-once. Capstone: multi-LED choreography with stateless pattern functions.
- Skills: elapsed-time pattern with safe subtract; tick functions with
staticlocals; debounced buttons with one-shotjustPressedflag; stateless pattern functions. - Capstone: L02-38 Multi-LED Choreography.
Cluster G — Memory and Storage (L02-39 to L02-42)
Big idea: EEPROM (1 KB, on-chip, instant) for small persistent state; SD (GB, off-chip, CSV-friendly) for bulk logs. Boot counter → high-score saver → SD library (FAT32, open/write/close) → multi-sensor data logger with EEPROM-numbered files. Capstone: a ship-ready sensor data logger.
- Skills:
EEPROM.updateto spare wear; magic-number init pattern; SD format requirements; per-row write-close discipline; using EEPROM + SD together for filename + data split. - Capstone: L02-42 Sensor Data Logger.
Cluster H — Build, Reflect, Recap (L02-43 to L02-48)
Big idea: integration is its own skill — combining 4–6 modules in one sketch tests architecture more than any single technique. Weather Station v2 (LCD + SD + multi-sensor), Combination Lock (4 buttons + servo + EEPROM), Reaction-Tester Arcade (LCD + EEPROM + millis). Plus schematic reading II, debugging strategies, this recap.
- Skills: pin budgeting across multiple modules; I²C vs SPI bus selection; RAM-conscious library use; layered architecture (sensors / logic / display / storage); read multi-IC schematics; apply Print/Isolate/Simplify debugging.
- Builds: L02-43 Weather Station v2, L02-44 Combination Lock, L02-45 Reaction Arcade.
The eight big ideas, side by side
| Cluster | Big idea (one line) |
|---|---|
| A · Recap & PWM | analogWrite is PWM — fast pulses average to fake-analog. |
| B · Analog Input | Read → smooth → calibrate → map → classify → act. |
| C · Environmental Sensors | Every sensor fits the same pipeline; libraries handle the protocol. |
| D · Distance & Ultrasonic | pulseIn + ÷58 = round-trip cm; wrap in a helper. |
| E · LCD Displays | LCD = no-computer product UI; template once, refresh fields. |
| F · Non-Blocking Time | millis() + safe-subtract = many things at once. |
| G · Memory and Storage | EEPROM for small persistent state; SD for bulk logs. |
| H · Integration Builds | Architecture matters more than any single library. |
Worked Example — update your credentials card 20 min
You started your "what I can do now" card at the end of L1. Today you add the L2 sections. Open the L1 card in your notebook (or start a fresh one) and add the following sections.
Section 1 — header update
=== MY ARDUINO LEVEL 2 CREDENTIALS ===
Name: __________
L1 done: __________ (date)
L2 done: __________ (date today)
Lessons: 96 total (48 L1 + 48 L2)
Projects: 6 L1 + ~10 L2 across 8 clustersSection 2 — the L2 vocabulary master list
Copy these terms into your card. Highlight any that don't come to mind instantly — those are your re-read priorities.
| Term | One-line definition |
|---|---|
| PWM | Fast on/off pulses that average to a fake-analog voltage. |
| Duty cycle | Percentage of time HIGH within a PWM period. |
| ADC | Analog-to-digital converter. 10-bit on UNO: 0–1023 from 0–5 V. |
| Reference voltage | The voltage at the top of the ADC's range (default 5V on UNO). |
| Running average | Smoothing filter: mean of last N samples. |
| Auto-calibration | Setup-time learning of a sensor's min/max in the current environment. |
| β-equation | Thermistor R → temperature conversion using one constant. |
map() / constrain() | Rescale and clamp values to a target range. |
| Hysteresis | Two thresholds (enter/leave) to kill chatter at a single boundary. |
| Sentinel value | Special return value (-1, NaN) meaning "no valid reading". |
| Sensor library | Third-party code that handles a sensor's protocol; you call read…(). |
| pulseIn | Measure pulse width in microseconds, with timeout. |
| Servo | Position-controlled motor (0–180°), 3 wires, library handles timing. |
| State machine | Code structured around a small enum of named states and transitions. |
| HD44780 | The chip behind every classic 16×2 character LCD. |
| I²C | 2-wire shared bus (SDA + SCL) for multiple devices. |
| SPI | 4-wire bus (MOSI, MISO, SCK, CS) for fast devices like SD cards. |
| Custom character | 5×8 pixel bitmap loaded into LCD CGRAM, printed via slot number. |
sprintf / dtostrf | C-standard formatters for fixed-width numbers into a buffer. |
| millis() | Built-in count of ms since boot; wraps at ~49 days. |
| Safe subtraction | millis() - prev >= INTERVAL form — wrap-safe. |
| Non-blocking | Code that returns immediately; loop spins at full speed. |
| Cooperative scheduler | Each tick voluntarily completes fast and returns. |
| Tick function | Fast, self-contained function called every loop iteration. |
| Debouncing | Filtering switch bounce so each press = one event. |
| EEPROM | 1 KB on-chip non-volatile memory; ~100 000 writes/byte. |
| SD card | External flash storage; FAT32 + SPI; gigabytes per file. |
| Magic number | Known byte at a known EEPROM address to detect "initialised". |
| Layered architecture | Sensors → logic → output, each in their own helpers. |
| Print / Isolate / Simplify | The three universal debugging moves. |
Section 3 — the L2 sketches you can write from memory
List the sketches you could write without looking up examples. If a sketch is on this list, you own that pattern.
- Smooth a noisy analog reading with a running average.
- Convert a thermistor reading to °C using the β-equation.
- Read a DHT11 with the Adafruit library, NaN-safe.
- Read an HC-SR04 via
readDistanceCm()helper. - Drive a servo to absolute angles via the Servo library.
- Display a fixed-width temperature on an LCD with no ghosting.
- Print a custom degree symbol on an LCD.
- Schedule two LEDs to blink at different rates from one loop.
- Debounce a button using
millis()and a struct. - Save and restore an integer in EEPROM.
- Open / write a line / close an SD file in
FILE_WRITEmode. - Compose all of the above into a multi-sensor data logger.
Section 4 — projects you can recreate
List each L2 project you actually built. For each, jot one line of what makes it interesting.
- L02-06 Breathing Mood Lamp — first PWM animation.
- L02-12 Personal Thermometer — first multi-step sensor pipeline.
- L02-20 Weather Station v1 — first multi-sensor CSV product.
- L02-26 Smart Bin Lid — first servo + state-machine product.
- L02-32 Digital Thermometer With LCD — first standalone screen-driven device.
- L02-38 Multi-LED Choreography — first cooperative scheduler.
- L02-42 Sensor Data Logger — first SD-card persistent instrument.
- L02-43 Weather Station v2 — first 3-module integration build.
- L02-44 Combination Lock — first security state machine.
- L02-45 Reaction-Tester Arcade — first "arcade-quality" UX.
Section 5 — what surprised you
Add a personal section: 2–3 things from L2 that surprised you. Pick the moments where your model of how Arduino works changed. Examples: "I didn't realise delay was so bad" / "EEPROM is really tiny" / "LCDs are easier than I thought". Write it for yourself.
Try It Yourself 15 min
Goal: Without looking up code, write down on paper the canonical "every 2 seconds without delay" pattern. Verify it compiles when you copy it into the IDE.
Hint
unsigned long lastFire = 0;
const unsigned long INTERVAL = 2000;
void loop() {
if (millis() - lastFire >= INTERVAL) {
lastFire = millis();
// do the thing
}
}If you didn't get it on the first try, you don't own the pattern yet. Re-read L02-34.
Goal: Pick a real-world device you use weekly (microwave, dishwasher, smart bulb, fitness tracker). On paper, sketch the architecture in L2 terms: which sensors? which actuators? which timing pattern? which storage?
Hint
Microwave: keypad (debounced buttons), LCD/LED display, timer (millis-based), buzzer, magnetron (relay-controlled). State machine: IDLE → COOKING → DONE.
Goal: Pick a Level 3 project from the syllabus (servo robot car, BLE notification, WiFi-controlled lamp). Sketch its architecture using ONLY L2 vocabulary. Identify the one or two new ideas you don't yet have — those are what L3 will add.
Hint
WiFi-controlled lamp: an LCD (cluster E), a state machine (cluster D/H), PWM for brightness (cluster A), persistent settings (cluster G) — all known. The new ideas: WiFi (L03-29 onwards), HTTP server, network protocols. L2 + a thin layer of new = L3 success.
Mini-Challenge · Integrate two clusters in one sketch 15 min
One last build before the assessment. Pick two clusters you haven't previously combined in your own work, and write a small (~50-line) sketch that uses both. Some pairings:
- Cluster B + Cluster G: A thermistor logger that saves the day's Lo/Hi to EEPROM on every new extreme.
- Cluster D + Cluster E: A distance gauge that shows live cm on the LCD with a custom "arrow toward target" character.
- Cluster C + Cluster F: A weather monitor where DHT reads every 2 s, LDR every 200 ms, button every loop — all parallel tick functions.
- Cluster A + Cluster D: A "distance dimmer" — the closer your hand, the brighter an LED fades via PWM.
It's done when:
- You can name explicitly which two clusters the sketch uses.
- You can explain in one sentence why this combination is useful.
- The sketch is under 80 lines.
- It runs unattended for 5 minutes without bugs.
- You finish it in under 30 minutes — proof you've internalised the L2 toolkit.
Recap 5 min
You started L2 able to blink LEDs and read buttons. You finish L2 able to build standalone instruments — multi-sensor, LCD-driven, SD-logged, EEPROM-persistent, non-blocking — that you could leave running for a week. The eight clusters compose into projects bigger than any single cluster could produce. Level 3 picks this up with motors (servos beyond hobbyland, DC, steppers), real communication protocols (I²C, SPI, BLE, WiFi), and OOP — using the L2 architectural patterns as the bedrock.
- Eight big ideas
- PWM, ADC pipeline, sensor libraries, time-of-flight, LCDs, non-blocking time, persistence, integration. The L2 spine.
- Standalone instrument
- A device that produces useful information / behaviour without a computer attached. The threshold L2 crosses.
- Layered architecture
- Sensors → logic → output, each layer in its own helpers. The pattern that makes integration tractable.
- Cluster F discipline
- No
delay, tick functions,millis()with safe-subtract, debounced buttons. The foundation of every L3 project. - Print / Isolate / Simplify
- The three universal debugging moves. Apply to every bug in every language for the rest of your career.
- Integration is its own skill
- Combining 4–6 modules takes more practice than learning each module. Cluster H's lesson.
- Assessment readiness
- You're ready when you can write the "every N seconds" pattern, the EEPROM save/restore pattern, the LCD template, and one full small sketch — all without looking anything up.
Homework 5 min
Pre-assessment prep. The L2 assessment (when it's scheduled) covers all 8 clusters. Make sure you can do all of the following without looking up references:
- Wire and read a thermistor on A0 (no library, β-equation).
- Drive a servo to a specific angle via the Servo library.
- Print a fixed-width float to an LCD.
- Schedule two timed events in one loop with
millis(). - Debounce a button using a struct with a
justPressedflag. - Save and restore an integer in EEPROM.
- Open / write one line / close an SD file.
- Design a 4-state machine for any small UX problem (lock, game, traffic light).
For each, write a tiny sketch (under 20 lines) that demonstrates the pattern. Save them all in one folder as your "cluster cheat sheets". These are your study materials.
For the assessment day:
- Bring your updated credentials card.
- Bring your 8 cluster cheat sheets.
- Bring your debugging notebook (started in L02-47).
- Sleep well the night before. Tired brains drop pattern recognition first.
Congratulations on finishing Level 2. The next 48 lessons (L3) cover motors, protocols, wireless — and you'll find the L2 architecture lets you absorb the new ideas without rebuilding fundamentals. See you in L03-01.