Go Down

Topic: dfrobot flame sensor coding (Read 2 times) previous topic - next topic

PaulS

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)?

mechatro

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  :P

Nick Gammon

Quote

Code: [Select]
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: [Select]

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?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

mechatro

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

fiddler

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

mechatro

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

Go Up