11. Networking and communications
Group AssignementThis week I learned for the first time ever how to communicate between microcontrolers and devices. Or how it can be done through many different options.
Some of of the things to consider before deciding on a communication channel:
- What hardware will you be using? And what are it's specifications and capacities?
- How fast is the exchange of information needed?
- How much information will be exchanged?
- How many devices will be communicating?
- Is a local or public network needed? (Careful with credentials and regulations)
- Will a visual interface be needed?
- Will the system change along the way? (Will devices will be added or removed?)
- How far does the information have to travel?
To start, I chatted a little with ChatGPT about the idea I had, the specificaitions of the boards I would be using and my vision to scale this assignement to my final project:
The goal: Pressing a button on the DevKit triggers the LED + buzzer pattern on the C3, while the C3 keeps reading the microphone, and the DevKit receives that signal and prints a message in Serial.
I also asked which communication method would work best and how this could scale to my final project.
Chat's recommended solution: The best option is ESP-NOW, a direct, low-latency wireless protocol between ESP32 boards that does not require Wi-Fi infrastructure.
Why ESP-NOW:
- Simple and fast for device-to-device control
- No router needed (ideal for installations and demos)
- Lower complexity than BLE or HTTP servers
- Scales well to multiple nodes for the final project
Proposed architecture:
ESP32 DevKit V1 (Host / Controller)
- Uses BOOT button (GPIO0)
- Sends TRIGGER command
- Receives SOUND events and prints to Serial
ESP32-C3-Zero (Remote Node)
- Executes LED + buzzer sequence when receiving TRIGGER
- Reads microphone locally
- Sends SOUND message when threshold is exceeded
Key implementation steps
- Test basic ESP-NOW communication (send + receive + ACK)
- Trigger LED/buzzer sequence remotely
- Add microphone detection and send events back
- Structure messages using simple commands (TRIGGER, SOUND, ACK)
The process:
- Getting the MAC adress of each microcontroler.
- Testing a simple communication code to check everything works.
- Uploading the final version of the codes to each microcontroler:
- Checking the final version worked: