This section provides step by step instructions on how to set up and start using the Bytebeam ESP-RS SDK . This SDK can be used with any ESP32 board. The only requirements are WiFi and a working internet connection.

Provision device with device config data

bytebeam-esp-rs requires device_config.json file in SPIFFS partition. We provide a tool for provisioning device.

$ git clone https://github.com/bytebeamio/bytebeam-esp-rs-sdk.git
$ cd bytebeam-esp-rs-sdk/tools/provision

Download the device configuration JSON file from Bytebeam cloud by following the Provisioning a Device guide and place it inside the provision project with the name device_config.json

You can use cargo espflash to build the project and flash it.

Connect your ESP board using USB and run the following command inside provision project :

cargo espflash --release --monitor --partition-table partitions.csv

NOTE: If you want to use custom partition table for your application, please replace partitions.csv file provided in provision project

You will see a log line with “Provisioning Done” message! You can then terminate it and move on to next step.

Let’s use bytebeam-esp-rs!

Add bytebeam-esp-rs as a dependency in your Cargo.toml

cargo add bytebeam-esp-rs

This will add an entry in your Cargo.toml like:

[dependency]
bytebeam-esp-rs = "0.1.0"

Now you can start using Bytebeam client in your project

/* other imports */
use bytebeam_esp_rs::ByteBeamClient;

fn main() -> anyhow::Result<()> {
    /*...
    Setup esp for Rust
    Connect to internet and initialize SNTP/NTP to sync time
    ...*/

    let bytebeam_client = ByteBeamClient::init()?;

    // use bytebeam_client here!
}

Check out examples for more details.

Build and Flash

Run this command within your application project :

cargo espflash --release --monitor --partition-table partitions.csv

NOTE: Use the same partitions.csv that you used for provisioning! If you didn’t use a custom table, you can download and use partitions.csv from the provision app!