ESP32 IoT Dashboard: Send Sensor Data to a Live Chart
Published on Nov 6, 2026
To see sensor data on a chart, the ESP32 only has to do one thing: every few seconds, send the reading over HTTPS to a server that stores it and draws the history. In this article you build that with a DHT22 (temperature and humidity), a channel on the 4DVolt IoT Dashboard and a short sketch, then set up an alert for when the temperature goes over a limit. You can test it all before you have the board, using the simulated ESP32.
How the data reaches the chart
The path has four stages:
- The sensor measures (the DHT22 gives temperature in °C and humidity in %).
- The ESP32 reads the sensor, joins the Wi-Fi and sends the readings in an HTTPS
POSTwith a JSON body. - The dashboard channel receives, validates and stores each reading with a timestamp.
- The panel shows the latest value, the history as a chart and triggers the alerts.
The channel is your device’s “address”. Each channel has up to 8 fields (for example “Temperature” and “Humidity”), and each field has a name, a unit and a chart type: line, bars, gauge or big value.
What you will need
- 1 ESP32 board (or the simulated ESP32 in the Electronic Design editor, to test without hardware).
- 1 DHT22 sensor, with its data wire on an ESP32 pin (for example GPIO 4).
- A Wi-Fi network with internet access.
- Arduino IDE with ESP32 board support and the Adafruit DHT sensor library.
- A 4DVolt account.
Step 1: create the channel
On the IoT Dashboard, click New channel, give it a name (“Living room”, say) and create two fields: Temperature (unit °C, line chart) and Humidity (unit %, line chart or gauge). If you pick the gauge, set the scale minimum and maximum; they only set the size of the bar and never reject a reading.
When you save, the channel gets a number and a write key. The key works like the device’s password: anyone who has it can write readings to the channel, so do not post it on forums or in public repositories. If it leaks, generate a new one in the panel and the old one stops working immediately.
Step 2: the send format
Each reading is a POST to the channel address, with the key in the X-Chave-Iot header and a JSON body with fields f1 to f8, in the order they were created:
POST https://4dvolt.com.br/api/iot/canais/YOUR_CHANNEL/leituras
X-Chave-Iot: YOUR_KEY
Content-Type: application/json
{"f1": 23.5, "f2": 61}
The response tells you what happened: 201 stored; 401 wrong key; 422 the value is not a number (a sensor that returned nan, for example); 429 you sent faster than your plan’s minimum interval.
Step 3: the ESP32 sketch
You do not have to write the sending code from scratch. On the channel page, open Integration: the panel generates the sketch with the channel number, key and address already filled in, plus a certificados.h file that you save in the same folder. It lets the ESP32 validate the server certificate instead of accepting any, which stops someone from impersonating the server. The structure of the sketch, with the DHT22, is:
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <HTTPClient.h>
#include <DHT.h>
#include <time.h>
#include "certificados.h" // generated in the panel (Integration)
const char* WIFI_SSID = "YOUR_WIFI";
const char* WIFI_SENHA = "YOUR_PASSWORD";
const char* URL_API = "https://4dvolt.com.br/api/iot/canais/YOUR_CHANNEL/leituras";
const char* CHAVE = "YOUR_KEY";
DHT dht(4, DHT22); // data wire on GPIO 4
WiFiClientSecure client;
void setup() {
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_SENHA);
while (WiFi.status() != WL_CONNECTED) delay(500);
configTime(0, 0, "pool.ntp.org"); // the certificate is only valid with the right time
while (time(nullptr) < 1700000000) delay(500);
client.setCACert(RAIZES);
dht.begin();
}
void loop() {
float t = dht.readTemperature();
float h = dht.readHumidity();
if (!isnan(t) && !isnan(h)) {
HTTPClient http;
if (http.begin(client, URL_API)) {
http.addHeader("Content-Type", "application/json");
http.addHeader("X-Chave-Iot", CHAVE);
int code = http.POST("{\"f1\":" + String(t) + ",\"f2\":" + String(h) + "}");
Serial.println(code); // 201 = stored
http.end();
}
}
delay(15000); // respect your plan's interval
}
Replace the Wi-Fi details, channel number and key (or copy the ready-made sketch from the panel, which comes pre-filled). Upload it, open the Serial Monitor at 115200 and check that 201 shows up. The reading appears on the chart in real time, without reloading the page.
If the Serial Monitor shows 422, the channel is rejecting the value: check the DHT22 wiring and whether there is a 10 kΩ pull-up resistor between the data wire and 3.3 V (many modules already have one on the board).
No board yet: test with the simulated ESP32
In the 4DVolt Electronic Design editor, the simulated ESP32 runs your real sketch, Wi-Fi included. Build the circuit, open File › Examples, choose ESP32 › IoT Dashboard (or open the example straight in the editor) and replace the channel number and key. In the simulation the send goes over http:// (the connection stays inside 4DVolt), and your plan’s minimum interval still applies. You can also tick the project’s sensors and use File › Publish to dashboard: the channel is created with its fields ready and the sketch comes out with the real reading of each sensor.
Step 4: read the panel and get alerts
On the channel page, choose the period (last hour, day, week or month). You see the latest value, the minimum, the maximum and the average, and you can export the readings as CSV to analyze in a spreadsheet. A channel with no data for over 5 minutes shows as offline.
Under Notifications you create alerts by bell or e-mail:
- Greater than or less than a limit, on the current value or on the average, minimum, maximum or variation over a window from 5 minutes to 24 hours. Alerting on the average of the last 15 minutes avoids false alarms from a single spike.
- No data for N minutes, to know the ESP32 went down or lost Wi-Fi.
You get one notice when the condition becomes true, not on every reading, and the alert re-arms itself once the value returns to normal.
Precautions and limits
- Minimum interval: depends on the account’s plan. Sending faster returns
429and the reading is dropped. For room temperature, every 15 seconds or more is plenty. - Retention: how long history is kept also varies by plan.
- Correct time: without syncing the clock over NTP, certificate validation fails and nothing is sent.
- DHT22 pin and power: the ESP32 runs at 3.3 V; power the sensor at that voltage.
- Home and educational use: good for monitoring and learning. Do not use it as the only protection in anything involving the safety of people or of an electrical installation.
See also: Arduino: button turns on the LED, for your first steps with inputs, outputs and the simulator.
Create your free account.
This text is informational and educational. When connecting any circuit to mains power, follow the applicable standards and rely on a qualified professional. Never work on energized installations without proper safety measures.
Frequently asked questions
Do I need my own server to see ESP32 data on a chart?
No. The 4DVolt IoT Dashboard channel receives readings over HTTPS, stores the history and draws the charts; the ESP32 only has to send a POST with the channel key.
Can I test without an ESP32?
Yes. The simulated ESP32 in Electronic Design runs your real sketch, Wi-Fi included, and sends the readings to the same channel.
How often can the ESP32 send?
It depends on the account plan, which sets the minimum interval. Sending faster returns code 429 and the reading is dropped.
What does error 422 in the Serial Monitor mean?
The channel received the request, but the value is not a number, such as a sensor that returned nan. Check the sensor wiring and pull-up.
Read also
Arduino simulator: sequential LEDs step by step
Simulate an Arduino circuit without building anything: open the sequential LEDs example, compile the code, see the breadboard and run it in 2D and 3D.
Arduino: how to turn on an LED with a button
Learn to wire a button and an LED to the Arduino Uno, with a pull-down resistor, and to program it with pinMode, digitalRead and digitalWrite.