-
Getting Started
-
Device Management
-
Automations
-
Dashboard
-
User Management
-
LoraWAN
-
API and Integrations
-
Boards
-
DIY
-
Gateway
Connect your device
There are three ways to connect your device to the IoT Stadium platform: MQTT, or HTTP, or LoRaWAN.
To make your device connected to IoT Stadium,
1. Click View or Edit Device on your selected Device first.
2. Click on Access Token
3. Click on both Copy Device ID and Copy Access Token to copy the unique address for your framework.
*Note: This two are the tokens you need to copy on your firmware, to get connect to IoT Stadium. and each device has its own unique Device ID and Access Token
4. Upload and compile your firmware with these tokens, then your device will automatically connect to the IoT Stadium. Connecting to IoT Stadium usually takes 5 minutes or less.
A quick note: If your device is already connected to IoT Stadium and you click Refresh Token, your device will remain connected to the platform. The new ID and Access Token will be updated, and if you want to update your Device ID and Access Token, you must copy both to your device’s firmware.
mqtt
#include <WiFi.h>// Depends on board's library
#include <PubSubClient.h>
const char* ssid = "your-wifi-ssid";
const char* password = "your-wifi-password";
const char* mqtt_server = "telemetry.iotstadium.com"; //MQTT Server IoT Stadium
const char* deviceId = "your-device-id";
const char* accessToken = "your-token-code";
WiFiClient espClient;
PubSubClient client(espClient);
void setup() {
Serial.begin(9600);//Baudrate
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("Wifi Connected");
client.setServer(mqtt_server, 1883); // set server at port 1883
if (client.connect(deviceId, deviceId, accessToken)) { //Connect with IoTStadium Server
client.subscribe(deviceId);
Serial.println("Connect with IoTStadium");
}
else {
Serial.println("Check your Device ID and Access Token");
}
}
void loop() {
client.loop();
delay(1000);
}