Source: https://mokxi.com/teachers/plans/micropython-esp32
Updated: 2026-11-11

Lesson plan

# MicroPython on the ESP32 lesson plan

Python on an ESP32 DevKit: the REPL and blink, pins and PWM, the ADC, timers and interrupts, I2C sensors, WiFi in five lines, and a lamp you switch from a web page.

4 chapters, 7 lessons, about 5 hours, on the ESP32 DevKit V1. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- Blink and the REPL, then buttons and PWM brightness.
- Read a knob with the ADC, and let timers and interrupts do the waiting.
- Two chips on I2C, then WiFi, JSON and HTTP.
- A web lamp with a button, a socket server and a self-test.

### Materials for the whole unit

- ESP32 DevKit V1
- LED x 2
- OLED display, 128x64
- Potentiometer
- Pressure, humidity and temperature, BME280
- Pushbutton
- Resistor x 2

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 30 min

## First Python on the ESP32

Blink and the REPL, then buttons and PWM brightness.

Lesson | Time | What students do

REPL and blink Blink an LED from main.py, then type Python straight into the ESP32: math, a pin by hand, and a question for the chip itself. | 45 min

- Run it
- print() talks back
- The REPL
- A pin by hand
- Ask the chip
- Your turn: faster

Pins and PWM Read a button with the pin’s own pull-up, catch the moment it is pressed, and set an LED to any brightness with PWM. | 45 min

- Run it
- Press it
- PWM is fast blinking
- Predict the reading
- Why % and //
- Your levels

### Materials

- ESP32 DevKit V1
- LED x 2
- Pushbutton
- Resistor x 2

### Check for understanding

Each student finishes "Pins and PWM" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Your levels".

Chapter 2. About 1 h 30 min

## Sensors and time

Read a knob with the ADC, and let timers and interrupts do the waiting.

Lesson | Time | What students do

The ADC: volts in, numbers out A knob makes a voltage, the ADC turns it into a number, and that number drives an LED. Then the trap every ESP32 beginner falls in: attenuation. | 45 min

- Run it
- All the way down
- Predict the middle
- The attenuation trap
- Honest numbers
- Your turn: a percent

Timers and interrupts A hardware timer blinks an LED on its own, an interrupt counts button presses the instant they happen, and you meet contact bounce and beat it. | 45 min

- Run it
- Count the ticks
- Faster
- An interrupt per press
- Bounce
- Beat the bounce

### Materials

- ESP32 DevKit V1
- LED
- Potentiometer
- Pushbutton
- Resistor

### Check for understanding

Each student finishes "Timers and interrupts" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Beat the bounce".

Chapter 3. About 1 h 30 min

## Buses and networks

Two chips on I2C, then WiFi, JSON and HTTP.

Lesson | Time | What students do

I2C sensors Two chips share two wires: scan the bus, read a register by hand, turn a BME280’s raw numbers into weather, and draw it on an OLED. | 45 min

- Scan the bus
- Weather in numbers
- Make it hot
- The screen
- Read a register yourself
- Your turn: an alarm

WiFi in five lines Join a network, get an address, read the signal, fetch JSON from a server, post your own, and see what a wrong password looks like. | 45 min

- Join the network
- Signal strength
- Fetch JSON
- Post your own
- A wrong password
- Your turn: what time is it?

### Materials

- ESP32 DevKit V1
- OLED display, 128x64
- Pressure, humidity and temperature, BME280

### Check for understanding

Each student finishes "WiFi in five lines" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Your turn: what time is it?".

Chapter 4. About 45 min

## Project

A web lamp with a button, a socket server and a self-test.

Lesson | Time | What students do

Project: a web lamp Everything at once: a socket server on port 80, a page that switches a lamp, a button that does too, and a self-test that proves the logic before the server starts. | 45 min

- Run it
- Test before you serve
- The button still works
- Switch it from the web
- Add a route, test first
- Make it yours

### Materials

- ESP32 DevKit V1
- LED
- Pushbutton
- Resistor

### Check for understanding

Each student finishes "Project: a web lamp" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Make it yours".

Your class

## Teach this unit as a class

Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
