Skip to main content
Version: ACS CC

Fire Prevention & Alarm System

Prevent wildfires by measuring relevant data and notifying authorities

info

Author: Răzvan-Ștefan Costea
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-RazvanDire

Description

A system that takes periodic measurements of atmospheric pressure, temperature, humidity and light intensity levels. When a certain combination of parameters is reached, based on accepted scientific research, local authorities are notified and an alarm is started.

The system is intended to be used in areas that are arid and/or prone to wildfires. As such, the system runs on batteries and has a GPS module, so it can be located.

  • two different sensors take the measurements
  • the latest measurements are displayed on an LCD screen for passersby
  • the Wi-Fi module allows the system to broadcast its coordinates, provided by the GPS module
  • the audible-visual alarm is provided by a buzzer and flashing LEDs

Motivation

One of the biggest environmental threats that the modern world faces is global warming. The increase in temperatures and decrease in rainfall that result can cause massive wildfires, as we saw in California in January 2025. These wildfires destroy natural habitats and endanger thousands, which only exacerbates the problem further. The goal of my project is to identify conditions that might lead to wildfires and take preventive action, so we stop them before they happen. Furthermore, all the money and effort that would've gone towards putting out those fires and relocating people can be used to "cure" the root problem, global warming, instead of just "treating the symptoms".

Architecture

block

Log

Week 5 - 11 May

During the first week, I soldered the pins for all my components during the lab session. After that, I placed both Picos on the breadboard and managed to connect them by following the instructions in the datasheet.

I also connected one of the LEDs and the BME280 sensor and managed to get readings from it.

Week 12 - 18 May

In the second week, I connected the buzzer and activated it and the LED only when the temperature reached above a certain threshold. I also connected the TSL2561 sensor and wrote the code for it, getting readings.

After that, I configured the GPS module and had to do a lot of outdoors trips in order to get my location by sattelite.

Week 19 - 25 May

During the final week, I connected the LCD screen to the main circuit (it has no I2C, so I had to use the data lines directly) and managed to print text on it.

I added another LED an reconfigured a lot of my code in order to make the LEDs flash alternatively and the buzzer play an alarm only when certain parameters are reached and stop when within normal ranges.

Lastly, I used the Wi-Fi module of the Pico to host an endpoint to which I can connect to request sensor readings. The GPS coordinates are also sent on that connection when dangerous levels are reached.

Hardware

  1. Raspberry Pi Pico 2W:
  • the microcontroller
  • reads data from the sensors and activates the buzzer and the LEDs when certain parameters are reached
  • sends the measurements to the LCD screen and the coordinates from the GPS via Wi-Fi
  1. BME280:
  • pressure, temperature and humidity sensor
  • takes periodic measurements and sends the data to the MCU
  1. TSL2561:
  • light intensity sensor
  • measures visible and infrared light intensity
  • takes periodic measurements and sends the data to the MCU
  1. GY-NEO6MV2:
  • GPS module
  • provides the GPS coordinates of the system
  1. LCD screen:
  • displays the data measured by the sensors for passersby
  1. Buzzer & LEDs:
  • the audible-visual alarm: when certain parameters are reached, the alarm is triggered

plot1 plot2 plot3 plot4

The first two photos showcase the main circuit: both Picos on the breadboard, connected accordingly, the BME280 and TSL2561 sensors, the GPS module, the LCD screen, the buzzer and the two LEDs. The last two pictures represent an earlier version of the project.

The video presents the current functionality of the project:

  • the MCU constantly reads readings from both sensors and GPS module
  • readings are displayed on the LCD screen
  • when the temperature is above 26 °C, an alarm is started
  • the alarm consists of a buzzer and LEDs that flash alternatively

Schematics

kicad

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2WThe microcontroller and debugger39.66 RON × 2
BME280Pressure, temperature and humidity sensor73.99 RON
TSL2561Light intensity sensor22.99 RON
GY-NEO6MV2GPS Module44.95 RON
PotentiometerControl the contrast of the characters on the LCD screen1.49 RON
BreadboardConnect all the components9.98 RON
LCD screenDisplay the sensors' measurements16.34 RON
BuzzerAudio alarm1.40 RON
LEDVisual alarm0.39 RON × 2
Pin headerConnect components to the breadboard0.99 RON × 3
Battery holderPower the circuit3.95 RON
Total-258.16 RON

Software

The flow of the code is as follows:

  1. The main task:
  • sets up the network endpoint
  • spawns the GPS, sensor, LED and buzzer tasks
  • waits for connections from peers and for data from the sensors
  • sends measurements to peers and the coordinates when there are dangerous levels
  • updates the measurements with the data from the sensors, prints them to the screen and signals the LEDS and the buzzer when dangerous levels are reached
  1. The sensors task:
  • configures the registers
  • reads data from the sensors
  • sends the measurements to the main task
  1. The GPS task:
  • receives the sattelite data
  • parses the data with the NMEA0183 protocol
  • updates the geographic coordinates
  1. The LEDs task:
  • waits for a signal from main
  • flashes the LEDs alternatively while there are dangerous levels
  1. The buzzer task:
  • waits for a signal from main
  • plays an alarm while there are dangerous levels

Functional diagram

functional

Dependencies

LibraryDescriptionUsage
embassy-rpHAL targeting the RP2350Access to the peripherals
embassy-timeTimekeeping, delays and timeoutsCreate timers
embassy-netAsync network stackSend messages over Wi-Fi
embassy-executorAn async/await executorCreate different tasks
embassy-syncSynchronization primitives with async supportCommunication between tasks
embassy-futuresUtilities for working with futuresSelect the first of multiple futures
ag_lcdDisplay libraryUsed for my 16 characters on 2 lines LCD screen
heaplessStatically allocated dataUsed to write strings for my LCD and to peers
tsl256xPlatform agnostic driver for TSL256xRead raw data from TSL2561
libmlibm in pure RustUse mathematical functions, such as pow
nmea0183NMEA 0183 parser targetting embedded devicesParse sattelite data from GPS module
static-cellStatically allocated, initialized at runtime cellSend arguments from main to tasks
  1. Lab 03 - PWM & ADC
  2. Lab 04 - Asynchronous Development
  3. Lab 06 - Inter-Integrated Circuit
  4. Lab 07 - Wi-Fi
  5. How to connect LCD without I2C