Connect an ESP8266 or ESP32, send a sensor value to Virtuino Cloud, and watch it update live — then build a dashboard and add an automation rule. Just copy, paste and flash.
Register for a free account and log in to the console.
In the console go to API Settings and copy your HTTP API key — you'll paste it into the code.
Add a device (e.g. ESP32) and its fields (e.g. temperature) from the console.
The device_name and field names in your code must match the ones you create here.
Open the Arduino IDE, paste the sketch for your board, fill in your WiFi and
API key, then upload. It sends a demo temperature value every 10 seconds.
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecureBearSSL.h>
const char* WIFI_SSID = "YOUR_WIFI_NAME";
const char* WIFI_PASS = "YOUR_WIFI_PASSWORD";
const char* API_KEY = "YOUR_API_KEY"; // Console -> API Settings
const char* URL = "https://cloud.virtuino.com/api/data/write";
void setup() {
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println("\nWiFi connected");
}
void loop() {
if (WiFi.status() == WL_CONNECTED) {
std::unique_ptr<BearSSL::WiFiClientSecure> client(new BearSSL::WiFiClientSecure);
client->setInsecure(); // skip TLS cert check (simple)
HTTPClient https;
https.begin(*client, URL);
https.addHeader("Content-Type", "application/json");
float temperature = 20.0 + random(0, 100) / 10.0; // demo value
String body = String("{\"api_key\":\"") + API_KEY +
"\",\"device_name\":\"ESP8266\",\"data\":[{\"field\":\"temperature\",\"value\":" +
temperature + "}]}";
int code = https.POST(body);
Serial.printf("POST -> HTTP %d\n", code);
https.end();
}
delay(10000); // send every 10 seconds
}#include <WiFi.h>
#include <HTTPClient.h>
#include <WiFiClientSecure.h>
const char* WIFI_SSID = "YOUR_WIFI_NAME";
const char* WIFI_PASS = "YOUR_WIFI_PASSWORD";
const char* API_KEY = "YOUR_API_KEY"; // Console -> API Settings
const char* URL = "https://cloud.virtuino.com/api/data/write";
void setup() {
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println("\nWiFi connected");
}
void loop() {
if (WiFi.status() == WL_CONNECTED) {
WiFiClientSecure client;
client.setInsecure(); // skip TLS cert check (simple)
HTTPClient https;
https.begin(client, URL);
https.addHeader("Content-Type", "application/json");
float temperature = 20.0 + (millis() % 100) / 10.0; // demo value
String body = String("{\"api_key\":\"") + API_KEY +
"\",\"device_name\":\"ESP32\",\"data\":[{\"field\":\"temperature\",\"value\":" +
temperature + "}]}";
int code = https.POST(body);
Serial.printf("POST -> HTTP %d\n", code);
https.end();
}
delay(10000); // send every 10 seconds
}Open the Serial Monitor (115200 baud) — you should see HTTP 200. Then open the
Data Monitor in the console to see your values arriving live.
Create a dashboard, add a widget (gauge, chart, value display…) and bind it to your
temperature field. Your live data appears instantly.
Make it smart: add a rule such as "if temperature > 30 °C, send me an email" — or trigger another device, run a schedule, or execute a script.