{"id":113,"date":"2015-09-19T22:05:46","date_gmt":"2015-09-19T22:05:46","guid":{"rendered":"https:\/\/einhugur.com\/blog\/?page_id=113"},"modified":"2021-04-15T13:16:31","modified_gmt":"2021-04-15T13:16:31","slug":"flame-sensor","status":"publish","type":"page","link":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/flame-sensor\/","title":{"rendered":"Flame sensor"},"content":{"rendered":"<p>In this example we are going to connect to flame\u00a0sensor.<\/p>\n<p>Programming for this sensor works on exactly the same principle as the\u00a0HC-SR501 infrared sensor and the F85 vibration sensor except the signal from this sensor comes inverted. As in it will send 1 when everything is all right and zero if it sees flame.<\/p>\n<p><span style=\"color: #808080;\">I really liked this one, it \u00a0seemed to give very reliable readings when doing the lighter test with it.<\/span><\/p>\n<p><strong>Disclaimer:<\/strong><br \/>\nWe do not take any responsibility for possible errors in the guide or errors that you might do wiring it up. Incorrect wiring can result in damaged sensor or damaged Raspberry PI. If you light something on fire when doing flame test to test the sensor then thats your own fault and we are not responsible for that.<\/p>\n<p><strong>Pieces we use are:<\/strong><\/p>\n<ul>\n<li>Raspberry PI 2<\/li>\n<li>Cobbler and Cobbler cable<\/li>\n<li>Flame sensor\u00a0(They cost $22\u00a0Aliexpress for 10 pieces, ($2.2 a piece) where I\u00a0got this sensor.<\/li>\n<li><a href=\"https:\/\/github.com\/xojo\/GPIO\">Wiring PI Xojo module from\u00a0Paul Lefebvre<\/a><\/li>\n<\/ul>\n<p><strong>First thing is connecting the sensor:<\/strong><\/p>\n<figure id=\"attachment_110\" class=\"wp-caption alignnone\">\n<p><figure id=\"attachment_118\" aria-describedby=\"caption-attachment-118\" style=\"width: 225px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i2.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/FlameSensor-e1442681877884.jpg?ssl=1\"><img data-attachment-id=\"118\" data-permalink=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/flame-sensor\/flamesensor\/\" data-orig-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/FlameSensor-e1442681877884.jpg?fit=480%2C640&amp;ssl=1\" data-orig-size=\"480,640\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;2.2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone 6&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1442681624&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.15&quot;,&quot;iso&quot;:&quot;160&quot;,&quot;shutter_speed&quot;:&quot;0.033333333333333&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;6&quot;}\" data-image-title=\"Flame sensor\" data-image-description=\"\" data-medium-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/FlameSensor-e1442681877884.jpg?fit=225%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/FlameSensor-e1442681877884.jpg?fit=474%2C632&amp;ssl=1\" loading=\"lazy\" class=\"size-medium wp-image-118\" src=\"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/FlameSensor-e1442681877884-225x300.jpg?resize=225%2C300&#038;ssl=1\" alt=\"Flame sensor\" width=\"225\" height=\"300\" srcset=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/FlameSensor-e1442681877884.jpg?resize=225%2C300&amp;ssl=1 225w, https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/FlameSensor-e1442681877884.jpg?w=480&amp;ssl=1 480w\" sizes=\"(max-width: 225px) 100vw, 225px\" data-recalc-dims=\"1\" \/><\/a><figcaption id=\"caption-attachment-118\" class=\"wp-caption-text\">Flame sensor<\/figcaption><\/figure><\/figure>\n<p>This sensor comes with good markings so its very easy to wire it.<\/p>\n<ul>\n<li>(5V)\u00a0Red is the 5V input \u2013\u00a0I always use red for the power input.<\/li>\n<li>(GPIOX)\u00a0Yellow is the Data pin.<\/li>\n<li>(GND)\u00a0Blue is the ground,\u00a0I always use blue for ground.<\/li>\n<\/ul>\n<p><span style=\"color: #808080;\">Spec on this sensor is:<\/span><\/p>\n<ul>\n<li><span style=\"color: #808080;\">The working voltage of 3.3V to 5V<\/span><\/li>\n<li><span style=\"color: #808080;\">Output form: digital switch output (0 and 1)<\/span><\/li>\n<li><span style=\"color: #808080;\">Sensitivity adjustable digital potentiometer to adjust.<\/span><\/li>\n<li><span style=\"color: #808080;\">Detection Angle of 60 degrees or so, particularly sensitive to the flame spectrum.<\/span><\/li>\n<li><span style=\"color: #808080;\">Lighter\u00a0flame test distance of 80 cm<\/span><\/li>\n<\/ul>\n<p>The sensor will have red light showing that it is turned on, and green light also lights on it when it sees flame, making it send LOW\u00a0signal, while when there is no flame it will be sending HIGH.<\/p>\n<p><strong>Connecting to the Cobbler:<\/strong><\/p>\n<p>Make sure your Raspberry PI is not powered on when you do the connections.<\/p>\n<figure id=\"attachment_80\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/Sensor-connection-e1442664059628.jpg?ssl=1\"><img data-attachment-id=\"80\" data-permalink=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hc-sr501-sensor\/sensor-connection\/\" data-orig-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/Sensor-connection-e1442664059628.jpg?fit=480%2C640&amp;ssl=1\" data-orig-size=\"480,640\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;2.2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone 6&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1442662628&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.15&quot;,&quot;iso&quot;:&quot;64&quot;,&quot;shutter_speed&quot;:&quot;0.033333333333333&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;6&quot;}\" data-image-title=\"Cobbler\" data-image-description=\"\" data-medium-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/Sensor-connection-e1442664059628.jpg?fit=225%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/Sensor-connection-e1442664059628.jpg?fit=474%2C632&amp;ssl=1\" loading=\"lazy\" class=\"size-medium wp-image-80\" src=\"https:\/\/i1.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/Sensor-connection-e1442664059628-225x300.jpg?resize=225%2C300&#038;ssl=1\" alt=\"Cobbler for Raspberry PI\" width=\"225\" height=\"300\" srcset=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/Sensor-connection-e1442664059628.jpg?resize=225%2C300&amp;ssl=1 225w, https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/Sensor-connection-e1442664059628.jpg?w=480&amp;ssl=1 480w\" sizes=\"(max-width: 225px) 100vw, 225px\" data-recalc-dims=\"1\" \/><\/a><figcaption class=\"wp-caption-text\">Cobbler for Raspberry PI<\/figcaption><\/figure>\n<p><a href=\"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?ssl=1\"><img data-attachment-id=\"82\" data-permalink=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hc-sr501-sensor\/gpio-header\/\" data-orig-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?fit=440%2C870&amp;ssl=1\" data-orig-size=\"440,870\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"GPIO Header\" data-image-description=\"\" data-medium-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?fit=152%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?fit=440%2C870&amp;ssl=1\" loading=\"lazy\" class=\"size-medium wp-image-82 alignnone\" src=\"https:\/\/i1.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header-152x300.png?resize=152%2C300&#038;ssl=1\" alt=\"GPIO Header\" width=\"152\" height=\"300\" srcset=\"https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?resize=152%2C300&amp;ssl=1 152w, https:\/\/i2.wp.com\/einhugur.net\/blog\/wp-content\/uploads\/2015\/09\/GPIO-Header.png?w=440&amp;ssl=1 440w\" sizes=\"(max-width: 152px) 100vw, 152px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>In my example then I have it connected as follows:<\/p>\n<ul>\n<li>Red to pin 2 (5V)<\/li>\n<li>Blue to pin 25 (GND)<\/li>\n<li>Yellow to GPIO 5 which is pin 29.<\/li>\n<\/ul>\n<p><strong>The Xojo code:<\/strong><\/p>\n<p>I have a timer to poll the sensor. we set the timer up and the pin mode in the Window Open event.<\/p>\n<pre lang=\"xojo\">Sub Open()\n\nConst kFlameSensorPin = 5\n\nGPIO.SetupGPIO\n\nGPIO.PinMode(kFlameSensorPin, GPIO.INPUT)\n\nTimer1.Mode = Timer.ModeMultiple\nTimer1.Enabled = true\n\nEnd Sub<\/pre>\n<p>In the Timer.Action event I got the following code:<\/p>\n<p>(If you want it more responsive then you can increase the cycles of the for loop)<\/p>\n<pre lang=\"xojo\">Sub Action()\n\nDim i as Integer\nConst kFlameSensorPin = 5\n\nfor n as Integer = 1 to 10\ni = GPIO.DigitalRead(kFlameSensorPin)\n\nif i = 0 then \/\/ Note the zero here since the signal from this one is inverted.\nListbox1.AddRow \u201cFlame detected\u201d\nreturn\nend if\nApp.DoEvents(1)\nnext\n\nEnd Sub<\/pre>\n<p>Thats all there\u00a0is to it!<\/p>\n<p>(Updated 18. Oct 2015, adding US-015 sensor and sensor specs)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this example we are going to connect to flame\u00a0sensor. Programming for this sensor works on exactly the same principle as the\u00a0HC-SR501 infrared sensor and the F85 vibration sensor except the signal from this sensor comes inverted. As in it will send 1 when everything is all right and zero if it sees flame. I &hellip; <a href=\"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/flame-sensor\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Flame sensor<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":94,"menu_order":20,"comment_status":"open","ping_status":"closed","template":"","meta":{"spay_email":""},"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/Pd75nk-1P","jetpack-related-posts":[{"id":108,"url":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/f85-vibration-sensor\/","url_meta":{"origin":113,"position":0},"title":"F85 Vibration sensor","date":"September 19, 2015","format":false,"excerpt":"In this example we are going to connect to\u00a0vibration sensor. This example is super easy after doing the infrared motion detection with the HC-SR501 in a previous example, since basically same code will work. I found this sensor to be excellent, it gives readings when I expect it to and\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"https:\/\/i1.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/Sensor-connection-e1442664059628-225x300.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":137,"url":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/ir-infrared-obstacle-reflection-photoelectric-sensor\/","url_meta":{"origin":113,"position":1},"title":"IR Infrared Obstacle Reflection Photoelectric Sensor","date":"September 20, 2015","format":false,"excerpt":"In this example we are going to connect to infrared obstacle reflection photoelectric sensor motion detection sensor. I am not going to deny it, I find this sensor to be awful rubbish. Without reading the data you can hook it up and see it when the 2nd green lights goes\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/IRSensor-e1442754741492-225x300.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":128,"url":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/dht11-and-dht22-humidity-temperature-sensors-3-pin-version\/","url_meta":{"origin":113,"position":2},"title":"DHT11 and DHT22 humidity & temperature sensors (3 pin version)","date":"September 20, 2015","format":false,"excerpt":"In this example we are going to connect\u00a0to DHT11 and or DHT22 humidity & temperature sensor. This sensor reads both the humidity and temperature. (This guide was updated on 24. Oct 2015, greatly improving the DHT11 device driver code and added DHT22 device driver code and wiring pictures for the\u2026","rel":"","context":"Similar post","img":{"alt_text":"DHT22 sensor","src":"https:\/\/i0.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/DHT22.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":617,"url":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/bmp180-barometer-sensor\/","url_meta":{"origin":113,"position":3},"title":"BMP180 Barometer sensor","date":"May 22, 2016","format":false,"excerpt":"In this example we are going to connect to BMP180 barometer sensor, we will be using brake-out board called GY-68. This sensor is really small even the full brake-outboard is only size of a fingernail. The board does not come with the header pins soldered on, but with mine the\u2026","rel":"","context":"Similar post","img":{"alt_text":"BMP180Soldered","src":"https:\/\/i1.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2016\/05\/BMP180Soldered.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":345,"url":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/using-logic-gates\/","url_meta":{"origin":113,"position":4},"title":"Using logic gates","date":"November 8, 2015","format":false,"excerpt":"In this guide we are going to learn how to use logic gates. \u00a0Even if you can usually do things by just taking more GPIO pins and do the logic in a code then there will be times you may want to do things in hardware. For example you might\u2026","rel":"","context":"Similar post","img":{"alt_text":"LogicCircuits","src":"https:\/\/i2.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/11\/LogicCircuits.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":165,"url":"https:\/\/einhugur.net\/blog\/index.php\/xojo-gpio\/hc-sr04-ultrasonic-sensor\/","url_meta":{"origin":113,"position":5},"title":"HC-SR04 and US-015 - Ultrasonic sensors","date":"September 22, 2015","format":false,"excerpt":"In this example we are going to connect to HC-SR04 and or US-015\u00a0ultrasonic sensor. (Updated 18. Oct 2015, adding US-015 sensor and sensor specs) (Updated 18. Apr 2016, adding more info for accuracy for the HC-SR04 sensor) A ultrasonic sensor will send ultrasonic sound out which will echo on objects\u2026","rel":"","context":"Similar post","img":{"alt_text":"Ultrasonic wiring","src":"https:\/\/i1.wp.com\/einhugur.com\/blog\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-22-at-00.01.38.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/pages\/113"}],"collection":[{"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":17,"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/pages\/113\/revisions"}],"predecessor-version":[{"id":972,"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/pages\/113\/revisions\/972"}],"up":[{"embeddable":true,"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/pages\/94"}],"wp:attachment":[{"href":"https:\/\/einhugur.net\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}