Arduino 101: Using a Flame sensor module

in #utopian-io8 years ago (edited)

What Will I Learn?

  • You will learn what a flame sensor is and how to use it properly.
  • You will learn how to integrate the flame sensor with the arduino uno board.
  • You will learn how to program the arduino uno to make the flame sensor work.

Requirements

Hardware

  • Arduino Uno

image.png

Image source

  • Flame sensor

image.png

Image source

  • LED

image.png

Image source

  • Resistor (220 ohms)

image.png

Image source

  • Breadboard

image.png

Image source

  • Jumper wires

image.png

Image source

  • USB type A to B cable

image.png

Image source

  • Computer

image.png

Image source

Software

  • Arduino Software/Arduino IDE

Knowledge

  • Basic electronics and programming knowledge

Difficulty

  • Basic

Project description

This is a simple project that will let the user know how to use a flame sensor with the arduino. The circuit is very simple, the flame sensor is hooked into the arduino uno board to act as the input sensor. The LED is set to be the output, to indicate the status of the sensor. Once a flame is detected from the sensor, it will send the information to the arduino uno board immediately, then the arduino will turn the LED ON to indicate that a flame is present.

Component description

Arduino Uno - a type of arduino board that is used regularly by specialist and hobbyist because of its robust design. It is equipped with a microcontroller board that is based on ATMega328P with 14 advanced I/O pins (6 are PWM outputs), 6 analog inputs, 16 Mhz quartz crystal, a power jack, a USB port, an ICSP header and a reset button.

Flame sensor module- this type of device is used to detect the fire source or other light sources with a wavelength that ranges from 760 nm - 1100 nm. Its based on YG1006 sensor that has a high speed and high sensitive NPN phototransistor.
The sensor is coated with black epoxy and is sensitive to infrared radiation. It also outputs digital signal 0 and 1 through a comparator output, when infrared light is detected its output value would be 0 and if no infrared light is detected it would be 1. It also has a built in potentiometer that can be used to adjust the sensitivity of the sensor. Reference

image.png

Tutorial Contents

Using a Flame sensor module

Step 1: Gather the parts

  • You can get the components in your local electronics shop or you can just order it online.

image.png

Step 2: Construct the circuit

Connect the sources

  • Connect the 5V pin of the arduino uno into the top/bottom slot of the breadboard. The connections here are horizontally connected making it an ideal spot for the sources.
  • Connect the GND pin of the arduino uno into the top/bottom slot of the breadboard but make sure not to short them out to avoid damaging the board.

image.png

Connect the LED

  • Connect the anode(+) of the LED to the 220 ohm resistor that is connected to pin number 2 of the arduino uno board. This resistor will protect the LED from damage of over supply of current.
  • Connect the cathode(-) of the LED to the common ground in the breadboard.

image.png

Connect the Sensor

  • Connect the VCC pin of the sensor directly to the 5V pin of the arduino uno board.
  • Connect the GND pin of the sensor directly to the GND pin of the arduino uno board.
  • Connect the D0 (digital pin) of the sensor to pin number 4 of the arduino uno board.

image.png

Step 3: Programming

  • Connect the arduino uno board to the computer by using the usb type a to b cable.

image.png

  • Once done, open the arduino IDE and go to Tools > Board > then select Arduino/Genuino Uno.

image.png

  • Copy the code below and paste it to your sketch in the arduino IDE.
int ledPin = 2 ;          // sets led @ pin 2
int sensorPin = 4 ;      // sets the digital pin of the sensor @pin 4
int flamePin = HIGH ;    // sets the state of the sensor
void setup ( )  {
  pinMode (sensorPin ,INPUT) ;      //sets sensorPin as the INPUT
  pinMode (ledPin,OUTPUT);            // sets LED pin as the OUTPUT
}
void loop ( ) {
   flamePin = digitalRead (sensorPin) ;   // reads the status of the flame sensor
  if (flamePin == LOW )                  // the conditions, LOW because if it detects flame it outputs a 0.
  {
    digitalWrite ( ledPin  , HIGH ) ;            // if state is high,turns ON the LED
  }
  else
  {
    digitalWrite ( ledPin , LOW ) ;             // otherwise turned OFF
  } 
}

What this code does is very simple, first it defines the pins of the sensor and the LED. Then it sets the initial reading of the flame sensor as HIGH because if the sensor does not detect any flame, its output is a 1. In the setup command, it sets the sensor's pin as the INPUT while the LED pin as the OUTPUT. In the void command, it first reads the the status of the sensor pin, once the value changes to LOW, the LED will be turned ON and if not the LED is turned OFF.

  • After typing the code into the sketch, click the Verify button to save and compile the sketch. This will also check for any errors in the code.

image.png

  • Once the sketch has finished compiling and there were no errors found, click the Upload button to start installing the program into the arduino uno board.

image.png

Step 4: Testing

  • After the programming is done, remove the board from the computer and connect it with a battery pack to start the arduino board.
  • Now, using your lighter gently light the lighter up and move it closer to the sensor for about 2 feet. This should light up the LED indicating that there is fire present.
  • Now, turn off the lighter. This should also turn the LED OFF indicating that there is no more fire in the surrounding.
  • If nothing is working, redo the previous steps and make sure to follow it correctly.

Curriculum

Here are my other arduino tutorials that you might find interesting:



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.


can you please tell me where you got this text from? It's marked by my plagiarism checker.

Its based on YG1006 sensor that has a high speed and high sensitive NPN phototransistor. The sensor is coated with black epoxy and is sensitive to infrared radiation

If you use quotations, then you have to mark them with a pointed bracket (>) and name the source


You can contact us on Discord.
[utopian-moderator]

Thank you very much approving my post @vladimir-simovic
My bad, i forgot to put the reference source. That is the definition of the flame sensor, here is the link of of that http://wiki.seeed.cc/Grove-Flame_Sensor/.
I will edit it now sir. Thanks a lot for noticing my mistake. I will do better next time👍

Hey @ted7 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.13
TRX 0.34
JST 0.035
BTC 108074.45
ETH 4399.12
USDT 1.00
SBD 0.83