Skip to content

unyt-org/datex-esp32-example

Repository files navigation

DATEX on ESP32 - Example Project

This is an example project demonstrating how to use the DATEX library on an ESP32 microcontroller. The project includes a simple application that initializes the DATEX library, and connects to a Wi-Fi network, and setup a TCP client interface to communicate with a DATEX server.

Installation

To get started with this project, you will need to have Rust installed on your system. You can install Rust using the official installer from the Rust website: https://www.rust-lang.org/tools/install

Toolchain

  1. Installing espup. This is a tool that simplifies installing and maintaining the components required to develop Rust applications for the Xtensia and RISC-V architectures.
    cargo install espup
  2. Installing the necessary tool-chains
    espup install --toolchain <your-desired-toolchain>`
  3. Setting up the environment variables for the toolchain. You can add the following line to your shell configuration file (e.g., .bashrc, .zshrc):
    source "$HOME/export-esp.sh"
  4. Rename the file .cargo/config.toml.example to .cargo/config.toml and update the target field to match your installed toolchain.

Run

Using the Wokwi Simulator

  1. Install the wowki CLI tool: curl -L https://wokwi.com/ci/install.sh | sh
  2. Generate a new Wokwi project: wokwi-cli init -> firmware: firmware.bin -> elf: target/xtensa-esp32s3-none-elf/release/datex-esp32-example
  3. Generate the firmware.bin:
    espflash save-image \
    	--chip esp32s3 \
    	--partition-table partitions.csv \
    	target/xtensa-esp32s3-none-elf/release/datex-esp32-example \
    	firmware.bin
  4. Set the WOKWI_CLI_TOKEN environment variable with your Wokwi API token
  5. Run the Wokwi project in CLI: wokwi-cli run (paid license required?)

Building for specific ESP32 target

Build the project for your specific ESP32 target using the following command, e.g. for Esp32s3:

cargo build --features target_esp32s3 --target xtensa-esp32s3-none-elf --release

Using real target

  1. Connect your ESP32 device to your computer and identify the serial port it is connected to (e.g., /dev/tty.usbserial-210 on macOS or COM3 on Windows).
  2. Run cargo flash-esp32, flash-esp32s3, or flash-esp32c3 depending on your ESP32 device. This will build the project and flash it to your ESP32 device. Make sure to use the correct command for your specific ESP32 variant.

Configuration

The config.dx file contains the DATEX endpoint configuration and Wi-Fi credentials. Update the WIFI_SSID, WIFI_PASSWORD, and WIFI_AUTH_METHOD fields with your Wi-Fi network information.

{
    endpoint: @esp32,
    interfaces: [
       // your interfaces here 
    ],
    env: {
        WIFI_SSID: "ssid",
        WIFI_PASSWORD: "****",
        WIFI_AUTH_METHOD: "Wpa",
    }
}

© unyt 2026 • unyt.org

About

Simple demo project for building DATEX on an ESP32 target

Resources

Code of conduct

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors