Source: https://mokxi.com/teachers/plans/iot-devices
Updated: 2026-11-11

Lesson plan

# Connected devices lesson plan

WiFi, APIs, a web server, MQTT, ESP-NOW and BLE on the ESP32, and a device that keeps going when the network does not.

4 chapters, 7 lessons, about 4 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

- Join WiFi, call an API, and serve a page of your own.
- MQTT through a broker, and ESP-NOW with no router at all.
- A Bluetooth LE server a phone can find, write and listen to.
- The time from the network, and a device that rejoins on its own.

### Materials for the whole unit

- ESP32 DevKit V1 x 2
- ESP32-C3-DevKitM-1
- Four-digit display, TM1637
- Full-size breadboard
- LED x 2
- 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 50 min

## On the network

Join WiFi, call an API, and serve a page of your own.

Lesson | Time | What students do

Joining WiFi The connect loop every connected device starts with: WiFi.begin, the states a station walks through, the address DHCP hands out, and what a wrong password and a wrong network name look like. | 40 min

- Run it
- The address
- The states of a station
- Get the password wrong
- Now the wrong name
- Signal strength

Calling an API HTTPClient against a JSON API: a GET, the status code, the body, a different endpoint, and what a request that cannot reach its server returns. | 35 min

- Run it
- The status code
- The JSON body
- Ask a different server
- A request that cannot get there

A web server The board serves a page: a WiFiServer on port 80 reads the browser’s request a line at a time, switches two LEDs from the path, and prints the page back. | 35 min

- Run it
- Where to point the browser
- Press a button on the page
- Start with the light on
- Who can reach it

### Materials

- ESP32 DevKit V1
- ESP32-C3-DevKitM-1
- Full-size breadboard
- LED x 2
- Resistor x 2

### Check for understanding

Each student finishes "A web server" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

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

Chapter 2. About 1 h 10 min

## Messages

MQTT through a broker, and ESP-NOW with no router at all.

Lesson | Time | What students do

MQTT with PubSubClient Publish and subscribe through a broker: topics, payloads, QoS and retained messages, the PubSubClient connect loop with its error codes, and the same reading sent over HTTP where the simulator has no broker. | 35 min

- A post office for devices
- Write the PubSubClient loop
- Read the error code
- QoS and retained messages
- Send the reading anyway

ESP-NOW Two ESP32s and no router: a button on one switches an LED on the other over ESP-NOW, the sender hears the acknowledgment, and a wrong MAC address shows what no answer looks like. | 35 min

- Run it
- Press the button
- The receiver lights up
- Send to nobody
- When to use it

### Materials

- ESP32 DevKit V1 x 2
- ESP32-C3-DevKitM-1
- Full-size breadboard
- LED
- Pushbutton
- Resistor

### Check for understanding

Each student finishes "ESP-NOW" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

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

Chapter 3. About 25 min

## Talk to a phone

A Bluetooth LE server a phone can find, write and listen to.

Lesson | Time | What students do

BLE: a lamp your phone can find Bluetooth Low Energy the way phones see it: a GATT server with the Nordic UART service, a characteristic to write, notifications back, and advertising again after a phone leaves. | 25 min

- Run it
- Services and characteristics
- Connect, switch it, and leave
- Give it your name

### Materials

- ESP32 DevKit V1
- LED
- Resistor

### Check for understanding

Each student finishes "BLE: a lamp your phone can find" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

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

Chapter 4. About 35 min

## Stay connected

The time from the network, and a device that rejoins on its own.

Lesson | Time | What students do

Reconnecting and NTP time A clock that gets the time from NTP, keeps counting on its own, shows your time zone, and notices when WiFi drops and joins again without a reset. | 35 min

- Run it
- Ask for the time
- Counting on its own
- Your time zone
- When WiFi drops

### Materials

- ESP32 DevKit V1
- Four-digit display, TM1637

### Check for understanding

Each student finishes "Reconnecting and NTP time" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

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

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.
