Skip to main content

Your First VWire Project

Build a complete temperature and humidity monitor with a live dashboard in under 10 minutes.


What you'll build

ESP32 + DHT22 ──MQTT/TLS──▶ VWire ──▶ Dashboard
├── Value Display: Temperature (V0)
├── Value Display: Humidity (V1)
├── Gauge: Humidity % (V1)
└── Graph: 24h temperature trend (V0)

Hardware needed

  • ESP32 development board (any variant)
  • DHT22 temperature/humidity sensor
  • 10 kΩ pull-up resistor
  • Breadboard + jumper wires

Wiring:

DHT22 pinESP32 pin
VCC3.3 V
DATAGPIO 4 (with 10 kΩ pull-up to 3.3 V)
GNDGND

Step 1: Create a device

  1. Log in to the VWire Dashboard
  2. Go to Devices → Add Device, name it ESP32 DHT22, and click Create
  3. Open the device and copy both:
    • Auth Token — secret key embedded in firmware
    • Device ID — the device's identifier (e.g. VU-XXXXXX)

Step 2: Flash the firmware

Install the required libraries before creating the sketch:

  • Download the VWire Arduino ZIP archive from the official VWire GitHub repository and install it via Sketch → Include Library → Add .ZIP Library
  • Install DHT sensor library by Adafruit
  • Install PubSubClient and ArduinoJson as VWire dependencies

Create a new sketch:

#include <Vwire.h>
#include <DHT.h>

// WiFi credentials
const char* WIFI_SSID = "YOUR_WIFI_SSID";
const char* WIFI_PASSWORD = "YOUR_WIFI_PASSWORD";

// From device settings in the dashboard
const char* AUTH_TOKEN = "YOUR_AUTH_TOKEN";
const char* DEVICE_ID = "YOUR_DEVICE_ID"; // e.g. VU-ABC123

// DHT sensor
#define DHT_PIN 4
#define DHT_TYPE DHT22
DHT dht(DHT_PIN, DHT_TYPE);

// Called when connected to VWire cloud
VWIRE_CONNECTED() {
Serial.println("Connected to VWire!");
Vwire.sync(V0, V1); // Request last stored values from cloud
}

void setup() {
Serial.begin(115200);
dht.begin();

// Configure Vwire (uses mqtt.vwire.io:8883 TLS by default)
Vwire.config(AUTH_TOKEN);
Vwire.setDeviceId(DEVICE_ID);

// Connect to WiFi and VWire cloud
Vwire.begin(WIFI_SSID, WIFI_PASSWORD);
}

void loop() {
Vwire.run(); // Must be called every iteration

static unsigned long lastRead = 0;
if (Vwire.connected() && millis() - lastRead >= 5000) {
lastRead = millis();

float temp = dht.readTemperature();
float hum = dht.readHumidity();

if (!isnan(temp) && !isnan(hum)) {
Vwire.virtualSend(V0, temp); // V0 = Temperature
Vwire.virtualSend(V1, hum); // V1 = Humidity

Serial.printf("Temp: %.1f°C Hum: %.1f%%\n", temp, hum);
}
}
}

Flash to your ESP32. Open Serial Monitor at 115200 baud and wait for:

Connected to VWire!
Temp: 23.5°C Hum: 58.2%

Step 3: Create a project

  1. In the dashboard, go to Projects → New Project, name it Home Monitor, and click Create
  2. Click Edit Dashboard to enter edit mode

Step 4: Build the dashboard

Temperature display (V0)

  1. + Add WidgetValue Display
  2. Device: ESP32 DHT22, Pin: V0
  3. Suffix: °C, Label: Temperature
  4. Click Save — live temperature appears immediately

Humidity display (V1)

  1. + Add WidgetValue Display
  2. Device: ESP32 DHT22, Pin: V1
  3. Suffix: %, Label: Humidity

Humidity gauge

  1. + Add WidgetGauge
  2. Device: ESP32 DHT22, Pin: V1
  3. Min: 0, Max: 100, Label: Humidity

Temperature history chart

  1. + Add WidgetGraph
  2. Device: ESP32 DHT22, Pin: V0
  3. Duration: 24h, Label: Temperature trend

Step 5: Set up an alert

Get notified when temperature exceeds a threshold:

  1. Go to Alerts in the project
  2. Click + Add Alert
  3. Set: Device ESP32 DHT22, Pin V0, Condition greater than, Value 30
  4. Choose delivery: Push notification, Email, or both

The alert triggers automatically when the device pushes a reading above 30 °C.


Result

Your dashboard now shows live temperature and humidity readings, a humidity gauge, and a 24-hour chart. Data retention and history availability follow your current plan limits.


Next steps