Anatomy of an IoT public safety application

At a recent SmartAmerica Challenge, a group of government and industry technologists sat down to what they thought was a discussion on IT infrastructure. But they were soon brainstorming about a much more palpable goal: how to build a sensor system designed to transmit safety alerts in public housing complexes.

Making the system work required development and integration on three major fronts: applications, sensors and networks, according to its architects. The team built the back end of SCALE primarily with open-source software.

The software

At the heart of the system is Data In Motion Exchange (DIME), software developed by John Cohn, an IBM fellow and chief scientist for computer-aided design, and Charles Fracchia, a colleague from MIT, to serve as a data hub.

“There are things like Data.gov, but all of that data is data at rest,” said Cohn. “What we’re trying to support with DIME is the same thing, but with data in motion.”

The type of data in motion that DIME is designed to handle is sensor data – data from motion detectors, smoke detectors and other sensors. DIME relies on MQTT – an open-source, publish-subscribe messaging protocol originally developed by IBM for satellite telemetry – for directing data from sensors to the data hub. Using MQTT, a programmer can name the data and attach a data payload. The data is then encoded in JSON, the standard mobile data format, for transmission to clients.

According to Cohn, one of the best things about MQTT is that since it is open source, anyone can program it to access and analyze the data. “Anyone can come in and do that, long after you deploy the software,” he said. “I don’t have to change the code every time I change a feature or add a new device.”

For the purposes of the SCALE project, the team created two programs for data handling. One team generated a Python script for analyzing the data, which was capable of addressing queries such as, “Is there smoke in apartment 3G? Or did grandma fall?” said Cohn. “The analytics piece looks at data in the data hub to make that determination. And if there is an event, it publishes it back into the data hub.”

At that point, a JavaScript dashboard takes over, employing rules generated by users to act on the data and generate alerts to designated recipients. The team turned to Twilio to handle the routing of such messages.

The sensors

Prototype sensor boxes that were placed in apartments, developed primarily by a team at the University of California at Irvine, are only a little smaller than a toaster. But they carry a lot of hardware, including processing power from a Raspberry Pi board and a SheevaPlug computer and three network interfaces: a Wi-Fi dongle, a SigFox radio adapter and an Ethernet interface.

The boxes pack five separate sensors: an explosive gas sensor, a light sensor, a passive infrared sensor, an accelerometer and a temperature sensor.

“The sensor box isn’t transmitting location or personal information,” said Dan Hoffman, chief innovation officer of Montgomery County. “It is just transmitting its registration number and the event being sent. It’s only when it is paired up in the cloud service that it actually links that bit of data with who should be notified and any rules around notification.”

The network

As deployed for the SmartAmerica Challenge, sensor data could be routed to servers via either a mesh network or SigFox’s ultra-narrow-band network.

“Mesh networks are for some of the more data-rich types of things that we are trying to send,” said Hoffman. “We can use a mesh network to gather data and information within the building. But it is still dependent on electricity and Internet connectivity. So we were trying to build a hybrid where the building itself has a mesh network array of sensors that all connect to a gateway or ultra-narrow-band hub.”

Future iterations of SCALE, for example, may use body sensors to collect physiological information such as EKG data or glucose levels. “That kind of stuff is not really great for ultra-narrow-band, but you could aggregate a lot of that data and send back just a bare minimum over the ultra-narrow band,” Hoffman said.

There are several advantages to designing SCALE to use an ultra-narrow-band network. “It’s very cheap,” noted Luke D’Arcy, director of SigFox’s U.S. operations. “And the power consumption is much lower than broadband.”

In fact, said D’Arcy, power requirements of a ultra-narrow-band transmitter are so small that a smoke detector equipped with a transmitter and a couple of AA batteries can last for years. And it has a much bigger range than Wi-Fi. According to D’Arcy, a SigFox ultra-narrow-band base station can cover a 10-mile range, even in urban areas. “It’s not unusual for devices to connect to our base stations even up to 50 or 60 miles away,” he added.

The downside of ultra-narrow-band? D’Arcy is quick to acknowledge that it can’t carry a lot of data. “It’s narrow band,” he said. “The devices can send or receive short messages of 12 bytes long.” That’s sufficient for relaying sensor data but not, he noted, for streaming movies.