Skip to main content

Quick Start

Get your first device online and displaying live data in under 5 minutes.


Prerequisites

Installing the library

  1. In Arduino IDE: Sketch → Include Library → Manage Libraries
  2. Search Vwire
  3. Click Install (also install the required dependencies: PubSubClient and ArduinoJson)

Step 1 — Create a device

  1. Log in to the VwireIOT Dashboard
  2. Go to Devices → Add Device, enter a name, and click Create
  3. Open the device settings and copy two values:
    • Auth Token — secret key used to authenticate the connection
    • Device ID — the device's identifier (e.g. VU-XXXXXX)

Step 2 — Flash your device

Use this minimal sketch. Replace the placeholders with your actual WiFi credentials, auth token, and device ID:

#include <Vwire.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

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

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

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

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

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

// Send a simulated temperature reading to pin V0
float temperature = 23.5; // replace with actual sensor reading
Vwire.virtualSend(V0, temperature);
}
}

Upload the sketch. Open the Serial Monitor at 115200 baud and wait for the connected message. Your device will appear Online in the dashboard.


Step 3 — Create a project and add a widget

  1. In the dashboard, go to Projects → New Project, enter a name, and click Create
  2. Click + Add Widget and choose Value Display
  3. Set:
    • Device → your newly created device
    • PinV0
    • Suffix°C
    • LabelTemperature
  4. Click Save — the widget immediately shows the live value from your device

Step 4 — Add a historical chart

  1. Click + Add Widget and choose Graph
  2. Set the same device and pin V0
  3. Set Duration to 1h and click Save

You now have a live temperature readout and a scrolling historical chart.


Receiving commands from the dashboard

To react to values written from a dashboard widget (e.g. a Button or Switch on V1):

// Declare this outside setup() and loop()
VWIRE_RECEIVE(V1) {
int value = param.asInt(); // 0 or 1
digitalWrite(LED_BUILTIN, value);
Serial.printf("V1 received: %d\n", value);
}

The VWIRE_RECEIVE macro auto-registers the handler — no additional setup required.


Next steps