Couple months ago I did project which worked that buzzer went on when I approached with fire to phototransistor. Now I did this project a little bit different and it does not work. Serial.printIn values are always between 200 - 350, no matter do I point the fire or not. I hope someone finds mistake, tnx.
int alarm = 13;
int sensor = A0;
void setup()
{
Serial.begin(9600);
pinMode(alarm, OUTPUT);
}
void loop()
{
int sensor1 = analogRead(sensor);
Serial.println(sensor1);
if(sensor1<40)
{
tone(alarm, 1000);
delay(1000);
noTone(alarm);
}
if (sensor1>40)
{
digitalWrite(alarm,LOW);
delay(1000);
}
What change from your first (working) design? Do you use the same transistor, resistor, voltages? Are you sure everything is connected? Do you read 1023 when you disconnect phototransistor/GND and 0 when you disconnect 5V?
Search ebay for "Infrared flame sensor" within Business and Industrial -> Electrical and test equipment category (that's the category where all the good stuff is!)
Arduino-friendly IR flame sensors. 99 cents shipped from china via ox-cart, $3 shipped domestic US.
Its probably worth saying that there are two sorts of IR detector, "far IR" is used for passive heat
sensing and thermal imaging - this has a wavelength range of about 6 to 10 µm, and is not detected
at all my photodiodes or phototransistors. At these wavelengths glass absorbs, so any lenses have to
be made of exotic materials and are expensive. No source of illumination is needed, the heat of objects
is enough to radiate.
"near IR" is close to the visible range of light, say 0.7 to 1.5µm (700 to 1500nm) range, and most
photo diodes and photo transistors have peak sensitivity in this range, typically 780 or 850nm. Such
near IR behaves like light and can go through glass lenses (for instance). For seeing at night in near
IR you need a source of (near IR) illumination. Most visible light sources also put out near IR, so
a white flame will, but a blue flame probably gives out nothing in near IR, but loads and loads in
far IR.
Your phototransistor may be broken (are you sure it is not a LED?).
Anyway the working one is more black - maybe there is a difference between detection wavelengths of the two phototransistors. If possible try to swap them to see if this one is working. Also you may try to find datasheets of them and compare it.
A pir detector will detect a wide range of low energy IR - they're a sort of semiconductor bolometer and work well. The lenses are made of polythene - not too exotic.
Or what's wrong with the ubiquitous smoke detector?
Many moons ago (30+ years) I made a flame detector with an IR LED of an old remote.
I amplified it's AC component with an opamp.
A flame sounds like a storm if you connect that to an audio amplifier.
Leo..