News note, first published July 14, 2011.
openPICUS is an open source wireless platform that uses Wi-Fi and FreeRTOS to connect things to the web. The team behind openPICUS has released some new applications. One new feature is hibernation mode, for lower energy use in battery-powered applications. The other new feature is integration with ThingSpeak.
All you have to do is download the ThingSpeak.com library from openPICUS and use it with your FlyPort Wi-Fi device. Now you can use sensors connected to ThingSpeak for data logging, visualizations, and access to all of the ThingSpeak apps, such as ThingTweet and ThingHTTP.
Here's the video:
What this was, in plain words
FlyPort was a small programmable Wi-Fi module from the openPICUS project, built around a Microchip PIC24F microcontroller. You wrote your application in C, loaded it over a serial bootloader, and the module joined your Wi-Fi network. The two July 2011 additions made it much more practical for sensors:
- Hibernation: the Wi-Fi radio can be switched off and on with one instruction, without resetting the microcontroller, so a battery-powered sensor only pays for the radio when it has something to send.
- ThingSpeak: a ready-made library to post readings to the ThingSpeak cloud service, which stores them and draws charts, so you do not need to run your own server or database.
The video above, "Temperature/Humidity data logger w/ ThingSpeak", shows the result: a sensor on a FlyPort sending readings that appear as live charts.
Why it mattered
In 2011, getting a sensor reading onto a web chart meant three separate jobs: the embedded firmware, a server to receive the data, and a web page to plot it. A Wi-Fi module with a cloud library collapses the last two into a free account.
Deep dive: the numbers and details
This part holds the details from the openPICUS announcement, how a ThingSpeak update works, and the duty-cycle arithmetic behind hibernation. Skip it if the overview is all you need.
What the openPICUS announcement said
The openPICUS blog post of July 12, 2011 (archived copy) gave these details:
- Hibernation works through FreeRTOS, the core of the openPICUS framework. One instruction turns the Wi-Fi transceiver off or on without resetting the PIC24F core.
- The module enters hibernation immediately, and the programmer can also put the microcontroller to sleep.
- The system resumes from the onboard real-time clock (RTC) or an external trigger event.
- FlyPort has more than 20 remappable I/O pins for sensors.
- The ThingSpeak library was written by a community member, an electronic engineering student in Rome, and shared through the openPICUS download section.
- No separate programmer is needed, because FlyPort has a serial bootloader flashed on board.
The archived openPICUS downloads page from August 2011 lists the free openPICUS IDE 2.0 for Windows, Microchip's C30 compiler (3.24 Lite version), the FlyPort API user manual and sample applications such as a Wi-Fi web server and a Sensirion SHT-7X temperature and humidity monitor.
How a ThingSpeak update works
ThingSpeak still runs, now operated by MathWorks. A device sends one HTTP request per reading. According to the current ThingSpeak Write Data API documentation:
POST https://api.thingspeak.com/update
api_key=<channel write key>&field1=23.5&field2=61
- A channel has up to eight data fields, field1 to field8, plus optional latitude, longitude, elevation and status.
- A successful update returns HTTP 200 and the new entry number; a failed update returns 0.
- Every entry needs a unique timestamp.
Worked example: why switching the radio off matters
Battery life for a duty-cycled sensor follows from the average current:
I_avg = (I_active x t_active + I_sleep x t_sleep) / (t_active + t_sleep)
Battery life (hours) = battery capacity (mAh) / I_avg (mA)
As an illustration only (these are assumed round numbers, not FlyPort measurements): suppose the module draws 100 mA for 2 seconds while it wakes, joins the network and posts a reading, and 0.1 mA while hibernating, with one reading every 5 minutes (300 seconds).
I_avg = (100 x 2 + 0.1 x 298) / 300 = (200 + 29.8) / 300 = about 0.77 mA
With a 2,000 mAh battery: 2,000 / 0.77 = about 2,600 hours, roughly 108 days
Radio left on at 100 mA: 2,000 / 100 = 20 hours
The ratio, not the exact figures, is the point: the radio's on-time dominates the energy budget, so a mode that turns it off between readings decides whether a Wi-Fi sensor can run on batteries at all.
Common mistakes with duty-cycled Wi-Fi sensors
- Forgetting the cost of reconnecting. Joining a Wi-Fi network after waking takes time and current; posting too often can erase the savings.
- Leaving sensors and regulators powered during sleep, so the sleep current is far higher than the module's own figure.
- Reusing a timestamp. ThingSpeak rejects an entry whose timestamp already exists in the channel.


Very nice,thanks for this.
ReplyDeleteYou should also try this:
http://is.gd/HAMgDQ
Very good article I liked it very much
ReplyDeleteThanks
Also view for my site
http://projectus.freehost7.com
Complete Projects are here
Openpicus is a huge platform for wi-fi apps. It's very useful.
ReplyDeleteTry this for free