Module Integration Guides
...
ESP-IDF
Setting up Bytebeam ESP IDF SDK
12 min
this section provides step by step instructions on how to set up and start using the https //github com/bytebeamio/bytebeam esp idf sdk this sdk can be used with any esp32 board the only requirements are wifi and a working internet connection step 1 integrate bytebeam sdk with an esp project clone bytebeam esp idf sdk clone bytebeam esp idf sdk using a git client bytebeam esp idf sdk git clone https //github com/bytebeamio/bytebeam esp idf sdk git this repository consists of three folders src this folder contains source code for various functions that can be used by applications for interacting with bytebeam platform examples this folder contains few example projects showing how you can use the sdk provisioning application to push device config data to file system of device (say spiffs) provision device with device config data each device needs a configuration file to connect to bytebeam download the configuration file and flash it to spiffs by following the below steps download the device configuration json file from bytebeam cloud by following the docid\ otlg85yo zz3hecvknnyb guide after downloading the config file, rename it to the device config json step into config data folder within the provisioning project and place device config json file within this folder i e replace the file if it is already there launch the esp idf terminal and run the following command's \# make sure idf py tool is accessible $ idf py version \# step into provisoning project $ cd path to provisioning project \# set the target (say esp32) $ idf py set target esp32 \# configure the provisioning project (say partition table setting) $ idf py menuconfig \# clear the entire flash $ idf py erase flash \# build, flash and monitor $ idf py p port flash monitor add bytebeam esp idf sdk to the cmake build system of esp project once the device is provisioned, integrate the bytebeam esp idf sdk into your existing esp project open top level cmakelists txt from your esp project in an editor add bytebeam esp idf sdk component to your project by setting extra component dirs cmakelists txt set(extra component dirs "\<path to bytebeam esp idf sdk>") this command needs to be after the cmake minimum required() command look at the example project for reference open project level cmakelists txt from your esp project in an editor add bytebeam esp idf sdk component to your project priv requires step 2 configure hardware to connect your esp device to bytebeam cloud and exchange data, you need to configure wifi and partition settings follow the below steps to configure your project ) launch the esp idf terminal and run the following command's \# make sure idf py tool is accessible $ idf py version \# step into project $ cd path to project \# set the target (say esp32) $ idf py set target esp32 \# configure your project $ idf py menuconfig configure wifi/ethernet configure wi fi/ethernet settings by selecting example connection configuration option enter your wifi ssid and password press esc to exit out of the menu configure partition table settings this is required for implementing over the air updates the below steps partition your esp flash into two app partitions and one partition for storing the device config file copy examples partition csv file from example project and paste it into your esp project open menuconfig and select partition table option select custom partition table csv option from the available options and press esc button set the name of custom partition table csv to partitions example csv and press esc button note with above partition table selected, flash size of 4mb or more is recommended step 3 initialize and start bytebeam client the next step is to initialhe below code to do so // add this include to your file \#include "bytebeam sdk h" // declare and initialise bytebeam client object bytebeam client t bytebeam client; void app main(void) { // initialise esp // make sure you initialise the network as well as ntp before stepping ahead // setting up the device info i e to be seen in the device shadow bytebeam client device info status = "device is up!"; bytebeam client device info software type = "setup client app"; bytebeam client device info software version = "1 0 0"; bytebeam client device info hardware type = "esp32 devkit v1"; bytebeam client device info hardware version = "rev1"; // initialize the bytebeam client 	bytebeam init(\&bytebeam client); // start the bytebeam client bytebeam start(\&bytebeam client); / use the bytebeam stop api to stop the bytebeam client at any point of time in th the code, also you can mantain the bytebeam client start and bytebeam client stop flow as per you application needs / // bytebeam stop(\&bytebeam client); / use the bytebeam destroy api to destroy the bytebeam client at any point of time in the code, also you can mantain the bytebeam cient init and bytebeam client destroy flow as per you application needs / // bytebeam destroy(\&bytebeam client); } look at the https //github com/bytebeamio/esp bytebeam sdk/tree/main/examples/setup client example app for reference step 4 build and flash application you can build and flash your application as usual with idf py idf py p port flash monitor



