- C 95.5%
- CMake 2.5%
- Dockerfile 2%
| .devcontainer | ||
| .vscode | ||
| main | ||
| .clangd | ||
| .gitignore | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
espnow-serial-idf
ESP-IDF project making 2 ESP32s talk to each other over ESPNOW, and to the users via serial.
Boards are meant to be pair. They share an AES encryption key kept secret, and pair only with other using their MAC addresses.
Messages received appear in green. Run /status to fetch remote board's RSSI and SNR.
By default, boards go into online mode, where they actively ping each other every 10 seconds. If they get a reply, they set their ONLINE_LED_PIN high. After 20 seconds of no pings, they set it low, indicating the other board is offline.
In online mode, fire up a terminal to type and receive messages/commands to each other.
Hold down PING_BUTTON_PIN on boot to go offline, allowing manual, morse code-like communication by pressing MANUAL_BUTTON_PIN. Pings/serial/commands are disabled in this mode, making it very minimal. Useful for low signal scenarios, where every packet might not get through, or for testing.
Software Instructions
- Clone source code
- Change the receiver's MAC address in peerMac
- Generate AES encryption key (openssl rand -hex 16), put it in
- Depending on your board, change main.c to either include "serial.h" or serial_usb.h"
- Update CMakeLists.txt to include either "serial.c" or "serial_usb.c"
- Check pin definitions to match your board/breadboard pins
- idf.py set-target (your chip)
- idf.py build
- idf.py flash -p (serial port of your board)
- Use any serial program to interface (picocom/minicom/screen/putty)
Optional: Check your channel, adjust ping times / button polls / led timings etc.
Hardware Instructions
(Per Board, Remember, You Need 2!)
You need:
- 1x ESP32 (Any chipset)
- 4x LEDs, preferably different colors
- 4x Resistors, for the LEDs
- 2x Buttons
- Jumper wires to hook things up
By default, buttons are pulled up and go low when pressed. LEDs go high for a signal, low for off.
Optional:
If your ESP32s support external antennas, you can use directional high gain ones for more range.
WARNING, WARNING, WARNING
DO NOT use the default AES key provided, as it is public knowledge. Generate one with the provided instructions, and replace it in the source code of both boards. Keep that key secret.
I cannot gurantee the security of this project, do NOT use it for real communication where you are at risk, unless you have read, understand, and agree that the source code and idea are safe.
I take no responsibility for any misuse.
That being said, theoretically, if encryption is on, and you do use your own AES key, all traffic between your two boards is encrypted. I have attempted to sniff with wireshark and can confirm. This is, in theory a secure way of communication between 2 individuals.