SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Downloaden Sie, um offline zu lesen
Page | 1 9-Feb-12 JMLambert V1.0
IoT with OpenPicus Flyport :
Temperature/Pressure with BMP085
I2C LCD setup
Use case of Pachube and Paraimpu
Page | 2 9-Feb-12 JMLambert V1.0
Introduction
After the previous exercise with a Flyport Simulator connected to the web services, I will expose the experience and
solution of the following problem :
- Acquire Temperature & Pressure of a BMP085 device on a I2C bus
- Set the Real Time clock to the web time and use an alarm to acquire regularly the measurements
- Send the measurements to some Cloud storage, (I have integrated successfully NimBits, ThingSpeak, Paraimpu
and Pachube…)
- Display the curves of the measurements on the web page of the Flyport.
- Setup a LCD display HD44780 connected to the Flyport with I2C bus, thanks to I2C driver chip that is easy and
low cost and need less wires.
- Display some values on the local LCD as a “weather station”…
As explained above, I tried different Web Services to store the data, and Pachube seems quite good as it allows a very
easy graphing out of the data.
But Pachube is not able to process the Data and generate alerts (it seems) as easy as with ParaImpu
I chose to create a Pachube sensor in Paraimpu, and a connector inside Paraimpu that will tweet a message when an
alert is raised. We will see how.
I2C Bus & BMP085 acquision programming.
I connected the BMP085 directly on the Flyport, as it handles already on board the pullup.
I used the few libraries from the OpenPicus Download content :
- OP-LIB - i2c Helper rev1.0.zip
- LIB - BMP085 temperature sensor_rev1.0.zip
After some initial issue on the I2C reading, I fixed the soldering…
I just connected the required wires : GND+VCC + I2C Bus : SCL+SDA
Page | 3 9-Feb-12 JMLambert V1.0
Web time & RTCC Programming
The objective is to get the current time from an external web site (always included in a response), then set the time in
the RTCC and create alarms from the RTC at regular interval to perform the acquisition and sensor data transmission to
the storage (not too often)
Get the time from a web site header : www.google.com
In aim to get the time, the simpler is to make a POST request to a site, and analyses the header response.
Then you extract the fields and use them to initialize the RTCC.
Page | 4 9-Feb-12 JMLambert V1.0
Then, the time will be set in the RTCC and next steps :
Page | 5 9-Feb-12 JMLambert V1.0
I2C Bus & LCD HD44780
I used also the I2CHelper library as above, but I needed to create a new function :
New function : I2CSendString()
To handle the LCD, I added a new function in complement to the I2CHelper : I2cSendString()
This function is necessary to send messages to the I2C LCD and handles the split of messages within the max size of the
I2C buffer (generally 32, but it is a parameter)
LCD Display organization
In aim to put some flexibility in the way to create and eventually change the content of the display dynamically, I have
gone through some descriptions data.
Page | 6 9-Feb-12 JMLambert V1.0
This function is the one that will prepare the right strings in the display buffer for the iFieldNum field.
The above pointers are filled with Malloc to allocate the right size to the array.
I put 2 sets of strings, the one Requested, that is prepared with the above formatting elements and the one Content
that is filled after the LCD is updated.
This allows sending messages to the LCD only when a char has changed, and reduce the number of useless I2C message.
If we put the time HH:MM::SS, anyway, the update will be at least each second, but if you put only minutes, then the
message will only be sent every minute or if a displayed measure changes.
LCD I2C Controller BV4208
http://www.i2c.byvac.com/downloads/BV4208%20DataSheet.pdf
A set of commands is declared for this driver that is quite simple.
The LCD I2C Driver is also containing a EEPROM, that may be used for preset messages, but also to store your own
params independently of the OpenPicus file system.
Page | 7 9-Feb-12 JMLambert V1.0
We will use the I2CHelper library completed as described above to send long strings.
Note : I am preparing a library for that chip, but as I did not received the LCD from my order, I cannot test it…
This will be in the V2 of the document.
Page | 8 9-Feb-12 JMLambert V1.0
Pachube Setup & use
Pachube is a place to collect Sensor feeds, and allow their presentation in graphs.
Sensor declaration
You need to declare your sensor (Feed) that may contain several datastreams.
The feeds is at the url: /feeds/<feednumber> and you will have some access keys.
API Keys & Access control
You may have generic keys or specifics that have their own restrictions, (for example the key can be used to update only
one datastream, or you may allow only one IP address as origin, as well for getting the data, you have some access
controls.
For example : Here I create a key that would be able to UPDATE only the pressure datastream of the feed 47332
Then the Key provided will be put in the URL of access for the action (PUT/GET/DELETE etc) in the http header field
X-PachubeApiKey:
Page | 9 9-Feb-12 JMLambert V1.0
You may also regenerate the key, if you do not know if your key has been compromised.
The http requests are well documented in the API manual of Pachube here https://pachube.com/docs/
Once you have declared your feed, your datastreams (with an ID that will be used in the API call), and you have got the
key allowed to access the stream, you will need to put them in your program.
Web service format
What is interesting is that you may use several formats to update the streams : JSON, XML or CSV
For easy cases, it if obvious that the CSV is preferred.
The selection of the format is made at the URL level
http://api.pachube.com/v2/feeds/1977/datastreams/1.csv
For CSV the data string will contain one value per line (each line separated by “rn”)
Example : “1,20.5rn2,1013.0rn” means assign 20.5 to the datastream 1 and 1013.0 to datastream 2.
In this project, I construct this string that will be sent to the api.pachube.com url via a PUT request :
sprintf( tmpString,
"PUT %s HTTP/1.1rnHost: %srnAccept: */*rnContent-Type: text/csvrnX-PachubeApiKey:%srnContent-Length:
%drnConnection: closernrn%s", RemoteURL, ServerName, PachubeKey, strlen(buf), buf );
Page | 10 9-Feb-12 JMLambert V1.0
Pachube Graphing
By default, Pachube proposes a graph of all datastream like that :
You may tune the graphic by the parameter button and generate a URL of the result to include in your Flyport webpage.
Your browser will get the URL from the flyport, but will get the display from the Pachube site.
https://api.pachube.com/v2/feeds/47332/datastreams/1.png?width=730&height=250&colour=%23f15a24&duration
=1day&show_axis_labels=true&detailed_grid=true&timezone=UTC
The duration is a parameter that you may manually change or even put a dynamic field inside to change that
dynamically (~my_duration~) to replace the 1day above by a choice you may integrate in your web page. (eg: popup)
Triggers/ Alerts
You may have some triggers on some datastream, to generate alerts in twitter or SMS.
I have tested the SMS alert, but not the tweet.
There are several applications around Pachube that you may explore too.
Interface with Paraimpu
Paraimpu is competitor of Pachube (beta)
I have successfully connected my flyport to Paraimpu, but it is not featuring graphing yet.
So I choosed Pachube for data & graphing, and tried Paraimpu for the tweets management;
Identically to Pachube, you need to declare a sensor in Paraimpu and get a key to use the web service to publish your
sensor data.
There is an OpenPicus sensor template that you may use. This is in fact providing a piece of C code that can be the
starter to make your sensor. The API key is included in the C code, and is not available in the Web Page. I have
requested the change, as this seems not the best choice…
In this project, the Pachube is seen as a sensor itself, and data are gathered from Pachube.
Then I have declared a twitter Actuator with my twitter account.
Page | 11 9-Feb-12 JMLambert V1.0
And the last point is the connection that is making the link between the sensor data and the actuator :
You may have a message going to your actuator depending on the value received on the sensor.
Here I just put a message depending on the temperature.
You may create a message with smart content to have a script interpreted in your flyport for example.
Page | 12 9-Feb-12 JMLambert V1.0
Misc
I used the malloc/free to manage the dynamic memory allocation.
I just added the heap.s file in the project directory to create a heap of 2000bytes.
Then you just need to declare pointers and allocate memory that you assigned to that pointer.
Standard example :
This is quite useful for the http requests of body that do not need to be kept very longtime.

Weitere ähnliche Inhalte

Was ist angesagt?

[Webinar Slides] Programming the Network Dataplane in P4
[Webinar Slides] Programming the Network Dataplane in P4[Webinar Slides] Programming the Network Dataplane in P4
[Webinar Slides] Programming the Network Dataplane in P4
Open Networking Summits
 
Apache Flink Training: DataStream API Part 1 Basic
 Apache Flink Training: DataStream API Part 1 Basic Apache Flink Training: DataStream API Part 1 Basic
Apache Flink Training: DataStream API Part 1 Basic
Flink Forward
 
Maximilian Michels – Google Cloud Dataflow on Top of Apache Flink
Maximilian Michels – Google Cloud Dataflow on Top of Apache FlinkMaximilian Michels – Google Cloud Dataflow on Top of Apache Flink
Maximilian Michels – Google Cloud Dataflow on Top of Apache Flink
Flink Forward
 

Was ist angesagt? (15)

PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummies
 
Apache Flink Stream Processing
Apache Flink Stream ProcessingApache Flink Stream Processing
Apache Flink Stream Processing
 
Continuous SQL with Apache Streaming (FLaNK and FLiP)
Continuous SQL with Apache Streaming (FLaNK and FLiP)Continuous SQL with Apache Streaming (FLaNK and FLiP)
Continuous SQL with Apache Streaming (FLaNK and FLiP)
 
[Webinar Slides] Programming the Network Dataplane in P4
[Webinar Slides] Programming the Network Dataplane in P4[Webinar Slides] Programming the Network Dataplane in P4
[Webinar Slides] Programming the Network Dataplane in P4
 
Networking and Go: An Epic Journey
Networking and Go: An Epic JourneyNetworking and Go: An Epic Journey
Networking and Go: An Epic Journey
 
Openpicus Flyport interfaces the cloud services
Openpicus Flyport interfaces the cloud servicesOpenpicus Flyport interfaces the cloud services
Openpicus Flyport interfaces the cloud services
 
20170925 onos and p4
20170925 onos and p420170925 onos and p4
20170925 onos and p4
 
Apache Flink Training: DataStream API Part 1 Basic
 Apache Flink Training: DataStream API Part 1 Basic Apache Flink Training: DataStream API Part 1 Basic
Apache Flink Training: DataStream API Part 1 Basic
 
How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with
 
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
 
How to Introduce Telemetry Streaming (gNMI) in Your Network with SNMP with Te...
How to Introduce Telemetry Streaming (gNMI) in Your Network with SNMP with Te...How to Introduce Telemetry Streaming (gNMI) in Your Network with SNMP with Te...
How to Introduce Telemetry Streaming (gNMI) in Your Network with SNMP with Te...
 
Maximilian Michels – Google Cloud Dataflow on Top of Apache Flink
Maximilian Michels – Google Cloud Dataflow on Top of Apache FlinkMaximilian Michels – Google Cloud Dataflow on Top of Apache Flink
Maximilian Michels – Google Cloud Dataflow on Top of Apache Flink
 
Programmable data plane at terabit speeds
Programmable data plane at terabit speedsProgrammable data plane at terabit speeds
Programmable data plane at terabit speeds
 
Monitoring Kafka w/ Prometheus
Monitoring Kafka w/ PrometheusMonitoring Kafka w/ Prometheus
Monitoring Kafka w/ Prometheus
 
Networking in java
Networking in javaNetworking in java
Networking in java
 

Ähnlich wie IoT with OpenPicus Flyport

15LLP108_Demo4_LedBlinking.pdf1. Introduction In D.docx
15LLP108_Demo4_LedBlinking.pdf1. Introduction In D.docx15LLP108_Demo4_LedBlinking.pdf1. Introduction In D.docx
15LLP108_Demo4_LedBlinking.pdf1. Introduction In D.docx
felicidaddinwoodie
 
Internet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemInternet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking System
PrasannPatel4
 
Node-RED and getting started on the Internet of Things
Node-RED and getting started on the Internet of ThingsNode-RED and getting started on the Internet of Things
Node-RED and getting started on the Internet of Things
Boris Adryan
 

Ähnlich wie IoT with OpenPicus Flyport (20)

Mobile applications using tcp (1)
Mobile applications using tcp (1)Mobile applications using tcp (1)
Mobile applications using tcp (1)
 
maXbox_Arduino_Pascal_Magazine
maXbox_Arduino_Pascal_MagazinemaXbox_Arduino_Pascal_Magazine
maXbox_Arduino_Pascal_Magazine
 
Node-RED and Minecraft - CamJam September 2015
Node-RED and Minecraft - CamJam September 2015Node-RED and Minecraft - CamJam September 2015
Node-RED and Minecraft - CamJam September 2015
 
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP ProtocolSerial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
 
An introduction to workflow-based programming with Node-RED
An introduction to workflow-based programming with Node-REDAn introduction to workflow-based programming with Node-RED
An introduction to workflow-based programming with Node-RED
 
Maxbox starter18
Maxbox starter18Maxbox starter18
Maxbox starter18
 
Weather data meets ibm cloud. part 3 transformation and aggregation of weat...
Weather data meets ibm cloud. part 3   transformation and aggregation of weat...Weather data meets ibm cloud. part 3   transformation and aggregation of weat...
Weather data meets ibm cloud. part 3 transformation and aggregation of weat...
 
UDP Report
UDP ReportUDP Report
UDP Report
 
ARM Embeded_Firmware.pdf
ARM Embeded_Firmware.pdfARM Embeded_Firmware.pdf
ARM Embeded_Firmware.pdf
 
Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3
 
Sap bpc Planning and consolidation
Sap bpc Planning and consolidationSap bpc Planning and consolidation
Sap bpc Planning and consolidation
 
caQtDM_Argonne.pptx
caQtDM_Argonne.pptxcaQtDM_Argonne.pptx
caQtDM_Argonne.pptx
 
Arduino Teaching Program
Arduino Teaching ProgramArduino Teaching Program
Arduino Teaching Program
 
15LLP108_Demo4_LedBlinking.pdf1. Introduction In D.docx
15LLP108_Demo4_LedBlinking.pdf1. Introduction In D.docx15LLP108_Demo4_LedBlinking.pdf1. Introduction In D.docx
15LLP108_Demo4_LedBlinking.pdf1. Introduction In D.docx
 
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
 
Internet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemInternet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking System
 
opnet lab report
opnet lab reportopnet lab report
opnet lab report
 
NodeJS @ ACS
NodeJS @ ACSNodeJS @ ACS
NodeJS @ ACS
 
Node-RED and getting started on the Internet of Things
Node-RED and getting started on the Internet of ThingsNode-RED and getting started on the Internet of Things
Node-RED and getting started on the Internet of Things
 
Socket Programming by Rajkumar Buyya
Socket Programming by Rajkumar BuyyaSocket Programming by Rajkumar Buyya
Socket Programming by Rajkumar Buyya
 

Mehr von Ionela

openPicus Proto Nest Datasheet
openPicus Proto Nest DatasheetopenPicus Proto Nest Datasheet
openPicus Proto Nest Datasheet
Ionela
 
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
Ionela
 
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-17
Ionela
 
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
Ionela
 
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
Ionela
 
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
Ionela
 
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-08
Ionela
 
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
Ionela
 
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
Ionela
 
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
Ionela
 
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
Ionela
 
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-10
Ionela
 
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-11
Ionela
 

Mehr von 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
 

Kürzlich hochgeladen

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Kürzlich hochgeladen (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

IoT with OpenPicus Flyport

  • 1. Page | 1 9-Feb-12 JMLambert V1.0 IoT with OpenPicus Flyport : Temperature/Pressure with BMP085 I2C LCD setup Use case of Pachube and Paraimpu
  • 2. Page | 2 9-Feb-12 JMLambert V1.0 Introduction After the previous exercise with a Flyport Simulator connected to the web services, I will expose the experience and solution of the following problem : - Acquire Temperature & Pressure of a BMP085 device on a I2C bus - Set the Real Time clock to the web time and use an alarm to acquire regularly the measurements - Send the measurements to some Cloud storage, (I have integrated successfully NimBits, ThingSpeak, Paraimpu and Pachube…) - Display the curves of the measurements on the web page of the Flyport. - Setup a LCD display HD44780 connected to the Flyport with I2C bus, thanks to I2C driver chip that is easy and low cost and need less wires. - Display some values on the local LCD as a “weather station”… As explained above, I tried different Web Services to store the data, and Pachube seems quite good as it allows a very easy graphing out of the data. But Pachube is not able to process the Data and generate alerts (it seems) as easy as with ParaImpu I chose to create a Pachube sensor in Paraimpu, and a connector inside Paraimpu that will tweet a message when an alert is raised. We will see how. I2C Bus & BMP085 acquision programming. I connected the BMP085 directly on the Flyport, as it handles already on board the pullup. I used the few libraries from the OpenPicus Download content : - OP-LIB - i2c Helper rev1.0.zip - LIB - BMP085 temperature sensor_rev1.0.zip After some initial issue on the I2C reading, I fixed the soldering… I just connected the required wires : GND+VCC + I2C Bus : SCL+SDA
  • 3. Page | 3 9-Feb-12 JMLambert V1.0 Web time & RTCC Programming The objective is to get the current time from an external web site (always included in a response), then set the time in the RTCC and create alarms from the RTC at regular interval to perform the acquisition and sensor data transmission to the storage (not too often) Get the time from a web site header : www.google.com In aim to get the time, the simpler is to make a POST request to a site, and analyses the header response. Then you extract the fields and use them to initialize the RTCC.
  • 4. Page | 4 9-Feb-12 JMLambert V1.0 Then, the time will be set in the RTCC and next steps :
  • 5. Page | 5 9-Feb-12 JMLambert V1.0 I2C Bus & LCD HD44780 I used also the I2CHelper library as above, but I needed to create a new function : New function : I2CSendString() To handle the LCD, I added a new function in complement to the I2CHelper : I2cSendString() This function is necessary to send messages to the I2C LCD and handles the split of messages within the max size of the I2C buffer (generally 32, but it is a parameter) LCD Display organization In aim to put some flexibility in the way to create and eventually change the content of the display dynamically, I have gone through some descriptions data.
  • 6. Page | 6 9-Feb-12 JMLambert V1.0 This function is the one that will prepare the right strings in the display buffer for the iFieldNum field. The above pointers are filled with Malloc to allocate the right size to the array. I put 2 sets of strings, the one Requested, that is prepared with the above formatting elements and the one Content that is filled after the LCD is updated. This allows sending messages to the LCD only when a char has changed, and reduce the number of useless I2C message. If we put the time HH:MM::SS, anyway, the update will be at least each second, but if you put only minutes, then the message will only be sent every minute or if a displayed measure changes. LCD I2C Controller BV4208 http://www.i2c.byvac.com/downloads/BV4208%20DataSheet.pdf A set of commands is declared for this driver that is quite simple. The LCD I2C Driver is also containing a EEPROM, that may be used for preset messages, but also to store your own params independently of the OpenPicus file system.
  • 7. Page | 7 9-Feb-12 JMLambert V1.0 We will use the I2CHelper library completed as described above to send long strings. Note : I am preparing a library for that chip, but as I did not received the LCD from my order, I cannot test it… This will be in the V2 of the document.
  • 8. Page | 8 9-Feb-12 JMLambert V1.0 Pachube Setup & use Pachube is a place to collect Sensor feeds, and allow their presentation in graphs. Sensor declaration You need to declare your sensor (Feed) that may contain several datastreams. The feeds is at the url: /feeds/<feednumber> and you will have some access keys. API Keys & Access control You may have generic keys or specifics that have their own restrictions, (for example the key can be used to update only one datastream, or you may allow only one IP address as origin, as well for getting the data, you have some access controls. For example : Here I create a key that would be able to UPDATE only the pressure datastream of the feed 47332 Then the Key provided will be put in the URL of access for the action (PUT/GET/DELETE etc) in the http header field X-PachubeApiKey:
  • 9. Page | 9 9-Feb-12 JMLambert V1.0 You may also regenerate the key, if you do not know if your key has been compromised. The http requests are well documented in the API manual of Pachube here https://pachube.com/docs/ Once you have declared your feed, your datastreams (with an ID that will be used in the API call), and you have got the key allowed to access the stream, you will need to put them in your program. Web service format What is interesting is that you may use several formats to update the streams : JSON, XML or CSV For easy cases, it if obvious that the CSV is preferred. The selection of the format is made at the URL level http://api.pachube.com/v2/feeds/1977/datastreams/1.csv For CSV the data string will contain one value per line (each line separated by “rn”) Example : “1,20.5rn2,1013.0rn” means assign 20.5 to the datastream 1 and 1013.0 to datastream 2. In this project, I construct this string that will be sent to the api.pachube.com url via a PUT request : sprintf( tmpString, "PUT %s HTTP/1.1rnHost: %srnAccept: */*rnContent-Type: text/csvrnX-PachubeApiKey:%srnContent-Length: %drnConnection: closernrn%s", RemoteURL, ServerName, PachubeKey, strlen(buf), buf );
  • 10. Page | 10 9-Feb-12 JMLambert V1.0 Pachube Graphing By default, Pachube proposes a graph of all datastream like that : You may tune the graphic by the parameter button and generate a URL of the result to include in your Flyport webpage. Your browser will get the URL from the flyport, but will get the display from the Pachube site. https://api.pachube.com/v2/feeds/47332/datastreams/1.png?width=730&height=250&colour=%23f15a24&duration =1day&show_axis_labels=true&detailed_grid=true&timezone=UTC The duration is a parameter that you may manually change or even put a dynamic field inside to change that dynamically (~my_duration~) to replace the 1day above by a choice you may integrate in your web page. (eg: popup) Triggers/ Alerts You may have some triggers on some datastream, to generate alerts in twitter or SMS. I have tested the SMS alert, but not the tweet. There are several applications around Pachube that you may explore too. Interface with Paraimpu Paraimpu is competitor of Pachube (beta) I have successfully connected my flyport to Paraimpu, but it is not featuring graphing yet. So I choosed Pachube for data & graphing, and tried Paraimpu for the tweets management; Identically to Pachube, you need to declare a sensor in Paraimpu and get a key to use the web service to publish your sensor data. There is an OpenPicus sensor template that you may use. This is in fact providing a piece of C code that can be the starter to make your sensor. The API key is included in the C code, and is not available in the Web Page. I have requested the change, as this seems not the best choice… In this project, the Pachube is seen as a sensor itself, and data are gathered from Pachube. Then I have declared a twitter Actuator with my twitter account.
  • 11. Page | 11 9-Feb-12 JMLambert V1.0 And the last point is the connection that is making the link between the sensor data and the actuator : You may have a message going to your actuator depending on the value received on the sensor. Here I just put a message depending on the temperature. You may create a message with smart content to have a script interpreted in your flyport for example.
  • 12. Page | 12 9-Feb-12 JMLambert V1.0 Misc I used the malloc/free to manage the dynamic memory allocation. I just added the heap.s file in the project directory to create a heap of 2000bytes. Then you just need to declare pointers and allocate memory that you assigned to that pointer. Standard example : This is quite useful for the http requests of body that do not need to be kept very longtime.