After we gave you a small taste of how to interface Flyport, the wifi programmable module, with the cloud services, now we are ready to give you all the information you need to do it by yourselves.
Interfacing Flyport to Cloud Services (ThingSpeak)
This DIY gives access to the ThingSpeak Services. ThingSpeak allows to draw online charts, to store and recall values and to use specific APIs to work with Twitter, or to send HTTP requests directly from the ThingSpeak servers.
You can create private or public channels. Every channel can store up to 8 fields (the values) and creates charts with those fields. Every channel has a “Channel ID”, a “Name”, a “Write API Key” and a “Description”. The Write API Key is the most important information of the channel, since it allows to upload or download the field data.
We created a public channel to share with you the results of this Application. You can also use the private channels to respect the user privacy!
The hardware used is really basic, but it could be easily upgraded with different connections, sensors, etc. Here are used 4 analog inputs with some very simple resistor-pot series to limit the input voltage above 2V, and 4 buttons with internal microcontroller pullup resistors.
The using of thingspeak services is made easy by the “Thingspeak Library”. It is a ready to use library that allows to write data arrays to channels, or use the thingTWEET and thingHTTP APIs, by the calling of 4 different functions. Those functions automatically prepare the TCP message to send to thingspeak, and handle the receiving of the replies.
You will use also another library: the parse lib. This helper lib provides some functions to “select” a text inside some complex string like a TCP/IP reply of a webserver. The parse lib is used to take the Temperature in °C from the reply of the thingHTTP function.
The thingHTTP request stored inside thingspeak is:
and the parse is done at current_conditions parameter.
In this way, Flyport receives only data related to the “current_conditions”, and the other information are not received by the module, with a high reduction of memory space needed for the GENERIC_TCP_CLIENT Rx Buffer (650 bytes are enought).
Flyport WiFi module and all the hardware based on openPICUS framework is ready to download updated weather information, upload data to cloud servers, give access to online data charting functionalities and set custom statuses of twitter account.