Software apps and online services
Safety is our top priority. In the United States, every commercial office building is equipped with smoke detectors, fire alarms, and sprinklers. When the fire alarm sounds, building tenants are expected to evacuate the building immediately; in case of a severe weather condition such as tornado, the fire alarm system would instead instruct building tenants to "shelter in place" by heading to the basement.
From time to time, some people would fail to evacuate the building or go to the shelter-in-place location. Reasons include:
- Wheelchair of a mobility impaired personnel malfunctions.
- Medical emergency causes a person to lose consciousness.
- Someone believes the alarm is "just another drill", and stays in the office to finish that phone call.
Firefighters are trained to "clear" the building. They will enter every room and confirm nobody is inside. However, this process usually takes 5~10 minutes, during which the condition could worsen for those who stuck inside.
Technology can help. With my design, a sensor in each room reports whether there are people inside, and firefighters can use this information to prioritize entering these rooms.
This screen illustrates what a firefighter might see from the system. There are three rooms, but the sensor reading indicates that room 1 is more likely to have people inside, so that firefighters should enter room 1 first.
My design uses a D6T sensor to detect presence of people. D6T is a MEMS thermal sensor. D6T can "see" the area in front of it as a 4x4 grid of 16 pixels, and measure the temperature of each pixel. D6T also has a reference temperature sensor inside the sensor itself. Since human body has a higher temperature than the ambient temperature, when some pixels have a higher temperature reading than the reference temperature, it suggests a human body may be present.
Many existing applications, such as burglar alarms, use PIR sensor to detect presence of people. Compare to PIR, D6T has a unique advantage: D6T is able to detect stationary personnel, while PIR can only detect movement. This property is important in building evacuation application, because those who fail to evacuate the building may not be moving.
The device consists of an Azure Sphere MT3620 board and a D6T sensor. D6T is a I2C sensor device using 5V power supply and logic levels; as I tested, it does not work properly on 3.3V. Therefore, a level shifter is required to connect SDA and SCL lines between Azure Sphere's mikro BUS 1 and the D6T sensor.
To facilitate testing, I also connected an ESP8266 loaded with "WiFiTelnetToSerial" example firmware to serial lines on Azure Sphere's mikro BUS 2, so that I'm able to read debug messages wirelessly via telnet.
On software side, I tried Visual Studio for a while but decided that PlatformIO is a better choice because it provides higher level API, allowing me to focus more on business logic than low level details. The program logic is simple:
- Connect to Azure IoT Central.
- Read D6T sensor, count how many pixels are "hot" (have higher temperature than the reference temperature), and report that to Azure IoT Central.
During software development, I have to build Arduino libraries for Azure IoT Central connectivity and for reading D6T sensor.
Azure Sphere can connect to either Azure IoT HUB or Azure IoT Central. I flipped a coin and decided on using Azure IoT Central.
Setup procedure on Azure IoT Central includes:
- Enable billing on "pay as you go" plan, and create Azure IoT Central.
- Create a Device Template named "evacuation".
- Create a Telemetry named "hot", with minimum 0, maximum 16, and 0 decimal places.
- Create a Device "room 1" using the template.
- Generate a connection string for the device, and program it into the device.
- Create a Dashboard, use Last Known Value element to display number of hot points from each sensor.
After these setup and with the sensor connected, we can see the sensor reading from the dashboard:
When a building evacuation becomes necessary, firefighters can open the dashboard to see which rooms have non-zero readings. A non-zero reading indicates that a person is likely inside that room, so that they can prioritize visiting that room.
Azure IoT Central costs $2 per device and $5 for every one million messages, with a free tier of 5 devices and 50000 messages per device. To stay within the free tier, the sensor can only send one reading every 52 seconds, which is insufficient for a safety application where every second counts. Currently, my program sends one reading every second. The operational cost for a building with 100 rooms would be $1461 per month, which is modest if it can save one life and avoid a lawsuit.
Cost reduction is possible in two ways:
- Slightly reduce sending interval. Sending one reading every 5 seconds would reduce operational cost of 100 rooms to $449 per month.
- On demand report. Instead of sending sensor readings periodically, the sensor could stay connected, but start sending D6T readings only after receiving a signal that indicates an evacuation is in progress. This would further reduce cost to $190 per month (base cost of connecting 100 devices). However, this approach requires integration with the fire alarm system, which can have regulatory obstacles.
I tested the system in my apartment. I found the D6T effective in detecting my presence, but only if the lights are on. If the room is completely dark, D6T cannot see me. Therefore, this solution is useful for a commercial building where office lights are turned on when the room is occupied, but is ineffective for a residential building where residents may turn off their light when sleeping.
False positive can occur if I place a cup of hot tea in front of the D6T sensor. However, this would not be a major concern in a real deployment: when the sensor is mounted on the wall, the hot tea cup can trigger only one pixel. Firefighters can respond to rooms with higher number of hot pixels first, as a higher number suggests highly probability of having a person there.
For safety reasons, I'm unable to test the system's effectiveness when the building is actually on fire.
I developed a sensor device to assist during building evacuations. It can tell firefighters which rooms are likely to still have people inside, allowing them to prioritize entering these rooms while they clear the building.