Simple Fire Sensor - Detecting and maesuring fire with regular fire sensor (example)
This page contains a simple example with function documentation on how to detect and measure intensity of fire with the sensor.
Initialization
To use the sensor, first include the required library, create the sensor object and SimpleFireSensor object, and initialize it in the setup() function. You can use the return value of begin() to check if everything is connected correctly.
#include "Simple-fire-sensor-easyC-SOLDERED.h"
#define ANALOG_PIN 14
#define DIGITAL_PIN 15
SimpleFireSensor sensor(ANALOG_PIN);
void setup() {
sensor.begin();
}
//...
SimpleFireSensor sensor()
Creates SimpleFireSensor object
Returns value: none
Function parameters:
| Type | Name | Description |
|---|---|---|
uint16_t | pin | Analog pin number for data communication |
sensor.begin()
Initializes the sensor.
Returns value: Returns true if initialization is successful, false otherwise.
Measuring with both digital and analog output
In this library, there are two options for displaying the analog value: for a percentage value, call the getValue() function, and for the raw value, call the getRawValue() function.
#include "Simple-fire-sensor-easyC-SOLDERED.h"
#define ANALOG_PIN 14
#define DIGITAL_PIN 15
SimpleFireSensor sensor(ANALOG_PIN);
void setup() {
Serial.begin(115200);
sensor.begin();
}
void loop() {
Serial.print("IR light sensor reading: "); // Print information message
Serial.print(sensor.getValue()); // Prints percentage value of fire sensor
Serial.print("% ");
Serial.println(sensor.getRawValue()); // Prints raw value of fire sensor
if (digitalRead(DIGITAL_PIN)) // Potentiometer on breakout board is used to
// set threshold value. This function checks if
// the threshold value is passed and determines if there
// is a fire nearby.
{
Serial.println("Fire is not detected.");
}
else
{
Serial.println("Fire is detected!!");
}
// You can also use thresholds (except threshold for LED) like in the Read_values_easyC example to detect fire.
// Wait a bit before the next reading
delay(500);
}
sensor.getValue()
Returns the measurement in percentage.
Returns value: Returns float representation of fire chance percentage
sensor.getRawValue()
Returns the raw ADC value.
Returns value: Returns integer representation of fire value




Full example
Try all of the functions mentioned above in the full example below:
Read_values_native.ino
Example for using the digital and analog read functions for Simple fire sensor.