This is Rust-based firmware for the ESP32 micro-controller that implements a physical input node of an automation network. It will send out a message to a specific target whenever GPIO12
is pulled towards GND.
The input node is tied to a specific automation/flow, by which the incoming messages will be processed.
The input node accepts control commands on a specific UDP port. Right now this is used to specify a new target for the node (needed to transfer an automation), and to perform a UDP ping.
- Build the firmware
cargo build
- Connect the ESP32 via USB/UART and flash the built firmware binary:
espflash flash -p <port> .\target\xtensa-esp32-espidf\debug\esp-input-node --monitor
<port>
needs to be replaced with the serial interface where the ESP is connected, e.g.COM3
on Windows. Slashes also need to be adapted to the OS.
The path to the binary also has to be updated to point to the correct version of the binary. If the firmware is built in release mode, the path needs to containrelease
instead ofdebug
. - Pull down
GPIO12
to send out a UDP message to the specified target node.
The ESP32 might restart a few times if it doesn't manage to connect to WiFi right away. If the credentials are correct, it should connect after two or three reboots.
- Install Rust using the following guide: https://esp-rs.github.io/book/installation/index.html
- Try to build one of the sample repos, i.e. https://github.com/ivmarkov/rust-esp32-std-demo
Be careful with directory names. It seems like long names will cause errors during the build! - Clone this repo:
git clone https://github.com/Chaphasilor/decentralized-automation-networks_esp32-input-node` esp-input-node
- Set up the config file (
cfg.toml
):
You can use the provided demo config for this - Build the project:
cd esp-input-node cargo build