How to interface Flyport to cloud services -2nd part

Posted by openPicus | On: Jan 23 2012

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.

Simone, our geek, wanted to measure the temperature of Rome using Google Weather and Flyport, or to put it better, Internet of Things (IoT).
Internet of things is one of the most important technological advances of the 21st century
Why am I telling this? Well, IoT (internet of things) becomes more and more powerful. At present, there are 9 billion connected devices, and by 2020, there will be 24 billion devices (according to the Global Mobile Industry Trade Group, GSMA). Not bad, isn’t it?!
This era was much anticipated because all the manner of devices can communicate to each other. The Cloud computing creates everyday new applications to support billions of connected objects. The business trends and the consumer are moving us toward the Internet of Things! You’ll ask: what about the privacy? Well, if IoT means increasing benefits in my personal life, I can tell you that exists the way to do it in privately.
What does IoT really mean?
More connected devices such as cars, TVs, DVD players and smartphones and tablets.

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!

Hardware
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.

Software
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:
http://www.google.com/ig/api?weather=Roma&hl=en,
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.

Download for free the Interfacing Flyport to ThingSpeak Documentation and the Source Code.

6 Comments

  1. Charudatt says:

    Thanks for this, would be interesting to try and learn , something new.

  2. Ionela says:

    You just have to download the AppNote and the source code… and this is it! :)

  3. Charudatt says:

    U’ll surely know how to make things simple and intresting…… bravo.

  4. JML says:

    You may also look at my project I just posted in the Projects forum where I integrated several Cloud services Twitter, ThingSpeak and NImbits, and a web control of a Flyport hosted simulator to make the full chain.
    I also used some dynamic memory allocation (malloc:free) thanks to the heap management integrated in the rtos itself.
    The url of the post is
    http://community.openpicus.com/forum/projects-place/1052/web-controlled-simulator-web-services-connections-nimbits-thingspeak-and-twitter

  5. Ionela says:

    @Charudatt: we try to keep it simple, but at the same time, interesting!
    @JML: thank you for sharing with us your work! soon, we’ll publish your project!

  6. Ruby Badcoe says:

    This is great! With this, many will find it easy to store backup data and quickly transfer them to any portal. I think students also need something like this for their research papers. Those figures are comprehensive, BTW.

Leave a comment