Skip to content

Quick Start Guide

This guide walks you through creating a device and sending real data to SiliconWit.io. By the end, you will see live readings on your dashboard.

  1. Go to siliconwit.io/register
  2. Sign up with email, or use Google or GitHub
  3. Check your inbox and click the verification link
  4. Log in to your dashboard

We will create a test device that simulates temperature and humidity readings.

  1. Go to siliconwit.io/login?next=/dashboard/devices (or open your dashboard and click Devices in the sidebar)
  2. Click the ”+ Add Device” button

Fill in the following:

FieldValue
Device NameTemp Humidity Simulator
Device TypeSelect Sensor (collects and sends data)
DescriptionTest device that simulates temperature and humidity readings

Set these options:

SettingValue
Data DirectionSend Only
ConnectivityWiFi + MQTT
Data Interval10 seconds (click the 10s preset button, or type 10 and select Seconds)
Schema ModeStrict (only defined fields)
Enable camera snapshotsLeave unchecked

Now define the two fields this device will send:

  1. Click Clear to remove any default fields
  2. Click Import to open the “Import Data Fields from JSON” dialog
  3. Copy and paste this JSON into the import box:
[
{ "name": "temperature", "label": "Temperature", "unit": "°C" },
{ "name": "humidity", "label": "Humidity", "unit": "%" }
]
  1. Click Validate - you should see “2 valid fields found”
  2. Click Import Fields
  1. Click Create Device

You will be taken to your new device’s page.

  1. On the device page, click the Settings tab
  2. Find your Device ID and copy it (format SWD-XXXXXX, always visible on device page)
  3. Find your Access Token below it, click the eye icon to reveal it, and copy it
CredentialExampleWhere to find it
Device IDSWD-XXXXXXSettings tab, always visible
Access Tokena1b2c3d4e5f6g7h8...Settings tab, click the eye icon to reveal

Choose Python (easiest to test on any computer) or ESP32 (for real hardware).

Section titled “Option A: Python (recommended for first test)”

Python works on any computer and is the fastest way to verify your setup.

First, create a folder for this project and install the required Python library:

  1. Download Python from python.org/downloads and install it. Check “Add Python to PATH” during installation.
  2. Open Command Prompt (press Win+R, type cmd, press Enter)
  3. Create a project folder and install the library:
Terminal window
mkdir %USERPROFILE%\Documents\siliconwit-test
cd %USERPROFILE%\Documents\siliconwit-test
pip install requests

Create a file called send_data.py in your siliconwit-test folder and paste this code. Replace the two placeholder values with your actual Device ID and Access Token from Step 2:

import requests
import json
import time
import random
# ============ YOUR CREDENTIALS ============
DEVICE_ID = "SWD-XXXXXX" # Replace with your Device ID
ACCESS_TOKEN = "your-access-token" # Replace with your Access Token
# ==========================================
URL = "https://siliconwit.io/api/devices/ingest"
print("Sending data to SiliconWit.io...")
print("Press Ctrl+C to stop.\n")
while True:
payload = {
"device_id": DEVICE_ID,
"access_token": ACCESS_TOKEN,
"data": {
"temperature": round(random.uniform(20.0, 35.0), 1),
"humidity": round(random.uniform(30.0, 80.0), 1)
}
}
try:
response = requests.post(URL, json=payload, timeout=10)
result = response.json()
if result.get("success"):
print(f"Sent: temp={payload['data']['temperature']}, humidity={payload['data']['humidity']}")
else:
print(f"Error: {result.get('error', 'Unknown error')}")
except Exception as e:
print(f"Request failed: {e}")
time.sleep(10) # Send every 10 seconds (matches device interval)

Run it:

Terminal window
python send_data.py

In your terminal, you should see successful sends:

Sending data to SiliconWit.io...
Press Ctrl+C to stop.
Sent: temp=24.3, humidity=55.7
Sent: temp=28.1, humidity=42.9
Sent: temp=22.6, humidity=67.3

Now go to your devices page and click on your device (the same one where you copied the Device ID and Access Token from the Settings tab). Click the Data tab. You will see your data streaming in across several cards: Latest Reading showing current values, Insights with min/max/average stats, Historical Data with interactive charts, and a Telemetry Data table with all received data points.

Send data via MQTT (persistent connection)

Section titled “Send data via MQTT (persistent connection)”

MQTT is the recommended protocol for devices that stream data continuously. It keeps a persistent connection open, so data arrives faster and uses less bandwidth than HTTP.

Install the MQTT library (run this in your siliconwit-test folder):

Terminal window
pip install paho-mqtt

Create a file called mqtt_client.py in your siliconwit-test folder. Replace the two placeholder values with your credentials from Step 2:

import ssl
import json
import time
import random
import paho.mqtt.client as mqtt
# ============ YOUR CREDENTIALS ============
DEVICE_ID = "SWD-XXXXXX" # Replace with your Device ID
ACCESS_TOKEN = "your-access-token" # Replace with your Access Token
# ==========================================
BROKER = "mqtt.siliconwit.io"
PORT = 8883
TOPIC = f"d/{DEVICE_ID}/t"
def on_connect(client, userdata, flags, reason_code, properties):
if reason_code == 0:
print("Connected to SiliconWit.io MQTT broker")
else:
print(f"Connection failed: {reason_code}")
def on_publish(client, userdata, mid, reason_code, properties):
print(f" Message {mid} delivered")
# Create client
client = mqtt.Client(
callback_api_version=mqtt.CallbackAPIVersion.VERSION2,
client_id=DEVICE_ID,
protocol=mqtt.MQTTv311,
)
client.username_pw_set(DEVICE_ID, ACCESS_TOKEN)
client.tls_set(tls_version=ssl.PROTOCOL_TLS_CLIENT)
client.on_connect = on_connect
client.on_publish = on_publish
# Connect
print(f"Connecting to {BROKER}:{PORT}...")
client.connect(BROKER, PORT, keepalive=60)
client.loop_start()
print("Sending data to SiliconWit.io...")
print("Press Ctrl+C to stop.\n")
try:
while True:
if client.is_connected():
data = {
"temperature": round(random.uniform(20.0, 35.0), 1),
"humidity": round(random.uniform(30.0, 80.0), 1),
}
client.publish(TOPIC, json.dumps(data), qos=1)
print(f"Sent: {json.dumps(data)}")
else:
print("Waiting for connection...")
time.sleep(10) # Send every 10 seconds (matches device interval)
except KeyboardInterrupt:
print("\nStopping...")
client.loop_stop()
client.disconnect()

Run it:

Terminal window
python mqtt_client.py

In your terminal, you should see a successful connection and message deliveries:

Connecting to mqtt.siliconwit.io:8883...
Connected to SiliconWit.io MQTT broker
Sending data to SiliconWit.io...
Press Ctrl+C to stop.
Sent: {"temperature": 24.3, "humidity": 55.7}
Message 1 delivered
Sent: {"temperature": 28.1, "humidity": 42.9}
Message 2 delivered

Now go to your devices page, click on your device, then click the Data tab. Just like with the HTTP method, you will see data streaming in across the Latest Reading, Insights, Historical Data, and Telemetry Data cards.

For real hardware projects, the ESP32 is the most popular choice. This example uses MQTT over TLS.

  1. Download Arduino IDE and install it
  2. Add ESP32 board support:
    • Go to File > Preferences
    • In “Additional Board Manager URLs”, add:
      https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
    • Go to Tools > Board > Boards Manager, search esp32, and install esp32 by Espressif Systems
  3. Install the MQTT library:
    • Go to Sketch > Include Library > Manage Libraries
    • Search PubSubClient and install PubSubClient by Nick O’Leary
  4. Select your board: Tools > Board > ESP32 Dev Module (or your specific board)

Create a new sketch and paste this code. Replace the four placeholder values:

#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <PubSubClient.h>
// ============ YOUR SETTINGS ============
const char* WIFI_SSID = "YOUR_WIFI_NAME"; // Your WiFi network name
const char* WIFI_PASSWORD = "YOUR_WIFI_PASSWORD"; // Your WiFi password
const char* DEVICE_ID = "SWD-XXXXXX"; // From SiliconWit.io dashboard
const char* ACCESS_TOKEN = "your-access-token"; // From SiliconWit.io dashboard
// =======================================
const char* MQTT_BROKER = "mqtt.siliconwit.io";
const int MQTT_PORT = 8883;
WiFiClientSecure espClient;
PubSubClient mqtt(espClient);
unsigned long lastSend = 0;
const unsigned long SEND_INTERVAL = 10000; // 10 seconds (matches device interval)
void connectWifi() {
Serial.print("Connecting to WiFi");
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(" connected!");
Serial.print("IP: ");
Serial.println(WiFi.localIP());
}
void connectMqtt() {
while (!mqtt.connected()) {
Serial.print("Connecting to MQTT...");
if (mqtt.connect(DEVICE_ID, DEVICE_ID, ACCESS_TOKEN)) {
Serial.println(" connected!");
} else {
Serial.print(" failed (");
Serial.print(mqtt.state());
Serial.println("). Retrying in 5s...");
delay(5000);
}
}
}
void setup() {
Serial.begin(115200);
Serial.println("\n=== SiliconWit.io ESP32 Quick Start ===\n");
connectWifi();
espClient.setInsecure(); // Skip certificate verification (OK for testing)
mqtt.setServer(MQTT_BROKER, MQTT_PORT);
}
void loop() {
if (!mqtt.connected()) {
connectMqtt();
}
mqtt.loop();
if (millis() - lastSend >= SEND_INTERVAL) {
lastSend = millis();
// Simulated sensor readings - replace with your actual sensor code
float temperature = 20.0 + (float)(random(0, 150)) / 10.0;
float humidity = 30.0 + (float)(random(0, 500)) / 10.0;
// Build JSON payload
String payload = "{\"temperature\":" + String(temperature, 1)
+ ",\"humidity\":" + String(humidity, 1) + "}";
// Build topic: d/{device_id}/t
String topic = "d/" + String(DEVICE_ID) + "/t";
// Publish
if (mqtt.publish(topic.c_str(), payload.c_str())) {
Serial.println("Sent: " + payload);
} else {
Serial.println("Publish failed!");
}
}
}

Click Upload. Open Tools > Serial Monitor (baud rate: 115200) to see the ESP32 output:

=== SiliconWit.io ESP32 Quick Start ===
Connecting to WiFi... connected!
IP: 192.168.1.42
Connecting to MQTT... connected!
Sent: {"temperature":24.3,"humidity":55.7}
Sent: {"temperature":28.1,"humidity":42.9}

Now go to your devices page, click on your device, then click the Data tab. You will see data streaming in across the Latest Reading, Insights, Historical Data, and Telemetry Data cards.

  1. Go to your devices page and click on your device (it has a Data tab and a Settings tab)
  2. On the Data tab, you will see your temperature and humidity readings streaming in across several cards:
    • Latest Reading - current values for each field
    • Insights - min, max, and average statistics
    • Historical Data - interactive charts that plot readings over time
    • Telemetry Data - a table with all received data points and timestamps

Your device sends a JSON object with key-value pairs. Your payload must match your device’s configured field schema. See the Field Schema guide for details.

Simple readings:

{
"temperature": 25.5,
"humidity": 60
}

GPS tracker:

{
"lat": -1.2921,
"lon": 36.8219,
"speed": 45.2,
"battery": 87
}

Mixed types (numbers, booleans, text):

{
"temperature": 25.5,
"door_open": true,
"status": "normal"
}

Nested data (max 2 levels deep):

{
"indoor": { "temp": 22, "humidity": 45 },
"outdoor": { "temp": 18, "humidity": 70 }
}
LimitValue
Maximum payload size10 KB
Maximum fields50 per message
Maximum nesting depth2 levels
Minimum send interval1 second
SettingValue
MQTT Brokermqtt.siliconwit.io
MQTT Port8883 (TLS required)
MQTT UsernameYour Device ID
MQTT PasswordYour Access Token
MQTT Client IDYour Device ID
MQTT Topicd/{device_id}/t
HTTP EndpointPOST https://siliconwit.io/api/devices/ingest
WebSocketwss://mqtt.siliconwit.io:8084/mqtt
ErrorCauseFix
{"error": "Invalid device_id or access_token"}Wrong credentialsDouble-check Device ID and Access Token from your dashboard
{"error": "Device is not active"}Device is pausedGo to dashboard and resume the device
Connection refusedNo internet or firewallCheck your internet connection
ModuleNotFoundError: requestsLibrary not installedRun pip install requests
ErrorCauseFix
Connection failed: 5Wrong credentialsVerify Device ID and Access Token
SSL: CERTIFICATE_VERIFY_FAILEDMissing CA certificatesRun pip install certifi and update your OS
Connection timed outPort 8883 blockedCheck firewall allows outbound port 8883
ModuleNotFoundError: pahoLibrary not installedRun pip install paho-mqtt
AttributeError: CallbackAPIVersionOld paho-mqtt versionRun pip install --upgrade paho-mqtt (need v2.0+)
ErrorCauseFix
WiFi won’t connectWrong SSID/passwordCheck credentials, ensure 2.4 GHz network (not 5 GHz)
MQTT state -2Network unreachableCheck WiFi is connected first
MQTT state 5Auth failedVerify Device ID and Access Token
Data not appearingWrong topicTopic must be exactly d/{your_device_id}/t