Integration: ThingSpeak

Get started with real time sensor analytics with and IoTify.


Visualizing the sensor data is a primary requirement for any good IoT solution. In this article, we will show you how to create a virtual sensor with Network simulator tool emitting MQTT and visualizing the generated sensor data with ThingSpeak. is a cloud platform which helps easy visualization and analysis of your IoT data with MATLAB. So let’s get started.

1. Create a channel on ThingSpeak

Create a free account with If you don’t have an account with, you could sign up for free as well.

Next, you will need to create a ThingSpeak channel to collect data from the IoT endpoints. Select Channels -> My Channels in the upper menu of your ThingSpeak account’s home page, then click New Channel.
In the new channel page, insert “iotify” as channel name, then enable the first two fields in the channel, naming them temperature and humidity, respectively:

Save channel settings by going to the bottom of the page and clicking Save Channel. You will be taken to the channel settings page, where you can see the automatically generated channel ID, which will be needed when writing to the channel. In addition, the Write API Key will be needed as well: you can copy its value by going to the API Keys tab.

2. Set up an IoTIFY network simulator template

Now go to IoTIFY and create a new Network template named thingspeak.
Specify MQTT as network connection type.
In the MQTT parameters section, set the Endpoint URL to

the topic of MQTT publish messages should be in the following format:

channels/[channel ID]/publish/[write key]

where [channel ID] and [write key] can be retrieved from the ThingSpeak channel settings page.

In the message contents field, insert the following code:

field1={{chance.integer({min:10, max:120})}}&field2={{chance.integer({min:5, max:80})}}&status=MQTTPUBLISH

Here we are publishing random values within the range for field1 (temperature) and field2 (humidity).

Save this Template.

3. Start simulating

Go to Simulate section in IoTIFY network tool and choose the thingspeak template previously created. Provide following values in generation tab:

Number of Clients: 1
Adjust the repeat times and interval to your requirement.

Now click on start simulation and that’s it!

The data on the Thingspeak channel will be shortly visible:

You could further analyze this data using MATLAB scripts as well. 

We are looking forward to what you’ll come up with. Discuss this.