Get Started with an ESP RainMaker Classic Example Project
In this tutorial, you'll learn the basic workflow of an ESP RainMaker project using the public instance of RainMaker, which removes the need for custom cloud backend setup or deployment. The switch example from the official ESP RainMaker repository will serve as a reference throughout this guide.
The tutorial will cover the following workflow steps:
Setup
- Set up Host environment and ESP IDF as that is the base SDK for ESP RainMaker.
- Download ESP RainMaker Project which has the core RainMaker firmware functionality, CLI and examples.
Configure Region
- When evaluating ESP RainMaker, two regions must be considered: Global and China.
- The default firmware works in both regions: the region is determined by the ESP RainMaker app you claim the device with. Only ESP32-S2, which has no Bluetooth, needs region-specific attention; see the region configuration section.
Build and Flash
- Build and flash the Switch example which will serve as the minialistic starting point.
Wi-Fi Provision and Control
- Download the Phone app which will be used to pair with the board and control it.
- Sign Up from the Phone app and login so that you can be uniquely identified by the cloud and can be given secure access to your own devices.
- Add the switch from the phone app (Wi-Fi provisioning and association with user).
- Control and monitor the device from the phone app.
To know more about the technical overview of ESP RainMaker, please refer to the documentation hub under section Technical Overview
If you're not familiar with firmware development, head over to the Tryout Centre in the Evaluation Hub to quickly try RainMaker using pre-built firmware and apps like the official ESP RainMaker app.
Note: ESP RainMaker works with all variants of ESP32 like ESP32, ESP32-S2, ESP32-C3 and ESP32-S3. We will just use the name ESP32 to mean all of these, unless explicitly specified otherwise.
Introduction
The ESP RainMaker GitHub project should be used for implementing a "Node" which can then be configured by logged in Users using the clients (like a phone app) and then controlled via the ESP RainMaker Cloud. In addition, the user can view the node operation data and create remote OTA jobs via the ESP RainMaker Dashboard. The examples in this guide are best suited for ESP32-S2-Saola-1, ESP32-C3-DevKitC and ESP32-S3-DevKitC, but the same can be used on other boards by re-configuring Button/LED GPIOs. Meanwhile, the example will use the ESP RainMaker APP to control device remotely.

Set up Host environment
Setup the Host environment and ESP IDF (master branch) as per the steps given here.
A Visual Studio Code Extension for ESP-IDF and ESP RainMaker is now available. You can check out the information here.
Setup Platform
Download ESP RainMaker using the following:
$ git clone --recursive https://github.com/espressif/esp-rainmaker.git
This repository has the agent code required for firmware development and the CLI required for testing.
Then, run the following commands:
$ cd /path/to/esp-rainmaker/examples/switch/
$ export ESPPORT=/dev/tty.SLAB_USBtoUART #Set your ESP32's serial port here
$ idf.py set-target esp32 # Set target platform to esp32, esp32s2, esp32c3 or esp32s3
Note the --recursive option. This is required to pull in the JSON dependencies into esp-rainmaker. In case you have already cloned the repository without this option, execute this to pull in the submodules:
git submodule update --init --recursive
Region Selection (Global/China)
For details on the differences between the Global and China regions of ESP RainMaker, refer here.
To learn about the claiming services used in public ESP RainMaker, refer here.
Claiming type
-
Assisted claiming is the default for every ESP32 series chip with Bluetooth, which the examples enable on all targets except ESP32-S2. The same firmware works with both the Global and the China region, so no region-specific configuration is needed.
-
ESP32-S2 has no Bluetooth and defaults to self claiming, which works with the Global region only. To evaluate in the China region on ESP32-S2, use host-driven claiming.
-
To claim without a phone on the Global region, switch to self claiming with
CONFIG_ESP_RMAKER_SELF_CLAIM=y. Self claiming is not available on ESP32 and ESP32-C2.idf.py menuconfig -> ESP RainMaker Config -> Claiming Type -> Use Self Claiming
Build and Flash firmware
It is recommended to first erase the flash using idf.py erase_flash if you are using this for the first time and then flash the firmware.
Here are the steps:
$ idf.py build
$ idf.py erase_flash
$ idf.py flash monitor
Tip (Advanced)
Besides using
idf.py erase_flash, you can erase the factory partition withesptool.py -p $ESPPORT erase_region 0x340000 0x6000to remove any old certificates. When erasing the factory partition, ensure the partition address is correct, as it may differ if the NVS (Non-Volatile Storage) partition image is not flashed to the default address (0x340000).
When you try this out for the first time, the monitor log will show a print like this:
I (755) esp_claim: Initialising Self Claiming. This may take time.
OR
I (895) esp_claim: Initialising Assisted Claiming. This may take time
This means that your board does not have the credentials to connect to the ESP RainMaker Cloud but will eventually get them from the Claiming service after it connects to the Wi-Fi.
When all the basic initialisations are done, the device will show a QR code on the terminal, which can be used for Wi-Fi provisioning.
QR code not rendering?
It is possible that the QR code may not render properly in your terminal. Something like this:

In that case, check the below lines on your terminal and copy paste the given URL in a browser.
I (1080) app_wifi: If QR code is not visible, copy paste the below URL in a browser.
https://rainmaker.espressif.com/qrcode.html?data={"ver":"v1","name":"PROV_000317","pop":"a1000317","transport":"softap"}
Note: You may have to pull the latest code from GitHub if you do not see this URL. Each board will have own unique QR code. So, use the URL from your serial terminal, not from the above snippet.
Wi-Fi Provisioning and Control
Wi-Fi Provisioning and Control can be done via:
- RainMaker Phone apps (Recommended)
- RainMaker CLI
Links to download the RainMaker Phone apps are found here
Follow these steps on the Phone apps
- Sign in using any of the third party options available (or sign up using email address and then sign in).
- Click on "Add Device" (or if you already have a device added, then the "+" symbol on top right).
- This will open the camera for QR code scanning.
- Alternatively, click on the "I don't have a QR code" button. Tap on "Connect" and connect to your ESP32's SoftAP/BLE interface (SoftAP for ESP32-S2, BLE for the rest)
- Follow the "Provision" workflow so that the ESP32 can connect to your Wi-Fi network.
- If everything goes well, you should see a "Switch" device added at the end.
- Tapping on the Switch icon will take you to the Control page.
What to expect in this example?
- This example uses the BOOT button and RGB LED on the development board to demonstrate a switch. ESP32-S2-Saola-1, ESP32-C3-DevKit and ESP32-S3-DevKit are best suited for this as they have the LED connected to the default configured GPIO.

- The LED state (green color) indicates the state of the switch.
- Pressing the BOOT button will toggle the state of the switch and hence the LED. This will also reflect on the phone app.
- Toggling the button on the phone app should toggle the LED on your board, and also print messages like these on the ESP32's monitor:
I (16073) app_main: Received value = true for Switch - output
LED not working?
The ESP32-S2-Saola-1 board has the RGB LED connected to GPIO 18. However, a few earlier boards may have it on GPIO 17. Please use CONFIG_WS2812_LED_GPIO to set the appropriate GPIO.
$ idf.py menuconfig
Component config -> WS2812 RGB LED -> WS2812 LED GPIO -> 17
Resetting the board
- Press and hold the BOOT button for more than 3 seconds to reset the Wi-Fi setting.
- Press and hold the BOOT button for more than 10 seconds to reset to factory defaults.
You will have to provision the board again to use it.
Set up RainMaker CLI (Optional)
The RainMaker CLI offers client functionality (similar to phone apps) integral to the RainMaker solution and can be used for testing and debugging. Please follow the steps here to set up the CLI.
Develop own firmware
Now that the basics are done, let's move onto understanding ESP RainMaker Code. To learn more about how to build a basic ESP RainMaker application by initializing Wi-Fi, setting up a node and device (e.g., a switch), adding standard parameters, and starting the RainMaker agent for cloud communication and control. In addition, you can also use the standardized ESP RainMaker solution to quickly create a product demo by referring to Custom & Standard Types. Currently ESP RainMaker supports lighting, electrical, energy monitoring, and MeshLite features.