Design a protocol lesson plan
A deep-sea probe and its surface buoy, two Unos on a noisy serial link: framing, byte stuffing, CRC-16, acks and retries, versioning, binary against text, and a dive log that crosses a storm without losing a single reading.
Objectives and materials
By the end, students can
- Start bytes, lengths, flags, and the escape that keeps a flag a flag.
- A CRC to catch damage, and acks and retries to repair it.
- Versions, message types, and choosing between binary and text.
- Two boards that never lose a message, through a storm.
Materials for the whole unit
- Arduino Uno R3 x 2
- Half breadboard
- LED x 2
- Resistor x 2
- Slide switch
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.
Bytes into messages
Start bytes, lengths, flags, and the escape that keeps a flag a flag.
| Lesson | Time | What students do |
|---|---|---|
| FramingA serial link carries bytes, not messages. A start byte and a length turn the stream into frames, a three-state parser finds them, one lost byte swallows two readings, and a silence timeout gets them back. | 45 min |
|
| EscapingFrames that end on a flag byte resynchronize by themselves, until the data contains the flag. At 125 and 126 meters the frames fall apart; byte stuffing with a 0x7D escape, as HDLC and PPP do it, puts them back together. | 45 min |
|
Materials
- Arduino Uno R3 x 2
- Half breadboard
- LED x 2
- Resistor x 2
- Slide switch
Check for understanding
Each student finishes "Escaping" 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: "The price of stuffing".
Surviving the noise
A CRC to catch damage, and acks and retries to repair it.
| Lesson | Time | What students do |
|---|---|---|
| Catching damage with a CRCA CRC-16 over every frame, computed a bit at a time and checked against the standard’s check value: the storm flips one bit, the buoy catches it every time, and with the check switched off the same bit becomes a believable wrong depth. | 55 min |
|
| Acks and retriesStop-and-wait: every good frame is acked by its sequence number, a missing ack means send it again, a lost ack makes a duplicate the buoy must recognize, and with no retries the readings are simply gone. | 55 min |
|
Materials
- Arduino Uno R3 x 2
- Half breadboard
- LED
- Resistor
- Slide switch
Check for understanding
Each student finishes "Acks and retries" 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: "Choosing the numbers".
Protocols that last
Versions, message types, and choosing between binary and text.
| Lesson | Time | What students do |
|---|---|---|
| VersioningA buoy that has been at sea for two years meets a new probe: a version in every frame, a hello, message types skipped by their length, and new fields only ever on the end, so old and new keep talking. | 45 min |
|
| Binary or textThe same reading as an NMEA-style text sentence with an XOR checksum, and as a 9-byte binary frame with a CRC: twice the bytes against a line you can read, and ten times the parsing time against a format you can type. | 55 min |
|
Materials
- Arduino Uno R3 x 2
- Half breadboard
- LED x 2
- Resistor x 2
- Slide switch
Check for understanding
Each student finishes "Binary or text" 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: "Choosing".
Boss project
Two boards that never lose a message, through a storm.
| Lesson | Time | What students do |
|---|---|---|
| Boss: never lose a messageThe probe surfaces and uploads its 20-reading dive log through a storm: flags and byte stuffing, a version and type in every frame, CRC-16, acks, retries with a growing timeout, duplicate detection, and a final count that proves nothing was lost. | 55 min |
|
Materials
- Arduino Uno R3 x 2
- Half breadboard
- LED x 2
- Resistor x 2
- Slide switch
Check for understanding
Each student finishes "Boss: never lose a message" 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: "Write the spec".
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.