All paths

Design a protocol

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.

Arduino Uno R3Free7 lessons6 h4 chapters2,498 XPEmbedded engineering · Advanced+250 XP

0 of 7 done

What you will build

3 projects, built step by step

7 lessons in 4 chapters, about 6 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 1 project

Escaping

Frames 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.

Open it in the simulator
Chapter 2 project

Acks and retries

Stop-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.

Open it in the simulator
Chapter 3 project

Binary or text

The 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.

Open it in the simulator
The map

Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

Bytes into messages

Start bytes, lengths, flags, and the escape that keeps a flag a flag.

  1. Open227 XP

    Framing

    A 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.

    0 of 5 steps

  2. ProjectLocked454 XP

    Escaping

    Frames 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.

    0 of 5 steps

4 questions, graded as you go.
Chapter 2

Surviving the noise

A CRC to catch damage, and acks and retries to repair it.

  1. Locked265 XP

    Catching damage with a CRC

    A 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.

    0 of 6 steps

  2. ProjectLocked530 XP

    Acks and retries

    Stop-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.

    0 of 6 steps

4 questions, graded as you go.
Chapter 3

Protocols that last

Versions, message types, and choosing between binary and text.

  1. Locked227 XP

    Versioning

    A 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.

    0 of 5 steps

  2. ProjectLocked530 XP

    Binary or text

    The 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.

    0 of 6 steps

4 questions, graded as you go.
Chapter 4

Boss project

Two boards that never lose a message, through a storm.

  1. Locked265 XP

    Boss: never lose a message

    The 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.

    0 of 6 steps

3 questions, graded as you go.
Syllabus

Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

Bytes into messages

  1. 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.
  2. 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.
Chapter 2

Surviving the noise

  1. 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.
  2. 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.
Chapter 3

Protocols that last

  1. 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.
  2. 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.
Chapter 4

Boss project

  1. 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.
Kits

Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.

See every kit
Questions

About Design a protocol

Is Design a protocol free?

Yes. All 7 lessons of Design a protocol are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Arduino Uno R3?

No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Design a protocol take?

About 6 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: Escaping, Acks and retries and Binary or text.

Where do I start?

With "Framing", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.