- C 94.2%
- CMake 5.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| agent | ||
| handler | ||
| .gitignore | ||
| README.md | ||
ESP32 Command Control
A simple handler-agent like network with encryption, uses the ESP-NOW protocol.
Objectives
- Implement ESP-NOW device-to-device communication
- Analyze protocol security and encryption
- Build a simple network
Retrospect: Project is complete
Architecture
Handler
|
| ESP-NOW broadcasts
|
+---+---+
| |
Agent #1 Agent #2
The handler listens for special messages containing a shared secret (base64 encoded string) with certain message types. Example: An agent sends a type 0 msg, the handler receives & validates it. It adds the agent to a local list, waits for type 2 messages (heartbeats). The handler registers an agent as an encrypted peer when its first heartbeat arrives, so that heartbeat is unencrypted and all later ones are encrypted.
Requirements
- 3x ESP32 DevKit boards
- USB cables
- Development environment: ESP-IDF
Project Structure
root/
├── handler/
│ └── main/
│ └── main.c
├── agent/
│ └── main/
│ └── main.c
└── README.md
Building & flashing
Note: Hold BOOT button before flashing (At least, I have to do this, on windows...)
Prerequisites
Install CP210x/CH340 USB drivers:
MacOS (arm64 in my case)
brew install cmake ninja dfu-util
# setup ESP-IDF
mkdir -p ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
./install.sh esp32
# build and flash - X = handler or agent dir
cd X
# activate esp dev env (i use an alias)
idf.py build
idf.py -p /dev/cu.usbserial-* flash monitor
Windows
Manually install the IDF tools
# open "ESP-IDF PowerShell"
# build and flash - X = handler or agent dir
cd X
idf.py build
idf.py -p COM3 flash monitor
Usage
Flash Handler to one ESP32, Agent firmware to the others. Monitor serial output to observe communication.