SlideShare a Scribd company logo
1 of 7
openPicus                                                                                              Application Note


                                                      Application Note: OP-AN-0007
                                                            ThingSpeak & parse library




Device: Openpicus Flyport
IDE version: 2.1
Author - version: Simone Marra - v1.0
External libs: ”Thingspeak” and “parse”
Connections: 4 Analog inputs, 4 digital inputs.
Description:
This Application Note gives access to the Thingspeak services. Thingspeak allowes to plot on-line charts, to store and
recall values and to use specific APIs to operate with Twitter, or to send HTTP requests directly from the thingspeak
servers.




Every thingspeak user 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 permits to upload or download the field
data.
Every field has a name that figures inside the Charts. The charts could be easily integrated inside a website or a blog or
seen from the thingspeak.com website.
To use thingspeak.com services for this application note, we created a public channel with “Channel ID”=1609 and link
https://www.thingspeak.com/channels/1609, with “write API ke” = “Z4B61FNZ4XFD3QMD” and named “OP-AN-
0007_ThingSpeak”.
         NOTE: The channel used is a public channel created for this specific Application Note. Flyport's Firmware is
         connected to this specific Channel only by the use of Write API Key. Changing those keys allows to use any
         other thingspeak channel, public or private.



16.01.2012 (v.1.0)                                www.openpicus.com                                                       1
openPicus                                                                                             Application Note

The others Thingspeak services used in this Application Note are thingTweet and thingHTTP.
ThingTweet is a twitter Bridge that allows to update twitter status, and thingHTTP permits to send HTTP requests to
websites, receiving a pre-parsed reply using the Thingspeak servers. In this example, thingHTTP is used to get the
temperature of Rome using the google weather APIs.


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.
The 4 analog values are uploaded to the first 4 fields of thingspeak channel, and the first 3 buttons are uploaded to
thingspeak fields 5,6 and 7 as values of 0 for unpressed button and 100 for pressed button. Those values can be freely
customized by the user inside the taskFlyport.c file.




The switch 4 is responsible of the update of twitter status; if the button is pressed a new message is posted on twitter
account.


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.
To use them it is simply needed to add “thingspeak.h” and “thingspeak.c” reference files from the “External Lib” tool
of OpenPicus IDE.
For this Application Note we 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. To use the parse lib, add “parse.h” and “parse.c” with the
IDE tool.



 2                                     www.openpicus.com                                             16.01.2012 (v.1.0)
openPicus                                                                                           Application Note

In the attached software provided, user have to change only the Wi-Fi parameters to its router ssid and password,
since a internet connection is needed for the correct function of this firmware. The adhoc connection should not be
used. So, simply open the project in the openPicus IDE, launch the Wizard to change connection parameters, compile
and download the firmware inside the Flyport.
Another customization could be to change thingspeak's channel, thingTWEET allowed twitter account, and thingHTTP
kind of request. Those customizations in Flyport's firmware are done by changing the API keys of thingspeak.com.
Accessing to thingspeak.com website, user can get his own keys and handle all the charts customization as well.


Getting the API Keys:
In the taskFlyport.c there are 3 different API keys:
    •    char thingKey [] = "Z4B61FNZ4XFD3QMD";
    •    char thingTweetKey [] = "SXHF1RYHZBURVFDO";
    •    char thingHTTPKey [] = "RMB8KBQGSBGL3K2D";


The channel key thingKey is provided by thingspeak.com when the user creates a new Channel, in both public or
private mode.




16.01.2012 (v.1.0)                               www.openpicus.com                                                     3
openPicus                                                                                                  Application Note

To generate the thingHTTP key, simply go to https://thingspeak.com/apps/thinghttp, create a new request with:

     •   URL: http://www.google.com/ig/api?weather=Roma&hl=en
     •   METHOD: GET
     •   parse string: current_conditions
In this way an API key will be provided by thingspeak.
To generate the thingTWEET key, simply go to https://thingspeak.com/apps/thingtweet, and link a twitter account.
Thingspeak will provide API key.


Using the thingspeak APIs:
In the taskFlyport.c there are used 3 of the 4 functions of thingspeak library:
     •   wfTHINGSPEAK
     •   thingTWEET
     •   thingHTTP


The “wfTHINGSPEAK” is a function that writes an array of float data to the specified channel... Thingspeak stores
those values and plots them as timed charts, that could be used also outside the thingspeak service inside a blog or a
website. In this application note the function is used to write 4 analog inputs and 3 digital inputs values at the first 7
fields of the channel, and the last one field is the current temperature of Rome (the Italian City).
The 4 analog values are read by openPICUS framework, and depend on the state of the potentiometers. The 3 digital
values are related to the state of 3 push-buttons (pressed or not pressed). The last value is updated using the thingHTTP
feature.


The “wfTHINGSPEAK” function uploads float type data, but using the “wiTHINGSPEAK” user can uploads int type of
data.




The “thingHTTP” is a function that sends a TCP request to thingspeak, and receives a parsed reply. This kind of request
is very simple,since the message format is just prepared inside the function, the user should only worry about the API
key. The request is prepared inside the thingspeak website, and also a parsing string could be used.




 4                                      www.openpicus.com                                                 16.01.2012 (v.1.0)
openPicus                                                                                            Application Note

For this application note, the thingHTTP request stored inside thingspeak is:
http://www.google.com/ig/api?weather=Roma&hl=en where 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). A more precise parse could be done using a parse parameter of “current_conditions.temp_c.data” that
returns only the temperature in Celsius Degrees.
For a more flexibility of the firmware, it was chosen to parse less information with thingHTTP, and execute a post parse
inside the Flyport. The function used is “PARSEbetween”, and the parameter is “temp_c data="”, but changing it to
“temp_f data="” permits to have the Fahrenheit Degrees, without changes inside the thingspeak website. Inside
Flyport's firmware it could be also parsed any other information returned by thingHTTP function (since these are
stored inside a char array...), like the weather condition, the wind or the humidity.




16.01.2012 (v.1.0)                              www.openpicus.com                                                         5
openPicus                                                                                            Application Note




In fact, opening the link http://www.google.com/ig/api?weather=Roma&hl=en inside a webbrowser, it could be seen
the data available inside the <current_conditions> … </current_conditions> tags, and choose what kind of data to
parse inside the Flyport firmware.


The “thingTWEET” is the function that alows to update a twitter status with a defined message.
Since twitter needs to have a different message every time the content of the status is updated, inside the message it
is written also the date parsed from the reply of the TCPMessage from the thingspeak server. In this way every
message is different from another and brings also the date (GMT) of the thingspeak reply.
To launch the update it should be pressed the button 4 at the remaining digital input.




6                                     www.openpicus.com                                             16.01.2012 (v.1.0)
openPicus                                                                                           Application Note



Conclusions:
With a minimal effort from user, Flyport 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.
Thanks to thingspeak library the queries to websites are “transparent” to user firmware, providing an easy to write and
easy to read code, just like the serial communications




16.01.2012 (v.1.0)                             www.openpicus.com                                                       7

More Related Content

What's hot

02 wireshark http-sept_15_2009
02   wireshark http-sept_15_200902   wireshark http-sept_15_2009
02 wireshark http-sept_15_2009Vothe Dung
 
Codemotion Rome 2018 - RxJs and Node
Codemotion Rome 2018 - RxJs and NodeCodemotion Rome 2018 - RxJs and Node
Codemotion Rome 2018 - RxJs and Nodeenricopiccinin
 
IoT with OpenPicus Flyport
IoT with OpenPicus FlyportIoT with OpenPicus Flyport
IoT with OpenPicus FlyportIonela
 
From Apache Flink® 1.3 to 1.4
From Apache Flink® 1.3 to 1.4From Apache Flink® 1.3 to 1.4
From Apache Flink® 1.3 to 1.4Till Rohrmann
 
Apache Flink and More @ MesosCon Asia 2017
Apache Flink and More @ MesosCon Asia 2017Apache Flink and More @ MesosCon Asia 2017
Apache Flink and More @ MesosCon Asia 2017Till Rohrmann
 
Test automation of ap is using postman
Test automation of ap is using postmanTest automation of ap is using postman
Test automation of ap is using postmanBugRaptors
 
692015 programming assignment 1 building a multi­threaded w
692015 programming assignment 1 building a multi­threaded w692015 programming assignment 1 building a multi­threaded w
692015 programming assignment 1 building a multi­threaded wsmile790243
 
Installing Python on Windows OS
Installing Python on Windows OSInstalling Python on Windows OS
Installing Python on Windows OSWei-Wen Hsu
 
Cracking CTFs The Sysbypass CTF
Cracking CTFs The Sysbypass CTFCracking CTFs The Sysbypass CTF
Cracking CTFs The Sysbypass CTFRiyaz Walikar
 
Flink Forward Berlin 2017: Till Rohrmann - From Apache Flink 1.3 to 1.4
Flink Forward Berlin 2017: Till Rohrmann - From Apache Flink 1.3 to 1.4Flink Forward Berlin 2017: Till Rohrmann - From Apache Flink 1.3 to 1.4
Flink Forward Berlin 2017: Till Rohrmann - From Apache Flink 1.3 to 1.4Flink Forward
 

What's hot (13)

02 wireshark http-sept_15_2009
02   wireshark http-sept_15_200902   wireshark http-sept_15_2009
02 wireshark http-sept_15_2009
 
REST API Basics
REST API BasicsREST API Basics
REST API Basics
 
mush With Xampp
mush With Xamppmush With Xampp
mush With Xampp
 
Codemotion Rome 2018 - RxJs and Node
Codemotion Rome 2018 - RxJs and NodeCodemotion Rome 2018 - RxJs and Node
Codemotion Rome 2018 - RxJs and Node
 
IoT with OpenPicus Flyport
IoT with OpenPicus FlyportIoT with OpenPicus Flyport
IoT with OpenPicus Flyport
 
From Apache Flink® 1.3 to 1.4
From Apache Flink® 1.3 to 1.4From Apache Flink® 1.3 to 1.4
From Apache Flink® 1.3 to 1.4
 
Apache Flink and More @ MesosCon Asia 2017
Apache Flink and More @ MesosCon Asia 2017Apache Flink and More @ MesosCon Asia 2017
Apache Flink and More @ MesosCon Asia 2017
 
Test automation of ap is using postman
Test automation of ap is using postmanTest automation of ap is using postman
Test automation of ap is using postman
 
Cracking CTFs - Sysbypass CTF Walkthrough
Cracking CTFs - Sysbypass CTF WalkthroughCracking CTFs - Sysbypass CTF Walkthrough
Cracking CTFs - Sysbypass CTF Walkthrough
 
692015 programming assignment 1 building a multi­threaded w
692015 programming assignment 1 building a multi­threaded w692015 programming assignment 1 building a multi­threaded w
692015 programming assignment 1 building a multi­threaded w
 
Installing Python on Windows OS
Installing Python on Windows OSInstalling Python on Windows OS
Installing Python on Windows OS
 
Cracking CTFs The Sysbypass CTF
Cracking CTFs The Sysbypass CTFCracking CTFs The Sysbypass CTF
Cracking CTFs The Sysbypass CTF
 
Flink Forward Berlin 2017: Till Rohrmann - From Apache Flink 1.3 to 1.4
Flink Forward Berlin 2017: Till Rohrmann - From Apache Flink 1.3 to 1.4Flink Forward Berlin 2017: Till Rohrmann - From Apache Flink 1.3 to 1.4
Flink Forward Berlin 2017: Till Rohrmann - From Apache Flink 1.3 to 1.4
 

Similar to Openpicus Flyport interfaces the cloud services

Five steps to get tweets sent by a list of users
Five steps to get tweets sent by a list of usersFive steps to get tweets sent by a list of users
Five steps to get tweets sent by a list of usersWeiai Wayne Xu
 
Machine Problem 1: Let's chat
Machine Problem 1: Let's chatMachine Problem 1: Let's chat
Machine Problem 1: Let's chatbutest
 
Maxbox starter18
Maxbox starter18Maxbox starter18
Maxbox starter18Max Kleiner
 
maXbox Arduino Tutorial
maXbox Arduino TutorialmaXbox Arduino Tutorial
maXbox Arduino TutorialMax Kleiner
 
OpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in PythonOpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in PythonCodeOps Technologies LLP
 
Creating a mule project with raml and api
Creating a mule project with raml and apiCreating a mule project with raml and api
Creating a mule project with raml and apiBhargav Ranjit
 
comparative study on cross platfom frameworks mobile apps
comparative study on cross platfom frameworks mobile appscomparative study on cross platfom frameworks mobile apps
comparative study on cross platfom frameworks mobile appsapurva vyas
 
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2Weiai Wayne Xu
 
Tutorial_Python1.pdf
Tutorial_Python1.pdfTutorial_Python1.pdf
Tutorial_Python1.pdfMuzamilFaiz
 
apidays LIVE Paris - Potential of API integrations, common traps and advices ...
apidays LIVE Paris - Potential of API integrations, common traps and advices ...apidays LIVE Paris - Potential of API integrations, common traps and advices ...
apidays LIVE Paris - Potential of API integrations, common traps and advices ...apidays
 
Android application architecture
Android application architectureAndroid application architecture
Android application architectureRomain Rochegude
 
Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3Max Kleiner
 
How to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah CrowleyHow to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah CrowleyInfluxData
 
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxDataBuilding a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxDataInfluxData
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009Cathie101
 

Similar to Openpicus Flyport interfaces the cloud services (20)

News web application
News web applicationNews web application
News web application
 
Five steps to get tweets sent by a list of users
Five steps to get tweets sent by a list of usersFive steps to get tweets sent by a list of users
Five steps to get tweets sent by a list of users
 
Machine Problem 1: Let's chat
Machine Problem 1: Let's chatMachine Problem 1: Let's chat
Machine Problem 1: Let's chat
 
Maxbox starter18
Maxbox starter18Maxbox starter18
Maxbox starter18
 
CGI by rj
CGI by rjCGI by rj
CGI by rj
 
maXbox Arduino Tutorial
maXbox Arduino TutorialmaXbox Arduino Tutorial
maXbox Arduino Tutorial
 
OpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in PythonOpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in Python
 
Creating a mule project with raml and api
Creating a mule project with raml and apiCreating a mule project with raml and api
Creating a mule project with raml and api
 
comparative study on cross platfom frameworks mobile apps
comparative study on cross platfom frameworks mobile appscomparative study on cross platfom frameworks mobile apps
comparative study on cross platfom frameworks mobile apps
 
Websocket 101 in Python
Websocket 101 in PythonWebsocket 101 in Python
Websocket 101 in Python
 
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
 
Tutorial_Python1.pdf
Tutorial_Python1.pdfTutorial_Python1.pdf
Tutorial_Python1.pdf
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
apidays LIVE Paris - Potential of API integrations, common traps and advices ...
apidays LIVE Paris - Potential of API integrations, common traps and advices ...apidays LIVE Paris - Potential of API integrations, common traps and advices ...
apidays LIVE Paris - Potential of API integrations, common traps and advices ...
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
 
Android application architecture
Android application architectureAndroid application architecture
Android application architecture
 
Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3
 
How to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah CrowleyHow to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah Crowley
 
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxDataBuilding a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
 

More from Ionela

Flyport wifi webserver configuration page
Flyport wifi webserver configuration pageFlyport wifi webserver configuration page
Flyport wifi webserver configuration pageIonela
 
openPicus Proto Nest Datasheet
openPicus Proto Nest DatasheetopenPicus Proto Nest Datasheet
openPicus Proto Nest DatasheetIonela
 
Flyport openPicus datasheet
Flyport openPicus datasheetFlyport openPicus datasheet
Flyport openPicus datasheetIonela
 
Windows phone 7 è l’ultima occasione di microsoft 2010-10-18
Windows phone 7 è l’ultima occasione di microsoft   2010-10-18Windows phone 7 è l’ultima occasione di microsoft   2010-10-18
Windows phone 7 è l’ultima occasione di microsoft 2010-10-18Ionela
 
Videocamera cam ball un mare di caratteristiche nella piccola videocamera a ...
Videocamera cam ball  un mare di caratteristiche nella piccola videocamera a ...Videocamera cam ball  un mare di caratteristiche nella piccola videocamera a ...
Videocamera cam ball un mare di caratteristiche nella piccola videocamera a ...Ionela
 
Utente premium 2010-10-17
Utente premium   2010-10-17Utente premium   2010-10-17
Utente premium 2010-10-17Ionela
 
Unity sostituisce gnome su ubuntu 11.04 2010-11-01
Unity sostituisce gnome su ubuntu 11.04   2010-11-01Unity sostituisce gnome su ubuntu 11.04   2010-11-01
Unity sostituisce gnome su ubuntu 11.04 2010-11-01Ionela
 
Una retina artificiale per ridare la vista 2010-11-10
Una retina artificiale per ridare la vista   2010-11-10Una retina artificiale per ridare la vista   2010-11-10
Una retina artificiale per ridare la vista 2010-11-10Ionela
 
Un orologio elettronico completo basato su i2 c rtcc mcp79410 2010-10-29
Un orologio elettronico completo basato su i2 c rtcc mcp79410   2010-10-29Un orologio elettronico completo basato su i2 c rtcc mcp79410   2010-10-29
Un orologio elettronico completo basato su i2 c rtcc mcp79410 2010-10-29Ionela
 
Ultimo lancio discovery delle perdite rinviano l’ultimo lancio dello shuttle...
Ultimo lancio discovery  delle perdite rinviano l’ultimo lancio dello shuttle...Ultimo lancio discovery  delle perdite rinviano l’ultimo lancio dello shuttle...
Ultimo lancio discovery delle perdite rinviano l’ultimo lancio dello shuttle...Ionela
 
Ubuntu passa a wayland 2010-11-08
Ubuntu passa a wayland   2010-11-08Ubuntu passa a wayland   2010-11-08
Ubuntu passa a wayland 2010-11-08Ionela
 
Touchatag un&#039;applicazione di internet delle cose 2010-11-10
Touchatag  un&#039;applicazione di internet delle cose   2010-11-10Touchatag  un&#039;applicazione di internet delle cose   2010-11-10
Touchatag un&#039;applicazione di internet delle cose 2010-11-10Ionela
 
Tianhe 1, il supercomputer cinese - 2010-11-05
Tianhe 1, il supercomputer cinese - 2010-11-05Tianhe 1, il supercomputer cinese - 2010-11-05
Tianhe 1, il supercomputer cinese - 2010-11-05Ionela
 
Thread o processo quale usare - 2010-11-02
Thread o processo  quale usare  - 2010-11-02Thread o processo  quale usare  - 2010-11-02
Thread o processo quale usare - 2010-11-02Ionela
 
Termometro digitale usando pic16 f84a schema elettrico - 2010-11-03
Termometro digitale usando pic16 f84a   schema elettrico - 2010-11-03Termometro digitale usando pic16 f84a   schema elettrico - 2010-11-03
Termometro digitale usando pic16 f84a schema elettrico - 2010-11-03Ionela
 
Telescopio webb il sistema di engineering del telescopio webb della nasa si ...
Telescopio webb  il sistema di engineering del telescopio webb della nasa si ...Telescopio webb  il sistema di engineering del telescopio webb della nasa si ...
Telescopio webb il sistema di engineering del telescopio webb della nasa si ...Ionela
 
Tecnologia light peak intel potrebbe adottarla da inizio 2011, apple a segui...
Tecnologia light peak  intel potrebbe adottarla da inizio 2011, apple a segui...Tecnologia light peak  intel potrebbe adottarla da inizio 2011, apple a segui...
Tecnologia light peak intel potrebbe adottarla da inizio 2011, apple a segui...Ionela
 
Tastiere capacitive 2010-11-10
Tastiere capacitive   2010-11-10Tastiere capacitive   2010-11-10
Tastiere capacitive 2010-11-10Ionela
 
Supporto wi max toshiba introduce il supporto wimax nei notebook portégé r70...
Supporto wi max  toshiba introduce il supporto wimax nei notebook portégé r70...Supporto wi max  toshiba introduce il supporto wimax nei notebook portégé r70...
Supporto wi max toshiba introduce il supporto wimax nei notebook portégé r70...Ionela
 
Stm32 vl discovery recensione - 2010-11-11
Stm32 vl discovery   recensione  - 2010-11-11Stm32 vl discovery   recensione  - 2010-11-11
Stm32 vl discovery recensione - 2010-11-11Ionela
 

More from Ionela (20)

Flyport wifi webserver configuration page
Flyport wifi webserver configuration pageFlyport wifi webserver configuration page
Flyport wifi webserver configuration page
 
openPicus Proto Nest Datasheet
openPicus Proto Nest DatasheetopenPicus Proto Nest Datasheet
openPicus Proto Nest Datasheet
 
Flyport openPicus datasheet
Flyport openPicus datasheetFlyport openPicus datasheet
Flyport openPicus datasheet
 
Windows phone 7 è l’ultima occasione di microsoft 2010-10-18
Windows phone 7 è l’ultima occasione di microsoft   2010-10-18Windows phone 7 è l’ultima occasione di microsoft   2010-10-18
Windows phone 7 è l’ultima occasione di microsoft 2010-10-18
 
Videocamera cam ball un mare di caratteristiche nella piccola videocamera a ...
Videocamera cam ball  un mare di caratteristiche nella piccola videocamera a ...Videocamera cam ball  un mare di caratteristiche nella piccola videocamera a ...
Videocamera cam ball un mare di caratteristiche nella piccola videocamera a ...
 
Utente premium 2010-10-17
Utente premium   2010-10-17Utente premium   2010-10-17
Utente premium 2010-10-17
 
Unity sostituisce gnome su ubuntu 11.04 2010-11-01
Unity sostituisce gnome su ubuntu 11.04   2010-11-01Unity sostituisce gnome su ubuntu 11.04   2010-11-01
Unity sostituisce gnome su ubuntu 11.04 2010-11-01
 
Una retina artificiale per ridare la vista 2010-11-10
Una retina artificiale per ridare la vista   2010-11-10Una retina artificiale per ridare la vista   2010-11-10
Una retina artificiale per ridare la vista 2010-11-10
 
Un orologio elettronico completo basato su i2 c rtcc mcp79410 2010-10-29
Un orologio elettronico completo basato su i2 c rtcc mcp79410   2010-10-29Un orologio elettronico completo basato su i2 c rtcc mcp79410   2010-10-29
Un orologio elettronico completo basato su i2 c rtcc mcp79410 2010-10-29
 
Ultimo lancio discovery delle perdite rinviano l’ultimo lancio dello shuttle...
Ultimo lancio discovery  delle perdite rinviano l’ultimo lancio dello shuttle...Ultimo lancio discovery  delle perdite rinviano l’ultimo lancio dello shuttle...
Ultimo lancio discovery delle perdite rinviano l’ultimo lancio dello shuttle...
 
Ubuntu passa a wayland 2010-11-08
Ubuntu passa a wayland   2010-11-08Ubuntu passa a wayland   2010-11-08
Ubuntu passa a wayland 2010-11-08
 
Touchatag un&#039;applicazione di internet delle cose 2010-11-10
Touchatag  un&#039;applicazione di internet delle cose   2010-11-10Touchatag  un&#039;applicazione di internet delle cose   2010-11-10
Touchatag un&#039;applicazione di internet delle cose 2010-11-10
 
Tianhe 1, il supercomputer cinese - 2010-11-05
Tianhe 1, il supercomputer cinese - 2010-11-05Tianhe 1, il supercomputer cinese - 2010-11-05
Tianhe 1, il supercomputer cinese - 2010-11-05
 
Thread o processo quale usare - 2010-11-02
Thread o processo  quale usare  - 2010-11-02Thread o processo  quale usare  - 2010-11-02
Thread o processo quale usare - 2010-11-02
 
Termometro digitale usando pic16 f84a schema elettrico - 2010-11-03
Termometro digitale usando pic16 f84a   schema elettrico - 2010-11-03Termometro digitale usando pic16 f84a   schema elettrico - 2010-11-03
Termometro digitale usando pic16 f84a schema elettrico - 2010-11-03
 
Telescopio webb il sistema di engineering del telescopio webb della nasa si ...
Telescopio webb  il sistema di engineering del telescopio webb della nasa si ...Telescopio webb  il sistema di engineering del telescopio webb della nasa si ...
Telescopio webb il sistema di engineering del telescopio webb della nasa si ...
 
Tecnologia light peak intel potrebbe adottarla da inizio 2011, apple a segui...
Tecnologia light peak  intel potrebbe adottarla da inizio 2011, apple a segui...Tecnologia light peak  intel potrebbe adottarla da inizio 2011, apple a segui...
Tecnologia light peak intel potrebbe adottarla da inizio 2011, apple a segui...
 
Tastiere capacitive 2010-11-10
Tastiere capacitive   2010-11-10Tastiere capacitive   2010-11-10
Tastiere capacitive 2010-11-10
 
Supporto wi max toshiba introduce il supporto wimax nei notebook portégé r70...
Supporto wi max  toshiba introduce il supporto wimax nei notebook portégé r70...Supporto wi max  toshiba introduce il supporto wimax nei notebook portégé r70...
Supporto wi max toshiba introduce il supporto wimax nei notebook portégé r70...
 
Stm32 vl discovery recensione - 2010-11-11
Stm32 vl discovery   recensione  - 2010-11-11Stm32 vl discovery   recensione  - 2010-11-11
Stm32 vl discovery recensione - 2010-11-11
 

Recently uploaded

办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭o8wvnojp
 
Inspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptxInspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptxShubham Rawat
 
南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证kbdhl05e
 
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In Delhi
Call Girls In Dwarka Sub City  ☎️7838079806 ✅ 💯Call Girls In DelhiCall Girls In Dwarka Sub City  ☎️7838079806 ✅ 💯Call Girls In Delhi
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In DelhiSoniyaSingh
 
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ EscortsDelhi Escorts Service
 
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 AvilableCall Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilabledollysharma2066
 
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...Authentic No 1 Amil Baba In Pakistan
 
E J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptxE J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptxJackieSparrow3
 
西伦敦大学毕业证学位证成绩单-怎么样做
西伦敦大学毕业证学位证成绩单-怎么样做西伦敦大学毕业证学位证成绩单-怎么样做
西伦敦大学毕业证学位证成绩单-怎么样做j5bzwet6
 
(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)oannq
 

Recently uploaded (12)

办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭
 
Inspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptxInspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptx
 
南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证
 
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In Delhi
Call Girls In Dwarka Sub City  ☎️7838079806 ✅ 💯Call Girls In DelhiCall Girls In Dwarka Sub City  ☎️7838079806 ✅ 💯Call Girls In Delhi
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In Delhi
 
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
 
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
 
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 AvilableCall Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
 
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
 
E J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptxE J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptx
 
西伦敦大学毕业证学位证成绩单-怎么样做
西伦敦大学毕业证学位证成绩单-怎么样做西伦敦大学毕业证学位证成绩单-怎么样做
西伦敦大学毕业证学位证成绩单-怎么样做
 
(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)
 

Openpicus Flyport interfaces the cloud services

  • 1. openPicus Application Note Application Note: OP-AN-0007 ThingSpeak & parse library Device: Openpicus Flyport IDE version: 2.1 Author - version: Simone Marra - v1.0 External libs: ”Thingspeak” and “parse” Connections: 4 Analog inputs, 4 digital inputs. Description: This Application Note gives access to the Thingspeak services. Thingspeak allowes to plot on-line charts, to store and recall values and to use specific APIs to operate with Twitter, or to send HTTP requests directly from the thingspeak servers. Every thingspeak user 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 permits to upload or download the field data. Every field has a name that figures inside the Charts. The charts could be easily integrated inside a website or a blog or seen from the thingspeak.com website. To use thingspeak.com services for this application note, we created a public channel with “Channel ID”=1609 and link https://www.thingspeak.com/channels/1609, with “write API ke” = “Z4B61FNZ4XFD3QMD” and named “OP-AN- 0007_ThingSpeak”. NOTE: The channel used is a public channel created for this specific Application Note. Flyport's Firmware is connected to this specific Channel only by the use of Write API Key. Changing those keys allows to use any other thingspeak channel, public or private. 16.01.2012 (v.1.0) www.openpicus.com 1
  • 2. openPicus Application Note The others Thingspeak services used in this Application Note are thingTweet and thingHTTP. ThingTweet is a twitter Bridge that allows to update twitter status, and thingHTTP permits to send HTTP requests to websites, receiving a pre-parsed reply using the Thingspeak servers. In this example, thingHTTP is used to get the temperature of Rome using the google weather APIs. 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. The 4 analog values are uploaded to the first 4 fields of thingspeak channel, and the first 3 buttons are uploaded to thingspeak fields 5,6 and 7 as values of 0 for unpressed button and 100 for pressed button. Those values can be freely customized by the user inside the taskFlyport.c file. The switch 4 is responsible of the update of twitter status; if the button is pressed a new message is posted on twitter account. 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. To use them it is simply needed to add “thingspeak.h” and “thingspeak.c” reference files from the “External Lib” tool of OpenPicus IDE. For this Application Note we 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. To use the parse lib, add “parse.h” and “parse.c” with the IDE tool. 2 www.openpicus.com 16.01.2012 (v.1.0)
  • 3. openPicus Application Note In the attached software provided, user have to change only the Wi-Fi parameters to its router ssid and password, since a internet connection is needed for the correct function of this firmware. The adhoc connection should not be used. So, simply open the project in the openPicus IDE, launch the Wizard to change connection parameters, compile and download the firmware inside the Flyport. Another customization could be to change thingspeak's channel, thingTWEET allowed twitter account, and thingHTTP kind of request. Those customizations in Flyport's firmware are done by changing the API keys of thingspeak.com. Accessing to thingspeak.com website, user can get his own keys and handle all the charts customization as well. Getting the API Keys: In the taskFlyport.c there are 3 different API keys: • char thingKey [] = "Z4B61FNZ4XFD3QMD"; • char thingTweetKey [] = "SXHF1RYHZBURVFDO"; • char thingHTTPKey [] = "RMB8KBQGSBGL3K2D"; The channel key thingKey is provided by thingspeak.com when the user creates a new Channel, in both public or private mode. 16.01.2012 (v.1.0) www.openpicus.com 3
  • 4. openPicus Application Note To generate the thingHTTP key, simply go to https://thingspeak.com/apps/thinghttp, create a new request with: • URL: http://www.google.com/ig/api?weather=Roma&hl=en • METHOD: GET • parse string: current_conditions In this way an API key will be provided by thingspeak. To generate the thingTWEET key, simply go to https://thingspeak.com/apps/thingtweet, and link a twitter account. Thingspeak will provide API key. Using the thingspeak APIs: In the taskFlyport.c there are used 3 of the 4 functions of thingspeak library: • wfTHINGSPEAK • thingTWEET • thingHTTP The “wfTHINGSPEAK” is a function that writes an array of float data to the specified channel... Thingspeak stores those values and plots them as timed charts, that could be used also outside the thingspeak service inside a blog or a website. In this application note the function is used to write 4 analog inputs and 3 digital inputs values at the first 7 fields of the channel, and the last one field is the current temperature of Rome (the Italian City). The 4 analog values are read by openPICUS framework, and depend on the state of the potentiometers. The 3 digital values are related to the state of 3 push-buttons (pressed or not pressed). The last value is updated using the thingHTTP feature. The “wfTHINGSPEAK” function uploads float type data, but using the “wiTHINGSPEAK” user can uploads int type of data. The “thingHTTP” is a function that sends a TCP request to thingspeak, and receives a parsed reply. This kind of request is very simple,since the message format is just prepared inside the function, the user should only worry about the API key. The request is prepared inside the thingspeak website, and also a parsing string could be used. 4 www.openpicus.com 16.01.2012 (v.1.0)
  • 5. openPicus Application Note For this application note, the thingHTTP request stored inside thingspeak is: http://www.google.com/ig/api?weather=Roma&hl=en where 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). A more precise parse could be done using a parse parameter of “current_conditions.temp_c.data” that returns only the temperature in Celsius Degrees. For a more flexibility of the firmware, it was chosen to parse less information with thingHTTP, and execute a post parse inside the Flyport. The function used is “PARSEbetween”, and the parameter is “temp_c data="”, but changing it to “temp_f data="” permits to have the Fahrenheit Degrees, without changes inside the thingspeak website. Inside Flyport's firmware it could be also parsed any other information returned by thingHTTP function (since these are stored inside a char array...), like the weather condition, the wind or the humidity. 16.01.2012 (v.1.0) www.openpicus.com 5
  • 6. openPicus Application Note In fact, opening the link http://www.google.com/ig/api?weather=Roma&hl=en inside a webbrowser, it could be seen the data available inside the <current_conditions> … </current_conditions> tags, and choose what kind of data to parse inside the Flyport firmware. The “thingTWEET” is the function that alows to update a twitter status with a defined message. Since twitter needs to have a different message every time the content of the status is updated, inside the message it is written also the date parsed from the reply of the TCPMessage from the thingspeak server. In this way every message is different from another and brings also the date (GMT) of the thingspeak reply. To launch the update it should be pressed the button 4 at the remaining digital input. 6 www.openpicus.com 16.01.2012 (v.1.0)
  • 7. openPicus Application Note Conclusions: With a minimal effort from user, Flyport 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. Thanks to thingspeak library the queries to websites are “transparent” to user firmware, providing an easy to write and easy to read code, just like the serial communications 16.01.2012 (v.1.0) www.openpicus.com 7