Pages: 1 [2]   Go Down
Author Topic: dfrobot flame sensor coding  (Read 2293 times)
0 Members and 1 Guest are viewing this topic.
Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i am using 5v supply from arduino atmega 8
The spec you listed, then, shows the range to be 20 cm. Is this, or is it not, consistent with the range that the sensor is actual able to detect the flame (vs. bright ambient light)?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you noticed "fire" but forgot to notice that the fire is from a "candle".. no fire from candle can fume up if air is blown towards it..if i am in earth, this is the fact..and i am in earth infact  smiley-razz
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Code:
if(val>400)
      {digitalWrite(13, LOW);
      digitalWrite(7, HIGH);
      }
      if(val<100)
      {digitalWrite(13,HIGH);
      digitalWrite(7, LOW);
      }

13 corresponds to motor wheels..7 corresponds to 12V DC Brushless fan..if it senses fire, it stops and the fan starts rotating thus extinguishing fire..

Here's a tip. Use constants.

Code:
const byte MOTOR = 13;
const byte FAN = 7;
const int UPPER_THRESHOLD = 400;
const int LOWER_THRESHOLD = 100;

if (val > UPPER_THRESHOLD)
  {
  digitalWrite (MOTOR, LOW);
  digitalWrite (FAN, HIGH);
  }

if (val < LOWER_THRESHOLD)
  {
  digitalWrite (MOTOR, HIGH);
  digitalWrite (FAN, LOW);
  }

Quote
i light a candle and take that upto certain level ( nearer to the sensor ) say 5cm, the reading shoots up to 900-1000...if the intensity gets lowered, the reading comes to 400-500..at this stage it cant differentiate between flame and brightness..

How do you lower a candle's intensity? You seem to be saying that the sensor reading goes up when a flame is near it. Isn't that what is supposed to happen?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks...but this is what i am using now..exactly..anyway thanks for your help.
Logged

NZ
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, when using just one sensor the ambient light will have an effect.
One way is to add another sensor which is physically offset, ie 30 degrees, so you measure the difference and act when the difference is more than x
Off course you could also do this with one sensor, read the ambient light at the start, then act when it is more than x, just not as likely to be as reliable in real lift, but cheaper :-)

K
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i will try to do that.. i have another one in stock just in case..hope it will work.. but i need to control the rpm. because the deceleration takes some time and it may actually clash with the candle (in my case). but it has to slow down before coming to a stop so that it will be easy to put off fire from a certain distance...thanks for the help.. but i am still stuck with that here..

http://forum.arduino.cc/index.php?topic=185212.0

cant get that right... dont know why
Logged

Pages: 1 [2]   Go Up
Jump to: