ESP-Nodes/Tutorial-Rainmaker.md
2024-08-11 01:17:02 -04:00

4.6 KiB

ESP RAINMAKER TUTORIAL

This tutorial walks you through the most important steps neccessary to provision ESP32-WROOM device.

Tip

WHAT'S REQUIRED:

ESP32-WROOM, either a Module or DevKit
Wi-Fi Access Point, preferrably with dedicated vLAN for IoT devices
Smart phone with RainMaker installed

ESP-IDF: Create a New Project

Launch ESP-IDF extention on VS Code

ESP-IDF. Create a New Project

Specify project name, directory path and ESP32 module (ESP32-WROOM or ESP32-C3). In addition, you may state the Serial port where ESP32 Module is connected to; this setting can be changed latter, if neccessary.

ESP-IDF. Create a New Project

On the next screen, specify ESP Rainmaker extention and select example code to start with. For this tutorial, an example code for _ Switch _ was selected. Click "Create project using template switch".

ESP-IDF. Create a New Project

Modify Template Code

Make the following changes to app_main.cpp source file.

Change the TAG variable as follows:

static const char *TAG = "ESP32-Nodes app main";
esp_rmaker_node_t *node = esp_rmaker_node_init(&rainmaker_cfg, "ESP RainMaker Device", "Switch");
switch_device = esp_rmaker_device_create("ESP32-Nodes Switch", ESP_RMAKER_DEVICE_SWITCH, NULL);
ESP-IDF. Create a New Project

Modify Configuration

Navigate to the ESP-IDF: SDK Configuration Editor (menuconfig). Some of the default values provided by RainMaker Switch template need to be changed in order to match GPIO used to turn LED Lights on or off.

Click on Example Configuration section, and change Output GPIO value to 4, which corresponds to the GPIO connected to the LED lights control pin.

Set Claiming Type to Assisted, and Provisioning Transport Method to BLE.

ESP-IDF. Create a New Project

Click Save and then build the project by running the command ESP-IDF: Build Project.

ESP-IDF. Create a New Project

Building the project can take some time.

ESP-IDF. Create a New Project ESP-IDF. Create a New Project

Adding RainMaker Device

Once project is successfully built, and ESP32-WROOM module is flashed, reboot your device and open Serial Monitor in order to access provisioning QR code. At this point you can start adding your device to your RainMaker dashboard. On your smartphone, launch the ESP RainMaker app and click Add device. You'll be asked to scan the QR code. If provisioning is successful, ESP RainMaker app will take you to the nest steps.

ESP-IDF. Create a New Project ESP-IDF. Create a New Project Alexa Account Linking to RainMaker RainMaker Provisioning. Adding Wi-Fi RainMaker Provisioning RainMaker. ESP32 Node Switch Setting RainMaker. ESP32 Node Switch