Tag Archive: Java

Wake: A Sleepy Hotspot

This application for Android phones could several hundred capital dollars at each installation it’s used.

SWEETLab (Sustainable Water, Energy and Environmental Technologies Laboratory) at Portland State University needed a cheaper method to upload data from sensors on hand washing stations, latrines and cook stoves. The tools are deployed in Indonesia and other locations that usually don’t have electricity.

To measure usage, inexpensive sensors on the purification equipment collect data for upload across the internet. Previously, several sensors would wake up at a configured time, along with a GSM modem and wireless router, and send the data for the past 24 hours to a server in Portland. It worked, but this configuration costs about $450. Using an Android phone instead cuts the upfront cost to $180. Data charges to the SIM card in both cases are the same. One would assume the equipment cost can be lowered still as hotspot support comes to cheaper Android devices.

The Wake app is real simple. It keeps the device in airplane mode until the set time, then turns on for a few minutes to be a hotspot for all nearby sensor. This happens each day with the wakeup time and awake duration being configurable. The app uses an undocumented call to the Android wifi API to enable/disable hotspot mode. It also turns itself on at boot and which makes the device into somewhat of a one-trick pony.

Wake forces the device into airplane mode whenever it does not need internet access. We also turn off all notifications. and uninstall any apps that power up the phone up automatically. All this drastically reduces power consumption. The engineers at Stevens Water Monitoring Systems, maker of the wifi-enabled sensors, measured sleeping consumption at 900 mA on our Samsung test device. Using a larger battery or solar charger will support the periodic internet link for many days or indefinitely.

The video below gives an overview of the great work at SWEETLab in more detail. The team at Stevens supports a large variety of water monitoring systems in agriculture, water treatment and other applications.

youtube=http://www.youtube.com/watch?v=wZSwuRuWQMQ

Apps that use undocumented features possibly unsupported in future releases of Android, or that assert themselves at boot are frowned upon in app stores. Therefore Wake is made available only through Github along with source code. We’re contemplating addition of a feature to allow the Android phone synchronize the clocks of all sensors. Please feel free to offer suggestions for similar or additional functionality in embedded Android apps. There could be many other metrology and control use cases.

Object Recognition SDK

Object recognition on mobile phones is typically done by uploading a picture to a server for recognition while the user waits. This project took recognition algorithms and the image database and put them on device. Applications using the SDK will include games, educational tools and real world browsers.

The performance is impressive. With 1000 images in a database, the typical Android device can make a recognition in about 0.25 seconds. Images can be recognized at a sharp angle or even with the device held upside down. Partially hidden objects are also be recognized. To generate their own database, users can also add their own images from the camera phone.

The starting point for the SDK was some experimental C code for database creation and recognition. It needed to be refactored and made into a native Android library using the Android Native Development Kit (NDK). That library is called by both a PC-based database creation program and by a reference application that SDK users will use as jumping-off point for their own projects.

The SDK is available for educational use and may be released later for commercial development.

Respond to Disaster

I wrote a native Android application called Respond after the Haitian earthquake. When the earthquake hit, you might recall there was a tipping point reached in mobile giving via short-codes. The $10m given was 10 times the previous record. From this, we saw a need for people to have a discoverable app in the stores that pointed them to ways to contribute to relief and get informed in times of crisis without the wait for app store approval. The app content can be instantly updated, as it was after the disaster this year in Japan.

Looking back, this app could have been written with a framework like Sencha Touch on top of PhoneGap, but it was worth a little extra time to dive into Java.