Repurposing Old Smartphones for Home Automation – Linux.com (blog)
At the recent Embedded Linux Conference and OpenIoT Summit, Mozilla Technical Evangelist Dietrich Ayala proposed a simple and affordable solution to home automation: A discarded smartphone can handle some of the most useful home automation tasks without requiring expensive hubs and sensors — or risking data security in the cloud.
“With a smartphone you can detect motion, sound, presence, and the absence of radio services,” said Ayala in his presentation, “Turning Sensors into Signals: Humanizing IoT with Old Smartphones and the Web.”
“Many phones have proximity or ambient light sensors, orientation, and battery,” continued Ayala. “Consumer devices have almost none of these. My phone knows if it’s being moved around, but my Nest doesn’t.”
Ayala had also been contemplating the shortcomings of the first generation of home automation. “Devices aren’t actually connected today,” said Ayala. “You have to buy into a particular network of devices, and they’re not cheap. Then there are end of life issues, as with Revolv.”
Most commercial IoT products include cloud services for remote connectivity, storage, and in some cases, processing. “How much of your personal life is being exposed to a black box where you have no guarantee or visibility?” said Ayala. “There are no standards, legislation, or case law around what people can do with this data.”
Many hacker-oriented automation products avoid using the cloud, but at the price of greater complexity. You get more privacy and open source personalization, “but at a high cost in experimentation in time and learning,” said Ayala.
IoT’s Killer App: Presence or Absence
A greater challenge affecting commercial and DIY IoT systems alike is the lack of a compelling purpose. “You have to ask yourself, what problems am I addressing?” said Ayala. “Do I really need to have the light reflect my mood or do automated shopping? To me these aren’t solving day to day problems. People have problems like not having enough money or time, or worrying about sick relatives. Maybe they need to know if someone is in their house or whether basic services are working. What you need is physical awareness put in context — the presence or absence of things like noise, motion, or services.”
Most of these capabilities, Ayala realized, are already available on a smartphone even without hooking up additional sensors. You could even repurpose several old phones in a WiFi- or Bluetooth-based sensor network.
Notifications are currently sent to IFTTT’s maker channel. “From there, I can hook it up to wherever I want,” said Ayala.
Much of the functionality of Ayala’s Firefox OS script can work on other platforms. It would be fairly straightforward to do something similar in a mobile framework, or for more experienced developers, even a native app, Ayala said.
Ayala spent a lot of time studying the readouts from sensors, as well as from the phone’s microphone, camera, and, radios, that would enable a remote user to draw conclusions about what was happening at home. This contextual information could then be codified into more useful notifications.
With ambient light, for example, if it suddenly goes dark in the daytime, maybe someone is standing over a device, explained Ayala. Feedback from the accelerometer can be analyzed to determine the difference between footsteps, an earthquake, or someone picking up the device. Scripts can use radio APIs to determine if a person moving around is carrying a phone with a potentially revealing Bluetooth signature.
With the battery API, you can usually tell if the power went out. If the phone has some battery life and an SMS plan, you can have it send a text message alert.
When sensors hit certain levels, you can have the script use a media API to turn on a camera or mic to see what’s up. In one experiment, Ayala used the getUserMedia API to turn on the mic and record the average volume of ambient sound. “There are some signatures you can get from sound that might yield useful information around presence or absence,” he said.
Future enhancements might tap a mobile platform’s connectivity and discovery interfaces to hook up with other devices. On Firefox OS, these include TCP and UDP sockets, DLNA, and others. Ayala also sees possibilities using local speech recognition APIs.
“In the end, it’s about using the phone as an awareness tool,” said Ayala. “About learning about the environment and yourself.”
Watch the complete presentation below: