This project provides tools to upload code to Arduino Nano and ESP32 boards, automatically injecting a random device ID into your code before upload. Both Python and Go CLI tools are available.
brew install arduino-cli- Download the latest
arduino-cli.exefrom the releases page. - Add the folder containing
arduino-cli.exeto your PATH.
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
sudo mv bin/arduino-cli /usr/local/bin/arduino-cli config init
arduino-cli core update-index
# Install Arduino Nano core
arduino-cli core install arduino:avr
# Install ESP32 core
arduino-cli core install esp32:esp32Many Arduino Nano boards (especially clones) require the "Old Bootloader". If you get upload errors like avrdude: stk500_getsync() not in sync, use this FQBN:
arduino:avr:nano:cpu=atmega328old
The tools are already set up to use the old bootloader for Nano uploads.
- Replaces
{{device_id}}in your source code with a random UUID - Uploads to Arduino Nano or ESP32 using
arduino-cli
- Python 3.7+
arduino-cliinstalled and configured for your boards- Python dependencies: see
requirements.txt
pip install -r requirements.txtpython main.py <source.ino> --board nano --port <serial_port>
python main.py <source.ino> --board esp32 --port <serial_port><source.ino>: Path to your Arduino/ESP32 sketch file--board: Target board type (nanooresp32)--port: Serial port (e.g.,/dev/ttyUSB0,/dev/ttyACM0, orCOM3)
- Replaces
{{device_id}}in your source code with a random UUID-like string (using Go's standard library, no external dependencies) - Uploads to Arduino Nano or ESP32 using
arduino-cli
- Go 1.13+
arduino-cliinstalled and configured for your boards
No external Go dependencies are required. Just use the standard library.
go run main.go -source <source.ino> -board nano -port <serial_port>
go run main.go -source <source.ino> -board esp32 -port <serial_port><source.ino>: Path to your Arduino/ESP32 sketch file-board: Target board type (nanooresp32)-port: Serial port (e.g.,/dev/ttyUSB0,/dev/ttyACM0, orCOM3)
- The Go tool generates a random UUID-like string for
{{device_id}}using the standard library (crypto/rand). - No external Go modules are required.
- The tool creates a temporary file for upload and cleans it up after.
Suppose your code contains:
String id = "{{device_id}}";When you run either tool, it will replace {{device_id}} with a random UUID and upload the code to your board.
- Make sure
arduino-cliis installed and your board cores are set up. See arduino-cli docs for details. - The tool creates a temporary file for upload and cleans it up after.
- Custom variables in the code
- Adding the dynamic data to database for post manufacturing support
- Webhooks to linkup with e-commerce website and backend to update the status of device as per a device_id in the dashboard
- Supporting firebase, supabase and on-prem database
- Supporting other boards
- UI