fbpx
Micropython Lesson 9: Flame Sensor
Micropython Lesson 9

Flame Sensor

Use flame sensor to identify infrared/heat bodies

Components Required

Magicbit
Buy
Flame Sensor
Buy

Introduction

A flame-sensor module that consists of a flame sensor (IR receiver), resistor, capacitor, potentiometer, and comparator LM393 is an integrated circuit. It can detect infrared light with a wavelength ranging from 700 nm to 1000 nm.

Learning outcomes:

  • Using a flame sensor to identify infrared/heat bodies

Theory

IR receiver mainly use with an IR Transmitter, not only to identifying heat bodies. IR light is emitted by the sun, light bulbs, and anything else that produces heat. That means there is a lot of IR light noise all around us. To prevent this noise from interfering with the IR signal, a signal modulation technique is used. In IR signal modulation, an encoder on the IR remote converts a binary signal into a modulated electrical signal. This electrical signal is sent to the transmitting LED. The transmitting LED converts the modulated electrical signal into a modulated IR light signal. The IR receiver then demodulates the IR light signal and converts it back to binary before passing on the information to a microcontroller. Here we use this sensor to identify flames.

Methodology

As the first step, you should connect a Magicbit flame sensor to the Magicbit core board. For this, you can use one side connector from four-side connectors of the Magicbit core board or if you want to extend the length of the connection, you can use jumper wires. For this example, the flame sensor was connected to the upper left connector of the Magicbit core board. Then connect the Magicbit to your pc and upload the code. You can get outputs using a serial monitor.

Code

 

from machine import Pin
import time

flame = ADC(Pin(32))
flame.atten(ADC.ATTN_11DB)       #Full range: 3.3v

while True:
  flame_value = flame.read()
  print(flame_value)
  sleep(0.1)

Explanation

Here we have used print because we have to measure a range to make the decision, whether there is a flame or not.

Related Posts
Leave a Reply