Flame Sensor Project

Introduction:

flame_module-300x295

 

How does this thing work. How do people use it. How to use it within a concept. How sensitive really is it.

 

 

Literature Review:

After two weeks of research into the ins and outs of this module, I learnt a lot. The most obvious place to start as I believe most people do is to find out what components are all in the sensor and what they do to contribute to its abilities.

Initial look – 4 Pins

VCC – 3.3V (Digital) or 5V (Analog)

A0 – Analog pin

D0 – Digital Pin

GND – Ground

The analog pin always the a real-time output of the thermal resistance through the voltage signal.

The digital pin uses the sensor to read the temperature threshold, giving a high and low output which can be adjusted due to the potentiometer.

Potentiometer

I learnt a lot researching this. A potentiometer is just a fancy resistor, however the reason a potentiometer is used in this case instead of just a resistor is because it gives the user the ability to alter the amount of resistance within the module, either making it more or less sensitive.

Inside-single-turn-potentiometer

 

IR Infrared

The IR sensor reads light between 760- 1100 nm. The IR sensor also has a range of 60 degrees in which it can receive the light wave within. Sensitivity can be changed using the potentiometer.

Hypothesis:

This module could be used in a very effective way to keep people save from a flame or even just to detect flames if they were in a danger range of someone.

Experiments:

Testing this module was very simple in terms of the circuit as soon below. The code was a little more tricky to get it correct to match the lighting within the room and the sensitivity of the IR sensor.

 

 

Click here to view the video of the test.

To view the code for this test you can refer to my previous blogs. Click here to view.

Analysis:

The sensor is pretty difficult to try and set it up so that it allows reads it there is a flame to be detected and emit a warning through the use of an LED. The ability of the sensor is amazing though, just needs to be set up with great precision, or the code changed each time to adjust for the setting it is in.

Conclusion:

In conclusion, this module was great fun to have played with. I have gained greater knowledge surrounding coding and the use of the Arduino board, which I can now continue to develop.

Advertisements

Close Flame, Blow it out! – Jack Gormley & Emily Mortimore -Project

Introduction:

How can we produce something that incorporates both the RGB and Flame sensor module.

Literature Review:

After both Jack and I did our individual research into our given modules, we had to combine the two.

RGB Module

As an overview, this module can be used to emit different colours wanted by changing the code to suit. The module itself only has four pins to connect to the circuit; red, green,blue and ground.

These three primary colours, allow the operator to code in any colour on the RGB spectrum by altering the values sent to the diodes.

The module emits light within a range of 0-255. 0 being no light and 255 being full light. So within the code if you wanted the light to emit a primary colour then it would be –

setColour(255, 0, 0); //for red

setColour(0, 255, 0); //for green

setColour(0, 0, 255); //for blue

This module allows you to play with the light colour of light emitted instead of just having a number of different colour LEDs within the circuit.

Flame Sensor

This module is very clever in the way that it works. It also has four pins; Analog, Ground, VVC and Digital.

The analog pin always the a real-time output of the thermal resistance through the voltage signal.

The digital pin uses the sensor to read the temperature threshold, giving a high and low output which can be adjusted due to the potentiometer.

Obviously the remaining two; ground and VVC. Ground pin goes to ground on the Arduino board and the VVC is the voltage going into the module which can be 3.3V (Digital) or 5V (Analog), which we used.

The module works using an IR Infrared sensor at the front. It will sense wavelengths between 760 nm – 1100 nm light. It also has a range of 60 degrees in which is detects light.

Hypothesis:

We believe that by coding these two modules together, if the flame were to be varying in distance from the sensor, then once the flame is within a certain proximity then we will have something there to remove the flame. Incorporating the change in colour into it also to show the distances even before it gets into a close proximity.

thumbnail

Experiments:

We tested using the two modules together, firstly by having the change in colour between red, green and blue depending on distance.

Click here to view.

Fritzing Diagram RBG Flame

Secondly we tested the flame sensor, with the RGB varying in brightness depending on distance from the module.

Click here to view.

We then decided to include both a stepper motor and a DC motor. The stepper motor to operate a belt drive to operate the distance the flame was from the module. The DC motor we used to operate a fan to blow out the flame once in a close proximity.

Click here to view.

Fritzing Diagram

Code used for this circuit. Click here.

Analysis:

After reviewing the work we have done overall from this project, we agreed that we had both strong and weak points.

For example, the research we did gave us a good background to then use the modules in a way we wished. The model which we produced to present our findings was a neat and effective way of displaying the concept.

On the other hand we do have things we would have done differently also, when assembling the model we should have put the DC motor and fan closer than it was. This would have therefore had a higher impact when blowing out the flame. Reliability was definitely one that needed a little refinement.

IMG_0304

Conclusion:

In conclusion our RGB & Flame Module model had a few issues with reliability. While performing some tasks sometimes as expected, like bringing the flame closer when it detects it, and activating the DC motor to blow out the flame, other times it seemingly did not want to cooperate. We found out later that these strange behaviours may be linked to the fact that it is all run off the power from a single USB 3.0 port.

Upon reflection, using a separate power supply such as a 9v battery would have possibly given us more reliable results.

The video below demonstrates the strange behaviour. In this test the step motor would advance the candle (represented by the lighter) but only for a certain amount of time. When the flame is reproduced it would continue to advance for again a short while. Based on previous tests this is aberrant behaviour. Towards the end of the video the sensor requires the flame to be brought even closer in order to activate the DC motor fan, which even then only runs for a few seconds.

Click here to view the video.

 

 

RGB & Flame Combo – Jack Gormley & Emily Mortimore

Continuing on from last week.

After the mild success of last week where we managed to get the RGB light to change colour based on the readings from the flame module, we were prepared to add to this concept with other outputs.

We decided for our final demonstration to combine our components with a DC motor and a stepper motor. Our idea was to use the stepper motor to bring a lit candle closer to the sensor, while displaying a visual alert through the use of the RGB LED, which once it gets to a suitable range is blown out by a DC motor – driven fan.

 

Conceptualisation

After a few rough sketches and measurements of components, we had a concept that would achieve our desired result.thumbnail

CAD

From this, we went on to CAD up parts we needed to 3D print in Solidworks.

tea-light-cad.pngenclosure-cad.png

 

Code

Taking inspiration from our previous code, we attempted to use switch case statements to replicate our results, however we discovered that we were indeed trying to use old code with new hardware, so we rewrote the code using while and if statements as in the example below:

https://create.arduino.cc/editor/JackGormley/a705ebcd-61a2-4248-aea2-bc7411042bd1/preview?embed

 

Which we quickly learned didn’t work. Rewriting the code (with the exemption of nested if statements) a couple iterations later yielded the following code using if and else if statements with greater success:

https://create.arduino.cc/editor/JackGormley/a705ebcd-61a2-4248-aea2-bc7411042bd1/preview?embed

This code allowed the step motor to turn once the sensor detected a flame and turned the LED red when fire was detected, defaulting to green when there was no flame present.

RGB & Flame Combo – Jack Gormley & Emily Mortimore

New challenge – Pair with another person to use both modules together.

 

To begin..

Jack and I paired up which meant that we had to come up with something that can include both a RGB and Flame sensor module.

In my week 2 with the flame sensor I used a code to display in the serial monitor how close the flame was. From this we decided that we could use the flame sensor module to detect the flame, but instead of displaying the distance on a display we could make the RGB glow a certain colour depending on the distance.

 

For example,

0-40 / Red

40-80 / Green

80 + / Blue

 

The code we used for this was –

int ledR = 9;

int ledG = 10;

int ledB = 11;

 

// lowest and highest sensor readings:

const int sensorMin = 0;     // sensor minimum

const int sensorMax = 1024;

int colour;// sensor maximum

 

void setup() {

// initialize serial communication @ 9600 baud:

Serial.begin(9600);

}

void loop() {

// read the sensor on analog A0:

int sensorReading = analogRead(A0);

// map the sensor range (four options):

// ex: ‘long int map(long int, long int, long int, long int, long int)’

//int range = map(sensorReading, sensorMin, sensorMax, 0, 10);

 

Serial.println(sensorReading);

constrain (sensorReading, 15, 40);

colour = map(sensorReading, 15, 40, 255,0);

 

 

analogWrite(ledR, colour);

analogWrite(ledG, 0);

analogWrite(ledB, 0);

/*

// range value:

switch (range) {

case 0:    // A fire closer than 1.5 feet away.

Serial.println(“** burnt **”);

analogWrite(ledR, 255);

break;

case 1:    // A fire between 1-3 feet away.

Serial.println(“** ITS HOT **”);

analogWrite(ledB, 255);

break;

case 2:    // No fire detected.

Serial.println(“My word its warm”);

analogWrite(ledG, 255);

break;

case 3:    // No fire detected.

Serial.println(“A summers day”);

break;

case 4:    // A fire closer than 1.5 feet away.

Serial.println(“A crap radiator”);

break;

case 5:    // A fire between 1-3 feet away.

Serial.println(“An open fridge”);

break;

case 6:    // No fire detected.

Serial.println(“English winter”);

break;

case 7:    // No fire detected.

Serial.println(“My heart”);

break;

}

delay(1);  // delay between reads

*/

}

Click here to see the test.

circuit

 

 

After testing this we found that the colour and output read correctly from the distance between 0-80. After the flame passed the 80 range, the light turned blue for about 2 seconds and went off. This was because the flame was leaving the detection zone, therefore no light was being emitted from the RGB.

 

 

Dimming the RGB Colour

 

To take the RGB a step further we decided to try testing whether we could change the brightness of the LED within each range. For example, within the range of 0-40 when the RGB was red, when it was in the 0-10 threshold it would be at its brightest and as the flame moved through the thresholds it would reduce in brightness, until hitting the 40-80 where it would change to green and then do the same within that range.

 

Here is the code used for this test –

int ledR = 9;

int ledG = 10;

int ledB = 11;

 

// lowest and highest sensor readings:

const int sensorMin = 0;     // sensor minimum

const int sensorMax = 1024;

int colour;// sensor maximum

 

void setup() {

// initialize serial communication @ 9600 baud:

Serial.begin(9600);

}

void loop() {

// read the sensor on analog A0:

int sensorReading = analogRead(A0);

// map the sensor range (four options):

// ex: ‘long int map(long int, long int, long int, long int, long int)’

//int range = map(sensorReading, sensorMin, sensorMax, 0, 10);

 

Serial.println(sensorReading);

constrain (sensorReading, 15, 40);

colour = map(sensorReading, 15, 40, 255,0);

 

 

analogWrite(ledR, colour);

analogWrite(ledG, 0);

analogWrite(ledB, 0);

 

Click here also to see the test video we did.

 

Following on for the previous bit of research into mapping, we continued to use it here too. We had a few challenged with this as we wanted to limit the range of which the Arduino would respond to the flame sensor. So, the flame sensor will sense the flame within its only range, however we only wanted to the RGB module to work in parallel to a smaller part of that range.

This part of the code –

colour = map(sensorReading, 15, 40, 255,0)

So we wanted the minimum distance to be 15mm from the sensor and the maximum to be 40mm. Then the 255, 0, were relating to the light emission through the RGB.

 

Below is the Fritzing diagram for this test also.

Fritzing Diagram RBG Flame

This week we did struggle with a few things but after a lot of changes to the code within the testing stages we managed to deal with the problems.

Next week, we will sort the other components into the circuit and code to allow the prototype to work.

 

Week 2 – Module Testing

*Flame Sensor Module*

After my research into the module I thought it was time to start work out its abilities and test it myself.

Sensor Ability

What is the range of the sensor for detecting a flame?

An IR LED, also known as IR transmitter, is a special purpose LED that transmits infrared rays in the range of 760 nm wavelength.

From <https://www.engineersgarage.com/electronic-components/ir-infrared-led> According to Bilal the author from the website; http://microcontrollerslab.com/flame-sensor-arduino-fire-detection/. ‘The module is sensitive to flame but it can also detect ordinary light. The detection point is 60 degrees.’

This shows that unless the flame were in the 60 degrees of the module IR, then it wouldn’t be sensed even if there were to be a flame. Therefore it could possibly work to a better standard if the module where to be attached to a servo and to code in the ability to make the module rotate a certain degree around every 5 seconds to search for a flame.

‘The sensitivity of this sensor is adjustable and it also has a stable performance.’

Finding this out from research enables the thought process to go down the route of adjusting the coding and settings of the module to enable the system to work at a higher ability.

Testing the Ability

Found online – http://www.instructables.com/id/Arduino-Modules-Flame-Sensor/

The following code maps and reads the analog values given by the flame sensor (0-1024). The stock flame sensor will have the following reaction with this code:

If holding a flame within 1.5 feet in front of the sensor; “case 0″ will be activated and ” ** Close Fire ** ” will be sent to the serial monitor.

If holding a flame between 1.5 feet and 3 feet in front of the sensor; “case 1″ will be activated and ” **Distant Fire** ” will be sent to the serial monitor.

If no flame is detected in front of the sensor; “case 2″ will be activated and ” No Fire ” will be sent to the serial monitor.

* To view the output, point a serial monitor such as Putty at your Arduino.

* This code is constantly updating in order to provide a real time feedback of the flame sensor.

CODE

/* Flame Sensor analog example.

Code by Reichenstein7 (thejamerson.com)

Flame Sensor Ordered from DX ( http://www.dx.com/p/arduino-flame-sensor-for-temperature

detection-blue-dc-3-3-5v-118075?tc=USD&gclid=CPX6sYCRrMACFZJr7AodewsA-Q#.U_n5jWOrjfU )

To test view the output, point a serial monitor such as Putty at your arduino.

*/

// lowest and highest sensor readings:

const int sensorMin = 0;     // sensor minimum

const int sensorMax = 1024;  // sensor maximum

void setup() {

// initialize serial communication @ 9600 baud:

Serial.begin(9600);

}

void loop() {

// read the sensor on analog A0:

int sensorReading = analogRead(A0);

// map the sensor range (four options):

// ex: ‘long int map(long int, long int, long int, long int, long int)’

int range = map(sensorReading, sensorMin, sensorMax, 0, 3);

// range value:

switch (range) {

case 0:    // A fire closer than 1.5 feet away.

Serial.println(“** Close Fire **”);

break;

case 1:    // A fire between 1-3 feet away.

Serial.println(“** Distant Fire **”);

break;

case 2:    // No fire detected.

Serial.println(“No Fire”);

break;

}

delay(1);  // delay between reads

}

Here is a video of me using this code for myself. Click Here.

Testing Feedback

From doing this test I have realised a number of things that I wasn’t aware of before.

Firstly, the position of the module is very sensitive. For example, if i was holding the sensor at flat then the serial monitor would read that there was a distant fire, when this wasn’t the case. In comparison, when I rest the module on the edge of the desk as shown in the video above, it read out the correct feedback I wished; No fire.

The second thing I discovered was that the code was pretty simple. However, I did have to get my head around certain parts of it.

*int range = map(sensorReading, sensorMin, sensorMax, 0, 3)*

Research into parts of coding

Map –

The function in Arduino which is Map() allows us to map a value that comes in LOW to High and a value that comes in HIGH to LOW.

It is best explained on the Arduino reference website. Click Here.

I know understand the Range of which the module works!

Week 1 – RGB Module

KY-009_RGB_full_color_LED_SMD_arduino_module-240x240

 

An RBG Light Emitting Diode (LED) with four pins, Red, Green, Blue and ground. The three colour pins correspond to three different coloured LEDs, ground goes to ground.

As the diodes are of the three primary colours, any colours on the RGB spectrum can be achieved by altering the values sent to the diodes.

 

RGB MOd_2.jpg

The Pins

The pins take values ranging from 0-255, which controls how much of the emitted light is a particular colour, 0 being no light, 255 being full brightness. Pins need to be connected to PWM ports on a board in order for a range of values to be sent to them.

The LED is called a 5050, as those are the dimensions of the LED itself.

 

The Setup

The three input pins require resistors much the same as any LED would, some RGB Modules have these built in, but this one does not, so I’ve added my own. You will need:

  • 1X Arduino Uno
  • 1X Breadboard
  • 1X RGB Module
  • 3X 560 ohm resistors
  • 4X wires

Fritzing.jpg

The Code

Embedded here is the code i used to display the three primary colours, as well as a step in colour between them.

 

https://create.arduino.cc/editor/JackGormley/a705ebcd-61a2-4248-aea2-bc7411042bd1/preview?embed

 

I created a function called “setColour()” which takes three values you give it and analogWrite s them to the red, green and blue pins.

This function is called in the loop() function and is written with delays of one second between colour changes.

 

Video

 

Week 1 – Flame Sensor Module

Hey, here is my first week of fun. Very excited to start, turns out some things look easy but they aren’t. Who knew.  Let’s hope it ends with becoming a genius!

 

Decided to start with the website the University purchased the sensors from.

The website is – http://osoyoo.com/

The flame sensor module does exactly what it says – when the sensor detects a flame it illuminates an LED to display the user of this fact.

flame_module-300x295

 

Source : http://osoyoo.com/2015/04/28/flame-sensor-module/

Here is my sensor as shown on the website. They also have given the online viewer the coding to test their module for themselves.

 

 

As written below ;

/*
* Fire sensor module test project
* tutorial url: http://osoyoo.com/?p=671
*/
int Led=13;
int buttonpin=3;
int val;
void setup()

flame_module-300x213

 

{
pinMode(Led,OUTPUT);

 

pinMode(buttonpin,INPUT);
}
void loop()
{
val=digitalRead(buttonpin);
if(val==HIGH)
{
digitalWrite(Led,HIGH);
}
else
{
digitalWrite(Led,LOW);
}
}

from : http://osoyoo.com/wp-content/uploads/samplecode/flame_module.txt

Components

The_flame_sensor

1 – Pins

From <http://www.instructables.com/id/Arduino-Modules-Flame-Sensor/>

Analog output (A0): Real-time output voltage signal on the thermal resistance.

Digital output (D0): When the temperature reaches a certain threshold, the output high and low signal threshold adjustable via potentiometer.

 

The module has four pins, which are the same with most modules.

VCC….Positive voltage input: 5v for analog and 3.3v for digital.

A0….Analog output

D0….Digital output

GND…. Ground

 

2 – Boshen 3296

From <http://www.robotroom.com/Trimpots-2.html>

What is this?

From research I have found that this is a Multi-Turn Cermet Trimmer Potentiometer.

What does it consist of?

The trimmer has a ceramic plate with three riveted wire leads, three conductive traces and a dark circular segment of resistive film.

(The film is usually cermet: a combination of ceramic and metal.)

What does it do for the sensor?

Cermet-trimpot-substrate

This is the inside of the trimmer, to explain the impact the trimmer has on the module I had to find out what this does first.

So, the first and third point measure the full resistance of the trimpot. Doesn’t matter the position of the dial, the electricity will flow through just like single fixed resistor.

The dial is moulded plastic that sits in the middle to connect to the electrics.

Inside-single-turn-potentiometer

Inside a single-turn potentiometer. Left: Dial in place. Middle: Dial removed. Right: Back of removed dial.

 

Underneath the dial is a metal wiper, that applies mechanical spring pressure to keep contact between the center and the outer resistive element. From this the electricity flows; for example, through the first pin, through the certain amount of resistance film, through the metal wiper and into the center pin.

The position of the dial with determine an increase or decrease in resistance.

The Wiper

Works just like a brush in a motor.

Its a series of small bent wires providing contact points to ensure good electrical flow is maintained. The benefit of this is that is stops electrical noise, sudden shifts in value or disconnection all together that is likely to occur if it were to only be a single wire in contact with the center or resistor element.

Benefit to module

The gold screw on the top of the potentiometer allows the user to control the resistance which makes the sensor either more sensitive or less depending on what the user wants.

3 – (IR) Infrared LED

They are transmitters that emit IR rays at a longer wavelength than visible light.

The best example that everyone will be able to understand is the communication between a TV and the remote, within the front of the TV there is a IR receiver listening for clicks from the TV remote. The remote emits IR pulses which tells the TV to turn on. They talk to each other.

The IR rays are being emitted as we know when the TV is turned on or change the channel but we never see them.

Source – https://learn.adafruit.com/ir-sensor/overview