How to connect your IoT device to Wia's MQTT API

iainandrew

In this tutorial, we'll go through how to send data from your IoT device Wia via our MQTT API. We'll use the Arduino MKR1000 in this example, but the process will be very similar for other IoT development boards that are programmable with the Arduino IDE.

Next, you'll need to replace the values of the following variables in the code (at the top):

ssid - with your WiFi network name

password - with your WiFi network password

deviceId with your Device id from the Wia Dashboard (the one that begins with dev_). You'll find this under the Configuration tab of your Device

deviceSecretKey with your Device secret key from the Wia Dashboard (the one that begins with d_sk). You'll find this under the Configuration tab of your Device

Go to Sketch > Upload to upload it to your board.

Once it has finished uploading, you can go to Tools > Serial Monitor. Make sure the baud rate (bottom right) is set to 115200.
You should see a series of messages in the Serial Monitor, telling you that the board has connected to the WiFi network, and to the MQTT API.

Back in your Wia dashboard, go to the Debugger tab for your Device, and you should see a temperature Event coming through every 5 seconds.

The next step

Why not connect a sensor to your board, and publish some real data to Wia? Once your data is coming into the Wia platform, you can set up triggers, speak with other services, configure logic and call actions, all using Wia's real-time IoT rules engine.