Flame Monitor

Our goal was to create a fireplace flame monitoring system that would let us know if our gas fireplace was left on.

The Flame Sensor

For this project we used a low cost ($3) flame sensor, that measures infrared light generated by a flame. These flame sensors are great for indoor projects. Natural sunlight will generate infrared light so some shielding will be required if you want to use these sensors on outdoor projects.

flame_module

The flame sensor has 2 outputs, an analog value (AO) , and a digital value (DO). The analog value is from 0 to 5 VDC, where a 0 VDC signal represents no infrared light is detected and 5 VDC is full scale infrared light is detected. The digital output is 0 if  no infrared light is detected and  1 if threshold  amount of infrared light is detected. The flame sensor has a potentiometer that can adjust infrared light sensitivity limit.

Construction

The flame sensor documentation recommends that the sensor be mounted 1.5 to 3 feet away from flame. We used Meccano to create a stable base with two supporting upright arms.

OLYMPUS DIGITAL CAMERA

Hardware

For this project we used a Raspberry Pi, but an Arduino module could also be used. One disadvantage in using the Raspberry Pi is that it doesn’t have Analog inputs in the base unit. We used an Pimoroni ExplorerHat to support the Analog input.

flame_pi

If you only have the base Raspbander to your desired setting.

Python Code

It will take a little bit of trial and error to determine your “Flame is ON” value, and this will change based your fireplace and sensor positioning. We found that:

  • 5 = no noticeable flame
  • < 3 = fire is on low, flame is detected
  • < 1 = fire is super hot

Using an analog connection on the Explorerhat analog input 2, the basic Python syntax would be:

>>> import explorerhat
Explorer HAT Pro detected...
>>> explorerhat.analog.two.read()
5.052

After the basic code is working it is possible to upgrade the application by:

  • adding a Web or Tkinter interface
  • adding logic for valid times (i.e. is the fire on after 1am ?)
  • send text messages or email alerts

Below is some code that will add a Tkinter visual interface and send a message to IFTTT  (we used this for SMS texting).

flame_tkinter

# Flame Monitor, with a link to IFTTT
#
from tkinter import *
import explorerhat
import requests

issent = False

def get_status():
        global issent
        print ('Getting a new value....')
        lb_status['text'] = explorerhat.analog.two.read()
        if explorerhat.analog.two.read():
                lb_1['text'] = 'flame on'
                lb_1['bg'] = 'red'
                if issent == False:
                        theurl = 'https://maker.ifttt.com/trigger/nodered/with/key/_yourkeycodeishere'

                        r = requests.post(theurl, data = {'value1':'flame!!!','value2':explorerhat.analog.two.read()})
                        issent = True
                        print('sent message to ifttt')

        else:
                issent = False
                lb_1['text'] = 'flame off'
                lb_1['bg'] = 'green'
        top.update()
        top.after(2000, get_status)

top = Tk()
top.title("Fire Place Flame Scanner Monitor")

lb_1 = Label(top, text ="Flame Scanner", bg = "green", fg = "white", width= 30, font = ('DejaVu Sans Mono',20,'bold') )
lb_1.pack(side = BOTTOM)
lb_status = Label(top, text ="OFF", fg = "red", width= 30, font = ('DejaVu Sans Mono',20,'bold') )
lb_status.pack(side = BOTTOM)

top.after(2000, get_status)
top.mainloop()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s