edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
Steve Lunneborg
Published

Battery Fire Detection

Heat detection with audible and visual alarms for battery charging and storage.

BeginnerWork in progress4 days15
Battery Fire Detection

Things used in this project

Hardware components

Photon
Particle Photon
×1
Gravity: I2C BME280 Environmental Sensor
DFRobot Gravity: I2C BME280 Environmental Sensor
×1
Big Red Dome Button
SparkFun Electronics Big Red Dome Button
×1
0.96" OLED 64x128 Display Module
ElectroPeak 0.96" OLED 64x128 Display Module
×1

Software apps and online services

VS Code
Microsoft VS Code
Tinkercad
Autodesk Tinkercad
Slack
Slack

Hand tools and fabrication machines

Solder Wire, Lead Free
Solder Wire, Lead Free
Soldering Gun Kit, Instant Heat
Soldering Gun Kit, Instant Heat
Soldering iron (generic)
Soldering iron (generic)
3D Printer (generic)
3D Printer (generic)
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Schematics

circuit diagrams

This is a crude diagram from the project.

Code

BatFireSys.MidTerm

C/C++
Helps with early detection of a battery fire
/* 
 * Project HeDetSys
 * Author: Steve Lunneborg
 * Date: 07/09/26
 * For comprehensive documentation and examples, please visit:
 * https://docs.particle.io/firmware/best-practices/firmware-template/
 */

// Include Particle Device OS APIs
#include "Particle.h"
#include "IoTClassroom_CNM.h"
#include "Adafruit_SSD1306.h"
#include "Adafruit_BME280.h"

SYSTEM_MODE(MANUAL);

float tempC;
float tempF;
const int BMEADDR = 0x76;
const int BUTTPIN =
const int OLED_RESET=-1;
unsigned int lastPrint;
unsigned int printInterval = 2000;

bool alarmOn = false;

Adafruit_BME280 bme; 
Adafruit_SSD1306 display(OLED_RESET);
Button myButton(BUTTONPIN);


SYSTEM_THREAD(ENABLED);

void setup() {
  Serial.begin(9600);
  waitFor(Serial.isConnected,15000);



  WiFi.on();
  WiFi.clearCredentials();
  WiFi.setCredentials("IoTNetwork");
  
  WiFi.connect();
  while(!WiFi.ready()) {
    Serial.printf(".");
    delay(250);
  }
  Serial.printf("\n\n");


  if (!bme.begin(BMEADDR)) {
        Serial.printf("Could not find a valid BME280 sensor");
/* in void loop every so often get a reading from the bme readings with if tempf is above (blank) and below(blank) your oled display what range your're in (safe, warnig, danger)
automatic mode if */    
    }
  display.begin(SSD1306_SWITCHCAOVCC, 0x3C);

  display.display();
  delay(2000);
  display.clearDisplay():

  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.printf("Alarm ready/n");
  display.clearDisplay();
  display.display();



}

void loop() {
  

  if ((millis() - lastprint) > printInterval){  //timer for stuff, variables must be differnt 
    tempC = bme.readTemperature():
    tempf = tempC  * (9.0/5.0) =32;
    Serial.printf("Temp:%.01f\n", tempF);
    lastPrint = millis();
    if(tempF >=){
      alarmOn = true;
    if (temp F <=){
      alarmOn = false;
      
    }
    if(Tempf)
  }
  

Credits

Steve Lunneborg
1 project • 3 followers
Thanks to Jaime Dowden-Duarte and Ej Ishman .

Comments