I am working on a simple project, that when it detects flame, a buzzer and a LED goes on in order to alarm.
The flame sensor that is being used in this project is the IR Infrared 4 Wire KY WIN ROBOT (a picture of the sensor is attached , as also the source code of the project). My question is that when i run the code and without the presence of a lighter , serial monitor shows "Fire" , but when i light the fighter it says "No fire". What could be wrong ?
Probably this way it's just simpler from electronic point of view. You can easily invert a logic in your sketch.
It's a common practice in electronic to have an inverted logic. So often you can see something like "Active high" or "Active Low" to indicate which logic are used.
a benefit of inverted logic: the line is pulled high when NOT FLAME. If the line is pulled low, FLAME is indicated. if the line is not pulled high, you get a false FLAME signal. you investigate and find that there is no fire but your detector requires attention. this combination of conditions is "fail safe"
the opposite approach, normally low, pulled high by an event, can fail and neither the failure nor the flame would be detected. this is "fail unsafe"
Fuji_1:
Thank you alesam , but what's the purpose of the "inverted logic" in this sensor ?
Active low is fairly common, it allows convenient open-collector to opto-coupler or relay activation.
[Open collector outputs are convenient for changing voltage]
Every logic signal has a sense, and you have to be aware of this. Normally an inverted signal
has a bar over the top of its name in the datasheet, or is named Nxxx or #xxx, as in #RESET,
NRESET.