Utility · sources and further reading
Resources
The canonical sources behind this hub: MicroPython's own documentation for everything you type, the chip maker for the silicon, and the encyclopedia for the signal theory. Same rule as every week: when a random tutorial disagrees with these, these win, and for board-specific questions the quick reference is this week's pinout.xyz.
Reference documents
| Document | Use it for | Nature |
|---|---|---|
| MicroPython: ESP32 quick reference | This week's settling authority: pins, ADC, PWM, timers, every peripheral with working snippets; bookmark it beside the bench | Official (MicroPython) |
| MicroPython: ESP32 tutorial | Getting started end to end, firmware flashing included, the long-form version of the flashing steps | Official (MicroPython) |
| machine module · machine.ADC · machine.PWM | The precise API contracts: constructors, methods, the attenuation constants, read_u16/read_uv, duty_u16; class documentation you can now read fluently after Week 6 | Official (MicroPython) |
| MicroPython firmware downloads | The firmware itself, per board, for the manual route or for home machines; Thonny fetches from the same source | Official (MicroPython) |
| Espressif: ESP32 | The silicon's maker: specifications, datasheet and technical reference for anyone who wants the registers under machine | Manufacturer |
| Thonny | The editor, same as Week 4, now wearing its MicroPython hat; home installation | Project site |
| ESP32 · Microcontroller | What the chip and its species are, with history and context | Encyclopedic |
| ADC · Quantization · Nyquist–Shannon theorem | The measurement theory behind the staircase figure, at full depth | Encyclopedic |
| Voltage divider · Photoresistor | The circuit and the sensor, derivations and device physics included | Encyclopedic |
| PWM · Hysteresis · PID controller | The actuation and control concepts, from this week's previews to well past Week 10's needs | Encyclopedic |
Background reading, matched to the stages
| Stage | Read this for the ideas behind it |
|---|---|
| Meet the ESP32 | The microcontroller article for the species; the official tutorial as the second telling of flashing and first steps; Espressif's page for the chip's full feature list |
| Analog in | The ADC article through "resolution"; quantization for the error floor; the machine.ADC page for attenuation and the read family, nonlinearity notes included |
| Analog out | The PWM article's duty-cycle sections; hysteresis in control applications for the deadband idea at depth |
| Assignment 2 | The PID article's overview and "manual tuning" sections, read for shape, not memorization; Week 10 does the rest |
A note on board variants
"ESP32" names a family: beside the classic chip in your kit live the S2, S3, C3 and others, differing in cores, radios and pin maps. The course's board is the classic ESP32 DevKit, and this hub's pin numbers and snippets target it; the MicroPython docs flag variant differences inline where they exist. If a home board is a cousin, the concepts transfer completely, the pin numbers may not, and the quick reference plus the board's own markings settle it.
Practice
- Paper drills. Divider voltages for given LDR values; step sizes for 8-, 10- and 12-bit converters; duty values to percent and back. Each is one formula and thirty seconds; the final in Week 13 likes all three.
- REPL experiments. The quick reference is a menu: the chip's touch pins, its internal temperature sensor, a second PWM channel, deep sleep. Fifteen minutes of play per week keeps the board familiar instead of ceremonial.
- Refactor onto the board. Port a Week 4 ladder script to
machine: the construct-for-construct translation is the fastest way to feel how little actually changed. - Trace with hardware columns. Trace the hysteresis night light through a dusk scenario: columns for the reading, the mode and the LED. Control bugs live exactly where those columns disagree.
- Work the brief. The highest-value practice this week is the A2 second pass: every verification row drafted is revision, rehearsal and progress at once.
Glossary
| Term | Meaning |
|---|---|
| Microcontroller (MCU) | A single-chip computer, processor, memory, storage and peripherals together, running one program with no OS. |
| Single-board computer (SBC) | A full computer on one board, the Pi: operating system, filesystem, services. |
| Firmware | The program in a device's flash, its entire behaviour from power-on. |
| Flashing | Writing firmware into that flash memory; for us, a once-per-board Thonny operation. |
| Serial / UART | The byte-stream link between laptop and board over USB, carried by the bridge chip; the REPL's road. |
| ADC | Analog-to-digital converter: voltage in, number out. |
| Resolution | The converter's bit depth: N bits means 2N distinguishable levels. |
| Step size | V_ref / 2N: the voltage width of one count. |
| Quantization error | The rounding to the nearest level, at most half a step; the price of finiteness, not a fault. |
| Sampling | Measuring at discrete instants; the rate bounds what changes are visible. |
| Attenuation | The ESP32 ADC's input scaling; ATTN_11DB spans roughly the full 0 to 3.3 V. |
| Voltage divider | Series resistances splitting a supply in proportion; the bridge from resistance to voltage. |
| LDR / photoresistor | A resistor whose value falls with illumination; large, cheap, nonlinear, calibrated rather than computed. |
| Calibration | Mapping raw counts to meaning via measured anchors; configuration, documented in the repo. |
| PWM | Fast on/off switching whose on-fraction sets the delivered average. |
| Duty cycle | That on-fraction, 0 to 100%; duty_u16 expresses it as 0 to 65535. |
| Setpoint / process variable / error | The target, the measurement, and their difference, the vocabulary of every control loop. |
| Open / closed loop | Acting without measuring the result, versus correcting on the measured result. |
| Hysteresis | Two thresholds with a deadband, so decisions do not chatter at a boundary. |
| PID | The proportional-integral-derivative control law: now, the past, the trend, each weighted. |
| Telemetry | Measurements reported away from where they were taken; this week a printed line, next week a network message. |