11. Networking and Communications

This week's assignment is to design, build, and connect wired or wireless node(s) with network or bus addresses and a local interface. I used this task as the base for the Smart Pill Dispenser which is a modular system built around a custom PCB for the XIAO ESP32-C6. It combines an RTC clock (DS3231), an OLED display, and a Wi-Fi web interface (HTTP), all communicating over the I2C bus and served through the microcontroller's built-in Wi-Fi Access Point.

What is Networking and Communications?

In electronics and embedded systems, networking and communications refers to the ways microcontrollers and other devices exchange data with each other or with the outside world. Think of it like spoken language: each protocol is a different language with its own rules about who speaks first, how many wires are needed, how fast data travels, and how far it can reach.

This week we explored how our microcontrollers can "talk" to sensors or other boards (even to other devices like phones or laptops), either through physical wires or wireless connections through radio signals. Some of the existing protocols are I2C, SPI, UART, Wi-Fi, Bluetooth, ESP-NOW, HTTP, MQTT, and many more. Each has its own advantages and disadvantages depending on the use case. To learn more about them check the group assignment.

Group Assignment Page

Here's a quick summary of the most common communication protocols:

I2C: Inter-Integrated Circuit

I2C is a two-wire serial bus: SDA (Serial Data-transports the info) and SCL (Serial Clock-Synchronizes the data transmission), plus a shared ground. One device is the host (usually the microcontroller) and others are the targets with a unique 7-bit addresses.

The host or controllersends a START signal, then the address of the device it wants to talk to, then the data, and finally a STOP signal. Every device on the bus listens, but only the one with the matching address responds. This is why you can connect many devices to the same two wires.

Advantages

  • Only 2 wires needed regardless of how many devices
  • Many devices can share the same bus (each has a unique address)
  • Simple wiring, great for sensors and displays

Disadvantages

  • Slower than SPI (up to ~400 kHz standard)
  • Short distances only (same PCB or a few cm)
  • Address conflicts if two devices share the same address
  • Pull-up resistors required on SDA and SCL in some cases
I2C bus diagram showing host and multiple target devices connected via SDA and SCL lines

I2C bus: one host, multiple targets, only 2 signal wires.

Real-world examples

OLED displays, RTC clocks, temperature sensors (BME280), IMUs (MPU-6050), EEPROMs. This is the protocol I used this week to connect the RTC (DS3231) and the OLED display to my ESP32-C6 PCB.

Smart Pill Dispenser: My Week 11 Project

Designing the Modular ESP32-C6 PCB

I designed a modular PCB for the XIAO ESP32-C6 in KiCad. The idea was to have a compact board that exposes I2C connections (SDA/SCL), SPI (MOSI, MISO, SCK), a NeoPixel for visual feedback/debug signals, a button and pin headers to add componets like a potentiometer. Being modular means the XIAO plugs in and can be removed for other projects.

Why the ESP32-C6?

The XIAO ESP32-C6 has both Wi-Fi (2.4 GHz) and Bluetooth Low Energy built in, which makes it ideal for a connected device like the pill dispenser. It is small, has sufficient GPIO, and is supported by Arduino IDE through the ESP32 board package.

The PCB production process follows the same steps as Week 08 (Electronics Production):

Final Result: Smart Pill Dispenser in Action

Demo Video

The following video shows the full system running: the XIAO ESP32-C6 creates a Wi-Fi access point, the OLED displays the clock and alarm notifications, and the web interface is used from a phone to set an alarm and confirm a dose.

Possible Improvements

Learning Outcomes

Project Files

Key files from this week's work:

KiCad Schematic (.kicad_sch) KiCad PCB Layout (.kicad_pcb) I2C Hub PCB (.kicad_pcb) Full Arduino Sketch (.ino) Gerber Files (.zip) I2C Hub Gerbers (.zip)