Postlad/Guides/Wokwi ESP32 cloud dashboard: send simulated data to a live chart
Wokwi ESP32 cloud dashboard: send simulated data to a live chart
Wokwi can run an ESP32 in your browser and give it outbound internet access. Paste the sketch below into a new ESP32 project, add a temporary Postlad write key, press Run and watch a real cloud chart fill without buying a board.
This is a real network request from the simulator. The chart is not a screenshot and the numbers are not generated by the website.
Reviewed, but not yet run through the complete simulator-to-production path. Use a disposable stream and rotate its key after the exercise.
Before you paste a key into Wokwi
A Wokwi project may be public. Anybody who can read a project containing your write key can write to that stream.
Use a new disposable stream for the exercise. If you publish or share the Wokwi project, replace the key with YOUR_KEY first and rotate the real key from Postlad afterwards.
Create the simulator project
- Open Wokwi and create a new ESP32 project.
- Keep the default ESP32 DevKit board.
- Replace
sketch.inowith the code below. - Replace
YOUR_KEYwith the write key from a disposable Postlad stream. - Press Run and open the serial monitor.
No simulated sensor is needed for the first test. The code produces a slow wave between roughly 19 °C and 25 °C so the chart shape is obvious.
Complete sketch.ino
#include <WiFi.h>
#include <HTTPClient.h>
#include <math.h>
const char* WIFI_SSID = "Wokwi-GUEST";
const char* WIFI_PASSWORD = "";
const char* WRITE_KEY = "YOUR_KEY";
const char* POSTLAD_URL = "http://api.postlad.com/u";
const unsigned long SEND_INTERVAL_MS = 10000;
unsigned long readingNumber = 0;
void connectWiFi() {
Serial.print("Connecting to Wokwi WiFi");
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD, 6);
while (WiFi.status() != WL_CONNECTED) {
delay(250);
Serial.print('.');
}
Serial.print("\nConnected. IP: ");
Serial.println(WiFi.localIP());
}
void setup() {
Serial.begin(115200);
delay(500);
connectWiFi();
}
void loop() {
if (WiFi.status() != WL_CONNECTED) {
connectWiFi();
}
float temperature = 22.0 + 3.0 * sin(readingNumber / 6.0);
float humidity = 55.0 - 8.0 * sin(readingNumber / 8.0);
WiFiClient client;
HTTPClient http;
String url = String(POSTLAD_URL)
+ "?k=" + WRITE_KEY
+ "&f1=" + String(temperature, 2)
+ "&f2=" + String(humidity, 1)
+ "&status=wokwi";
if (!http.begin(client, url)) {
Serial.println("Could not start HTTP request");
delay(SEND_INTERVAL_MS);
return;
}
int status = http.GET();
String body = http.getString();
Serial.printf(
"#%lu %.2f C %.1f %%RH -> HTTP %d %s\n",
readingNumber,
temperature,
humidity,
status,
body.c_str()
);
http.end();
readingNumber++;
delay(SEND_INTERVAL_MS);
}Expected serial output:
Connecting to Wokwi WiFi....
Connected. IP: 10.10.0.2
#0 22.00 C 55.0 %RH -> HTTP 200 ok 1
#1 22.50 C 54.0 %RH -> HTTP 200 ok 2Open the stream page in another tab. Name f1 Temperature with unit °C, and f2 Humidity with unit %RH.
Minimal diagram.json
If you start from a blank Wokwi project rather than its ESP32 template, use this board-only diagram:
{
"version": 1,
"author": "Postlad guide reader",
"editor": "wokwi",
"parts": [
{
"type": "board-esp32-devkit-c-v4",
"id": "esp",
"top": 0,
"left": 0,
"attrs": {}
}
],
"connections": [],
"dependencies": {}
}What the sketch proves
The simulator test removes four uncertainties at once:
- The Postlad account and stream exist.
- The write key is accepted.
- The request spelling is correct.
- The chart receives and displays new values.
When you later move the sketch to a physical ESP32, the remaining variables are the real WiFi network, wiring and sensor library.
Add a simulated DHT22
Once the fake wave works, add a DHT22 part and connect:
| DHT22 | ESP32 |
|---|---|
| VCC | 3V3 |
| SDA | GPIO 15 |
| GND | GND |
Install the Adafruit DHT sensor library through Wokwi's Library Manager, then replace the two generated values with dht.readTemperature() and dht.readHumidity(). Keep the isnan() guard from the existing ESP32 cloud guide so a failed sensor read never becomes a fake zero.
The generated-wave version remains the better first test. It separates network debugging from sensor debugging.
Why not give everybody one shared demo key?
A public write key is an invitation to write arbitrary status text and noise into a shared stream. It also makes rate limits depend on how many strangers press Run at once.
Creating an account takes an email link and gives each person an isolated stream. That is a little more work, but it makes the result dependable and leaves the reader with a stream they can keep using.
Troubleshooting
Wokwi connects but the request fails
Confirm that the host is api.postlad.com, the path is /u, and the URL begins with http://. Wokwi supports both HTTP and HTTPS, but this guide intentionally exercises Postlad's smallest device path.
The response says unknown_param
Use f1, f2 and so on. field1 is a ThingSpeak spelling and Postlad rejects it with a correction rather than accepting a request that stores no value.
The response says rate_limited
The example sends every 10 seconds, comfortably below the Free plan's one-reading-per-5-seconds rate. If you shortened the delay, lengthen it or follow the returned Retry-After value.
The serial monitor shows 200 but the chart is empty
Check that you are viewing the same stream whose key is in the sketch and that the selected chart range includes the current time. The ok N counter should increase without gaps for accepted writes.
Can I keep using the simulated stream?
Yes. It is an ordinary stream. Stop the simulator when you no longer want synthetic points mixed with real measurements, or create a fresh stream before moving to hardware.
Search-friendly project variants
The same working sender can become a focused project without changing the network code:
- ESP32 DHT22 room monitor
- ESP32 greenhouse temperature dashboard
- ESP32 water-tank level chart
- ESP32 soil-moisture logger
- ESP32 energy-monitoring dashboard
Each deserves its own guide only when it adds real sensor wiring, calibration and failure handling. Repeating this sketch under six titles without those details would create six thin pages instead of one useful one.
FAQ
Does Wokwi ESP32 have internet access?
Yes. Wokwi's simulated ESP32 WiFi network provides outbound HTTP, HTTPS, MQTT and related network access. Use the Wokwi-GUEST SSID with no password.
Can Wokwi send data to a real cloud dashboard?
Yes. The request leaves the simulator and reaches the real endpoint. Keep credentials out of public projects exactly as you would with a physical board repository.
Do I need a sensor to test an IoT dashboard?
No. Start with a generated value. It proves the account, request and chart before sensor libraries or wiring enter the problem.
Why use HTTP instead of MQTT in Wokwi?
HTTP makes the entire write visible in one URL and matches very small devices. MQTT is useful when a project needs subscriptions, retained messages or several topics; none is required for one changing number.
Is the Postlad chart public?
Streams start private. You can make one public or create a secret link when you want to share the result. The viewer never receives the write key.
Create the disposable stream
Create a free account, make a stream for the simulator and copy its write key into the sketch. Rotate the key before publishing the Wokwi project.
Related guides
- Send ESP32 data to the cloud: move from generated values to a physical board and DHT22.
- Arduino data logger online: the same HTTP pattern on an UNO R4 WiFi.
- ESP8266 DHT22 cloud dashboard: plain HTTP on a smaller, older WiFi board.
- ESP32 water-tank level monitor: a complete project built on this sender.
- Free IoT dashboard for students: how to share a semester project without handing over an account.
Sources and verification
- Wokwi ESP32 WiFi documentation: https://docs.wokwi.com/guides/esp32-wifi
- Postlad endpoint behaviour and limits checked against the repository build on 8 August 2026.