Let your devices Dweet
Learn how to simulate devices that send out periodic dweets.
dweet.io is an IoT platform where connected devices can send messages: according to its creators, “it’s like Twitter for social machines”.
IoTIFY network simulator can easily simulate devices (or “things”) that send “dweets”; this article will guide you through the simple steps involved in setting up the simulator and will show how information extracted from these generated dweets can be visualized in a graphic dashboard. We will be simulating a car that sends periodically dweets containing information such as its current location, speed and fuel level.
Before starting, sign up for a The network simulator template we are going to create will contain information such as the name of the simulated thing and the contents of the dweets sent by the thing.
In the template editing screen, give your template a unique name and select HTTP as Network connection type (the messaging protocol used by dweet.io uses HTTP as application level protocol).
In the HTTP parameters section, select http (TCP) as protocol and insert “dweet.io” in the host field. The path of HTTP requests for sending out dweets has the format /dweet/for/<thing-name>, where <thing-name> is an arbitrary name chosen to identify your thing. There is no need to sign up to get a name for your thing, just choose a name of your liking, but keep in mind that some other thing somewhere else may be using the same name! So it is best to choose a name unlikely to be chosen by someone else. In the HTTP method field, select POST.
The following figure shows an example configuration for our dweeting car:
freeboard is a website that allows creating graphic dashboards with simple drag and drop actions; a dashboard is populated from one or more data sources specified when the dashboard is created, and dweet.io is among the supported data sources.
To begin using freeboard, sign up for a free account at freeboard.io. Then, go to https://freeboard.io/account to create a new dashboard: after choosing a name for your dashboard, click Create New and you will be taken to the editing screen:
Click Add in the datasources section, then select Dweet.io as type, give a name to the data source, and insert the name you previously chose as your thing name:
Save the data source, then start building your dashboard by adding panes and widgets; for each widget, you can access data from your data source by specifying the name of attributes in the JSON object sent in each dweet, using the notation datasources[“<data_source>”][“<attribute>”], where <data_source> is the name of your data source, and <attribute> is the name of the attribute holding the data of interest. For example, the following figure shows the configuration for a widget that takes latitude and longitude values from relevant attributes of the data source (which must correspond to the names used in the network simulator template), and draws the path of the route on Google maps:
Once you are happy with the contents and layout of your dashboard, you can use the network simulator template you defined in step 1 to start a simulation: give a unique name to the simulation, select 1 as number of clients, then choose a message count and a message repetition interval according to how long you want your simulation to last:
As soon as the simulated device start sending messages, you will see the dashboard update in real time its contents:
You can choose to keep you dashboard public, in which case it will be accessible to anyone who has its link, or make it private: just go to https://freeboard.io/account and click Edit next to the dashboard name to edits its properties.