Table of Contents

Fire Alarm

Author: Cosmin-Răzvan Vancea (SAS1)

Introduction

Overview

Initial Setup/Configuration Mode

If the flash memory is empty or the user holds down the SETUP button while FireAlarm is starting up, then the device will switch to the configuration mode:

REST APIs implemented on the microcontroller:

Hardware Design

Components

Electronic Schematics

Software Design

General Information

The project is comprised of three main software components:

  1. ESP32 Software: communicates with the sensors and sends the measurements to the remote server;
  2. Remote Server: processes and stores the measurements; notifies the registered devices; provides a web interface for visualizing the data;
  3. Android Companion App: consumes the configuration API and provides a human interface for setting up the FireAlarm device; can also be used to visualize the data sent to the remote server.

We will only focus on the microcontroller software.

ESP32 Software

The code is split into multiple “modules”:

3rd-party Libraries

Moreover, the following 3rd-party libraries are used:

Interrupts

During a network operation, the device might appear unresponsive due to the main loop() being busy processing the network request. In order to increase the responsiveness of the FireAlarm device, interrupts are being used: each time a sensor value changes, an interrupt is raised. The interrupt handler marks the event for further processing in the main loop and changes the state of the buzzer (on/off) so that the alarm appears to be responsive to the nearby people.

Server

The server software is written in Flask. It is basically a web server that:

The alarm notification is served though PushBullet. For the notification mechanism to actually work, the user must associate a PushBullet token to their FireAlarm GUID. This operation can be done though the web interface.

Android Companion App

Written in Java. It is basically a client that consumes both the API provided by the ESP32 (when in configuration mode) and the API provided by the remote web server.

The app provides a step-by-step tutorial on how to configure the FireAlarm. After the configuration is done, the app stores locally the assigned GUID of the FIreAlarm device so that the users are not needed to remember the GUID themselves.

Results

FireAlarm Prototype

fire-alarm-photo.jpg fire-alarm-photo-2.jpg

Web Interface

Android Companion App

fire-alarm-android-startup.jpg fire-alarm-android-config.jpg fire-alarm-android-interface.jpg

Videos

Conclusion

It was a challenging and productive experience because I had to approach the project from three different perspectives: a local system that collects data from sensors; a remote system that receives and processes measurements from multiple devices; and a hybrid system that must communicate to both the local system (through a local network/“Hotspot”) and to the remote system (through the Internet).

Download

Resources

Export to PDF