Lesson plan

Wireless links: nRF24 and ESP-NOW lesson plan

Board to board with no router: nRF24L01+ channels, addresses, pipes, acknowledgments and retries on Unos, then ESP-NOW peers, broadcast and unicast and a star network on ESP32-C3s, ending in a base camp on Mars.

4 chapters, 7 lessons, about 6 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

The unit

Objectives and materials

By the end, students can

  • Channels, addresses and pipes.
  • Acknowledgments and retries, and ESP-NOW peers.
  • Broadcast and unicast, and a star of sensors.
  • A base camp on Mars.

Materials for the whole unit

  • 2.4 GHz radio, nRF24L01+ x 3
  • Arduino Uno R3 x 3
  • ESP32-C3-DevKitM-1 x 4
  • LED x 2
  • Potentiometer 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 40 min

nRF24 radios

Channels, addresses and pipes.

LessonTimeWhat students do
Radios and addressesTwo Unos, two nRF24L01+ radios, no wire: a channel, a data rate and a 5-byte address that must all match, and an automatic acknowledgment that tells the sender its ping arrived.50 min
  1. Run it: a hut and a base
  2. The base listens
  3. A ping arrives
  4. Acknowledged
  5. Another channel
  6. Choosing a channel
nRF24 pipesOne hub, two huts: six reading pipes, the rule that pipes 2 to 5 share four address bytes with pipe 1, telling senders apart by pipe, and what happens when a hut’s pipe is closed.50 min
  1. Run it: two huts
  2. Hut A on pipe 1
  3. Hut B on pipe 2
  4. Both keep reporting
  5. Close a pipe
  6. More than six

Materials

  • 2.4 GHz radio, nRF24L01+ x 3
  • Arduino Uno R3 x 3

Check for understanding

Each student finishes "nRF24 pipes" 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: "More than six".

Chapter 2. About 1 h 45 min

Reliable links

Acknowledgments and retries, and ESP-NOW peers.

LessonTimeWhat students do
Acks and retriesWhat the radio does when an ACK does not come: automatic retries with a delay and a count, getARC() to see how many it took, a deaf hub to watch them run out, and commands riding back on the ACKs.55 min
  1. Run it: retries in hardware
  2. First time
  3. A command in the ACK
  4. The lamp follows
  5. A deaf hub
  6. A new command
  7. Retries and collisions
ESP-NOW peersESP32-C3s talking with no router: MAC addresses, esp_now_add_peer(), a send callback that reports the receiver’s ACK, and a receive callback with the sender’s MAC and signal strength.50 min
  1. Run it: two ESP32-C3s
  2. The base
  3. A peer and an ACK
  4. What the base hears
  5. A wrong address
  6. Channels and keys

Materials

  • 2.4 GHz radio, nRF24L01+ x 2
  • Arduino Uno R3 x 2
  • ESP32-C3-DevKitM-1 x 2
  • LED
  • Pushbutton
  • Resistor

Check for understanding

Each student finishes "ESP-NOW peers" 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: "Channels and keys".

Chapter 3. About 1 h 40 min

Topology

Broadcast and unicast, and a star of sensors.

LessonTimeWhat students do
Broadcast vs unicastOne sender, two receivers: unicast to one MAC, acknowledged; broadcast to FF:FF:FF:FF:FF:FF, heard by everyone and acknowledged by nobody. When each is the right tool.50 min
  1. Run it: one sender, two receivers
  2. Broadcast reaches everyone
  3. Unicast reaches one
  4. Who acknowledges
  5. Unicast to nobody
  6. Which to use
Many sensors, one hubA star network: three huts reporting to one hub over ESP-NOW, a table built by MAC as huts appear, message counts and missed sequence numbers, staggered timing, and a hut that goes silent.50 min
  1. Run it: a star
  2. Huts appear
  3. The table
  4. A hut goes silent
  5. A full table
  6. Star or mesh

Materials

  • ESP32-C3-DevKitM-1 x 4

Check for understanding

Each student finishes "Many sensors, one hub" 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: "Star or mesh".

Chapter 4. About 1 h 5 min

Boss project

A base camp on Mars.

LessonTimeWhat students do
Boss: a base camp on MarsA habitat hub and two pods on ESP-NOW: pods unicast their oxygen levels, the hub warns of low oxygen and silent pods, and one button broadcasts a dust storm alert that every pod answers by sealing its hatch.65 min
  1. Run it: base camp
  2. Pods report
  3. Low oxygen
  4. Dust storm
  5. Every pod answers
  6. Hatch lamps
  7. A pod goes quiet
  8. A stricter limit

Materials

  • ESP32-C3-DevKitM-1 x 3
  • LED x 2
  • Potentiometer x 2
  • Pushbutton
  • Resistor x 2

Check for understanding

Each student finishes "Boss: a base camp on Mars" on their own, without opening the hints. The simulator checks 8 of its 8 steps as they go.

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

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.