Temperature Sensor
| Technical solution | Classic |
|---|---|
| Use case | Appliances & Controls |
This example demonstrates simulating a temperature sensor using an ESP32 Series Development Board, where the temperature value cycles between 0.5°C and 99.5°C, and the onboard RGB LED visually represents the temperature by changing color from blue to red. The temperature changes can also be monitored via a phone app.
Product use case: A temperature sensor clipped to warehouse racking, reporting readings the ESP RainMaker Home App charts as a time series.
Overview
| Processor | ESP32/ESP32-C3/ESP32-C6/ESP32-S3/ ESP32-H2 |
|---|---|
| Connectivity | Wi-Fi/Thread + BLE |
| Vcc | 3.3V |
| IDF Version | ESP-IDF v5.x and newer |
You will need
- ESP32, ESP32-C3, ESP32-C6, ESP32-S3 or ESP32-H2 DevKit
- USB data cable
- Chrome or Edge (Web Serial)
- ESP RainMaker phone app
What you can try
- System Service: The System Service in ESP RainMaker allows remote control of essential device operations, such as rebooting, resetting Wi-Fi settings, and restoring factory defaults.
- Time Service: Time is a crucial aspect of any IoT device, especially for enabling features such as device scheduling.
- Scenes: In the context of IoT in general and ESP RainMaker in particular, a 'scene' refers to a group of parameters set to specific values, where one or more devices may span across multiple nodes.
- Schedule: ESP RainMaker's scheduling feature enables automated control of devices based on predefined times, enhancing convenience and energy efficiency.
- OTA Updates: OTA Updates add features and fix bugs for devices in fields.
- Time Series: Time Series enables devices to log and store parameter data with timestamps, allowing users to track changes and monitor trends over time through ESP RainMaker.
Try it on a real board
Get an official DevKit from Espressif or one of its distributors, then flash this example straight from this page. Shop Espressif DevKits
Flash and try it
Choose your deployment
Public deployment
Hosted by Espressif for evaluation. Free, with nothing to set up.
- Connect: Plug in the board over USB and pick its serial port.
- Flash: Write the prebuilt firmware. Wait for the erase and flash to finish.
- Reset: Reboot the board. A QR code appears in the console.
- Pair: In the Home App, tap +, connect over Bluetooth and enter the PoP from the console.
Detailed instructions
1. Prerequisites
- Linux, macOS, or Windows-based computer.
- An ESP32/ESP32-C6/ESP32-C3/ESP32-S3/ESP32-H2 DevKit.
- USB cable.
2. Connect your device
- Connect your device to the computer using a USB cable, then click the
Connectbutton located in the top-left corner above the terminal. - Select the right port and click
connect. - Once connected, the device is ready to be flashed.
3. Flash your device
- Click
Flash Deviceabove the terminal and choose Erase and flash. Wait for theerase_flashprocess to finish before the firmware is written. - Wait for the firmware flashing process to complete.
- Click the
Resetbutton to reset the device. - When you see the QRcode in the terminal, it means that the flashing process is completed successfully.
4. Provision the device in the Home App
- In the Home App panel next to the console, keep the ESP RainMaker Classic deployment, then sign in. You can also use the ESP RainMaker phone app, available here.
- Tap
+, choose I do not have a QR code, then Bluetooth. - In Chrome's Bluetooth window, pick the device whose name matches the one in the console, for example
PROV_ff7bf2. - Enter the PoP when asked. It is the
"pop"value in theQRCODE:line of the console, for example{"ver":"v1","name":"PROV_xxxxxx","pop":"xxxxxxxx","transport":"ble"}. - Pick your Wi-Fi network, enter its password and wait for provisioning to finish. The device then appears under My Devices.
- Control the device from the app.
Private deployment
Your own ESP RainMaker Classic deployment. Register nodes with the Admin CLI, not the dashboard.
- Register: With the ESP RainMaker Admin CLI, generate device certificates and register them with node_certs.csv.
- Load credentials: Zip the CLI batch folder (Mfg-…) or pick one node's .bin from its bin/ folder, and drop it into Device credentials.
- Flash: Write the firmware and the credentials in one pass. The board resets when done.
- Pair: Sign in to your private Classic deployment in the Home App, then add the device with the PoP from the console.
Detailed instructions
1. Before you start
- A private ESP RainMaker Classic deployment (you need its deployment base URL and super-admin email from setup).
- The ESP RainMaker Admin CLI installed on your computer (esp-rainmaker-admin-cli).
- An ESP32-family DevKit that matches this example, a USB data cable, and Chrome or Edge.
2. Generate and register device certificates
- Follow the Admin CLI user guide. Set your deployment endpoint and log in:
python rainmaker_admin_cli.py account serverconfig --endpoint <your-deployment-base-url> python rainmaker_admin_cli.py account login --email <super-admin-email>
- Generate certificates for your boards (factory NVS images land under
bin/in the output folder):python rainmaker_admin_cli.py certs devicecert generate --count <n> --prov ble --outdir <outdir>
- Register them with the cloud using the batch's
common/node_certs.csv:python rainmaker_admin_cli.py certs devicecert register --inputfile <outdir>/<date>/Mfg-<no>/common/node_certs.csv
- Save the
request_idfrom the register command and check status when needed:python rainmaker_admin_cli.py certs devicecert getcertstatus --requestid <request_id>
- The output holds private keys. Keep it out of chats and repositories, and delete it when you are done.
3. Load the device credentials
- From the Admin CLI output folder, zip the
Mfg-<no>batch folder, or pick onebin/node-….binfile. - Drop that ZIP or
.binonto Device credentials above the console. It is read in your browser and never uploaded. - With the ZIP, pick the node for this board. Every board needs its own node: two boards with the same one connect as the same device.
- The credentials are flashed at
0x3FA000, where this example keeps itsfctrypartition.
4. Connect and flash
- Connect the board over USB, click
Connectabove the console and pick its port. - Click
Flash Deviceand choose Erase, then flash firmware + credentials. The firmware image goes to0x0and the credentials to0x3FA000in one pass, so the erase cannot wipe them. - The board resets when flashing is done. Type
get-node-idin the console when the firmware supports it: it prints the node you picked. - To give a board another node later, or restore one after a full erase, load the credentials and choose Credentials only. The firmware on the board is kept.
- To reflash only the firmware, choose Flash only. The credentials on the board are kept.
5. Sign in on your deployment
- In the Home App panel next to the console, sign in to your private ESP RainMaker Classic deployment (the base URL from your deployment setup).
- You can also use the ESP RainMaker phone app (iOS / Android); point it at the same deployment if your build supports a custom endpoint.
- Use a regular user account for day-to-day testing, not the super-admin account used with the Admin CLI.
6. Provision the device in the Home App
- Tap
+, choose I do not have a QR code, then Bluetooth. - In Chrome's Bluetooth window, pick the device whose name matches the one in the console, for example
PROV_ff7bf2. - Enter the PoP when asked. It is the
"pop"value in theQRCODE:line of the console, for example{"ver":"v1","name":"PROV_xxxxxx","pop":"xxxxxxxx","transport":"ble"}. - Pick your Wi-Fi network, enter its password and wait for provisioning to finish. The device then appears under My Devices.
- Control the device from the app.
Having trouble connecting?
- Ensure your device is properly connected via USB
- Check if the correct drivers are installed
- Try a different USB port or cable
- Verify that your device is in flashing mode
- Get the latest ESP RainMaker phone application here