7.1 Networking
The TCP/IP stack on a microcontroller, the sockets API, securing connections with TLS, and the application protocols devices use: MQTT, HTTP and CoAP.
Lessons
- TCP/IP fundamentals · Layers, the handshake, flow and congestion control, and lwIP.
- Sockets API basics · Socket lifecycle, TCP versus UDP, blocking and select/poll.
- TLS for embedded systems · Handshakes, certificates, PSK, DTLS and fitting TLS in RAM.
- MQTT · Publish/subscribe, topics, wildcards, QoS, retained messages and wills.
- HTTP, REST and CoAP for IoT · REST design, HTTP versions, JSON versus CBOR, and CoAP.
Project: Connected air-quality monitor
An office CO2, temperature and humidity monitor that reports to the cloud and takes its commands: it filters the packets it receives, frames a TCP stream, checks the server's certificate, publishes over MQTT and backs off politely when the HTTP API is overloaded.