Smart Fire Sprinkler

March - June 2022

Introduction

This was my undergraduate capstone project and it is one of my favorite projects as it was the first time I worked on a team of engineers to conceptualize, design, and implement a full product. I worked with a team of nine engineers, constituted of six mechanical engineers and three electrical engineers including myself.

We chose a to make a ceiling-mounted smart fire sprinkler that would identify a fire, aim a nozzle at the location, and extinguish it with water. This idea came about as a response to conventional fire sprinklers indiscriminately spraying water until manually shut off, potentially resulting in huge water damage costs. For example, in the event that a small fire ignites in a server room, the sprinkler would douse everything in hundreds of gallons of water, successfully putting out the fire, but also causing all valuable data on the server to be lost. This was the basis of our project motivation.

Team Selfie!

My Role

My role was the Software Lead of the project. I was in charge of designing and implementing the code for accurate fire detection and nozzle aiming. However, given the intertwined relationship of software and hardware, I contributed in making hardware decisions as well.

The prototype system uses a Raspberry Pi Zero W as the main processor, a camera, an IR sensor, a servo-controlled 2 DOF gimbal mechanism, and a solenoid valve to target and extinguish fires.

Data Flowchart:

Fire Detection:

I designed the system around two checks in order to determine if a fire was present within the camera frame: a visual check, and then an IR check. At first, I trained a Haar Cascade model with 200 images of fires, but had poor results in accurately detecting fires. Then, I considered a more robust model using a CNN, but given the hardware limitations of a Raspberry Pi Zero W, I decided against it and proceeded with a traditional computer vision method.

Using a combination of pixel isolation, contour detection, and dilation, I was able to accurately isolate fires from a visual perspective at a 98% accuracy across ~200 images. This accuracy was measured using the Mean Average Precision (mAP) method with an IoU > 0.5. Although relatively accurate, a 98% accuracy is still not high enough as this could result in false positives (spraying non-fire objects), not to mention the relatively small sample size of ~200 images.

As such, I introduced the idea of an IR sensor attached to the nozzle to add redundancy to the system. When the visual algorithm detected what it deemed was a fire, this nozzle would target the presumed fire and the IR sensor would then read the IR radiation intensity at that region. If beyond a certain threshold, a fire would be confirmed to be at that location. If not, the system would return back to idle, preventing false positives. I also accounted for typical sources of IR radiation (i.e. remote controls), and required a constant stream of IR radiation for 3 seconds in order to trigger the confirmation on the IR sensor, as a remote control uses a short pulse of IR to communicate.

Fire Detection - What the Camera Sees:

video-1b479371-fca2-41c9-a3af-1387e57d51c1-1662508007 (1).mp4

Control Algorithm:

The control algorithm worked in conjunction with the fire detection algorithm. Once a fire was visually detected, the fire detection algorithm would send the pixel coordinates of the center of the fire's bounding box. The pixel coordinates would then be converted into PWM signals to send to the two servos to actuate and rotate the nozzle accurately. Once aimed at the presumed fire's position, the IR sensor would be read to confirm if a fire is present at that location. If confirmed, the solenoid valve would be actuated to start the flow of water and the nozzle would then begin a sweeping motion in the shape of a Z within the bounding box in order to ensure the fire was extinguished.

Control Algorithm - Gimbal Mechanism

video-72de7ff7-0b9d-4ed6-97a1-57d0b7c566c0-1662508692.mp4

Final Result

After approximately three months of hard work, our team led a showcase of the final product and it worked phenomenally. Unfortunately, we were not allowed to set objects on fire despite our confidence in the system, so we opted to instead show images of fires, and then simulate the IR radiation of a real fire using a small lighter. I wish we had more time to create a beautiful chassis, but given budget and time constraints, we opted to secure things to an acrylic board for our prototype.

Demo Day:

177893559-98bff813-416a-4662-b5bf-f5625fd59094.mp4

Prototype:

Concept CAD:

GitHub Repository

If you are interested in seeing the code or more photos/videos of the project, please see my repository on Github at this link!