{"id":52241,"date":"2026-11-01T10:50:44","date_gmt":"2026-11-01T10:50:44","guid":{"rendered":"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/"},"modified":"2026-11-01T10:50:44","modified_gmt":"2026-11-01T10:50:44","slug":"flame-sensor","status":"publish","type":"siratek_tutorial","link":"https:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/","title":{"rendered":"Flame Detection with an Infrared Sensor"},"content":{"rendered":"<body><p><\/p>\n<h2>What it does<\/h2>\n<p>The black teardrop on the end of the board is a photodiode filtered to respond to infrared, roughly in the band a flame emits most strongly. Point it at a fire and an LM393 comparator on the board pulls its output pin low.<\/p>\n<p>It is not a smoke detector and it is not a heat sensor. It is a sensor for <strong>light of a particular colour<\/strong>, and a flame happens to produce a lot of it. So does the sun, and so does an incandescent bulb, which is most of what you need to know about where it will and will not work.<\/p>\n<h2>Before you begin<\/h2>\n<h3>Required parts and tools<\/h3>\n<ul>\n<li>An Arduino Uno or compatible board.<\/li>\n<li>One flame detection module. This is Siratek product 2901, marked <code>HL-01<\/code> on the board.<\/li>\n<li>Three female-to-male jumper wires.<\/li>\n<\/ul>\n<h3>Three pins, not four<\/h3>\n<p>This is the thing to check before you write any code. The Siratek board has a <strong>three-pin header, silkscreened <code>DO GND VCC<\/code><\/strong>. There is no <code>AO<\/code>.<\/p>\n<p>That makes it different from the soil moisture, gas and sound modules, which all give you an analog pin as well. Here the sensitivity trimmer on the board is your only control, and there is no way to see the underlying level from the Arduino.<\/p>\n<p>Four-pin versions of this sensor exist and are worth buying if you want the analog reading. If yours has four pins, treat the extra one as <code>AO<\/code> and read it with <code>analogRead()<\/code>; everything else below still applies.<\/p>\n<h3>Low means fire<\/h3>\n<p>The comparator\u2019s output is <strong>active low<\/strong>: <code>DO<\/code> sits HIGH normally and goes <strong>LOW<\/strong> when flame is detected.<\/p>\n<p>This catches people, because \u201cdetected\u201d instinctively reads as HIGH. Name the states in your code and the problem disappears, which is what the example below does.<\/p>\n<h3>Setting the trimmer, without an analog pin<\/h3>\n<p>With no <code>AO<\/code> to measure, the procedure is mechanical:<\/p>\n<ol>\n<li>Power the board and look at the indicator LED that follows <code>DO<\/code>.<\/li>\n<li>With no flame present, turn the trimmer until that LED just goes out.<\/li>\n<li>Back it off a little further, so ordinary room light cannot trip it.<\/li>\n<li>Test with a real flame at the distance you care about, and adjust.<\/li>\n<\/ol>\n<p>Do this with the room lit as it will normally be. Setting it in the dark and then switching a lamp on will trigger it.<\/p>\n<h3>Range, and what else it sees<\/h3>\n<p>Expect something under a metre for a candle, less at an angle: the sensor has a cone of view of around 60 degrees and is much less sensitive off-axis.<\/p>\n<p>It will also respond to <strong>direct sunlight<\/strong>, an <strong>incandescent or halogen bulb<\/strong>, and a hot soldering iron at close range. It will <strong>not<\/strong> see a flame through glass that blocks infrared, and it will not see smoke at all.<\/p>\n<h3>What this sensor is honestly for<\/h3>\n<p>It is a component for learning and for hobby projects. It is not a fire alarm.<\/p>\n<p>A real fire alarm is a certified device that is tested, powered independently, audible from anywhere in the building, and designed to fail safely. This module is none of those things: it sees one direction, it can be fooled by sunlight, and if the Arduino crashes it reports nothing at all.<\/p>\n<p>Build the project. Enjoy it. Keep a proper smoke alarm on the ceiling.<\/p>\n<h2>Pin reference<\/h2>\n<table>\n<thead>\n<tr>\n<th>Pin or label<\/th>\n<th>Connect to<\/th>\n<th>Purpose<\/th>\n<th>Notes<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>DO<\/code><\/td>\n<td>Uno <code>D2<\/code><\/td>\n<td>Detection output<\/td>\n<td><strong>LOW means flame<\/strong><\/td>\n<\/tr>\n<tr>\n<td><code>GND<\/code><\/td>\n<td>Uno <code>GND<\/code><\/td>\n<td>Ground<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><code>VCC<\/code><\/td>\n<td>Uno <code>5V<\/code><\/td>\n<td>Power<\/td>\n<td>3.3 V also works<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<figure class=\"siratek-tutorial-figure\"><img decoding=\"async\" src=\"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/flame-sensor-wiring.svg\" alt=\"A three-pin flame sensor module with DO on pin 2, GND to ground and VCC to 5V, with the output marked active low\" loading=\"lazy\"><figcaption>Three pins only on this board. DO goes LOW when flame is detected.<\/figcaption><\/figure>\n<h2>Wiring steps<\/h2>\n<ol>\n<li>Unplug the USB cable.<\/li>\n<li><code>GND<\/code> to <code>GND<\/code>.<\/li>\n<li><code>VCC<\/code> to <code>5V<\/code>.<\/li>\n<li><code>DO<\/code> to <code>D2<\/code>.<\/li>\n<li>Plug the USB cable back in. The power LED should light at once.<\/li>\n<\/ol>\n<h2>Software and libraries<\/h2>\n<p>No library is required. Use plain <code>INPUT<\/code>; the comparator drives the pin both ways.<\/p>\n<h2>Minimal working example<\/h2>\n<pre><code>\/\/ Siratek: flame detection on an active-low module.\n\nconst int flamePin = 2;\nconst int ledPin = 13;\n\n\/\/ This board pulls the pin LOW when it sees flame.\nconst int FLAME_DETECTED = LOW;\n\nint lastState = HIGH;\n\nvoid setup() {\n  pinMode(flamePin, INPUT);\n  pinMode(ledPin, OUTPUT);\n\n  Serial.begin(9600);\n  Serial.println(\"Siratek: flame sensor ready.\");\n}\n\nvoid loop() {\n  int state = digitalRead(flamePin);\n\n  if (state != lastState) {\n    lastState = state;\n\n    bool flame = (state == FLAME_DETECTED);\n    digitalWrite(ledPin, flame);\n    Serial.println(flame ? \"FLAME\" : \"clear\");\n  }\n}<\/code><\/pre>\n<p>Naming the constant is what keeps this readable. <code>if (digitalRead(flamePin) == LOW)<\/code> is correct and tells a future reader nothing; <code>FLAME_DETECTED<\/code> tells them everything, and it is the one line to change if you swap in a board that works the other way round.<\/p>\n<h3>Not reacting to a flicker<\/h3>\n<p>A candle flickers, something passes in front of the sensor, and a single reading catches the wrong moment. For anything that sounds an alarm, require the condition to persist.<\/p>\n<pre><code>\/\/ Siratek: only report flame that has been present continuously.\n\nconst int flamePin = 2;\nconst int buzzerPin = 8;\n\nconst int FLAME_DETECTED = LOW;\nconst unsigned long mustPersist = 1000;   \/\/ milliseconds\n\nunsigned long firstSeen = 0;\nbool alarming = false;\n\nvoid setup() {\n  pinMode(flamePin, INPUT);\n  pinMode(buzzerPin, OUTPUT);\n  Serial.begin(9600);\n}\n\nvoid loop() {\n  bool flame = (digitalRead(flamePin) == FLAME_DETECTED);\n\n  if (flame) {\n    if (firstSeen == 0) {\n      firstSeen = millis();\n    } else if (!alarming &amp;&amp; millis() - firstSeen &gt;= mustPersist) {\n      alarming = true;\n      digitalWrite(buzzerPin, HIGH);\n      Serial.println(\"FLAME held for one second\");\n    }\n  } else {\n    firstSeen = 0;\n    if (alarming) {\n      alarming = false;\n      digitalWrite(buzzerPin, LOW);\n      Serial.println(\"clear\");\n    }\n  }\n}<\/code><\/pre>\n<p>This is the same idea as debouncing a button, applied to a sensor: a reading has to mean something for a while before it counts. It is worth keeping for any detector that triggers something noticeable.<\/p>\n<h2>Expected result<\/h2>\n<p>The indicator LED on the board, and the Arduino\u2019s pin 13, both follow the flame. A lighter held twenty or thirty centimetres away should trigger it reliably once the trimmer is set.<\/p>\n<p>Move the flame off to one side and detection falls away quickly. That cone is narrow, and it is the main thing to plan around when mounting the sensor.<\/p>\n<h2>Troubleshooting<\/h2>\n<table>\n<thead>\n<tr>\n<th>Symptom<\/th>\n<th>Likely cause<\/th>\n<th>Check or fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Reports flame constantly<\/td>\n<td>Trimmer too sensitive, or sunlight<\/td>\n<td>Reset the trimmer in normal room light<\/td>\n<\/tr>\n<tr>\n<td>Logic looks inverted<\/td>\n<td>The board is active low<\/td>\n<td>LOW means flame; use the named constant<\/td>\n<\/tr>\n<tr>\n<td>Never detects anything<\/td>\n<td>Trimmer backed off too far<\/td>\n<td>Turn it back until the LED just goes out, then slightly more<\/td>\n<\/tr>\n<tr>\n<td>No power LED<\/td>\n<td><code>VCC<\/code> or <code>GND<\/code> not connected<\/td>\n<td>Check both<\/td>\n<\/tr>\n<tr>\n<td>Detects only very close<\/td>\n<td>Normal, plus trimmer setting<\/td>\n<td>Under a metre is typical for a candle<\/td>\n<\/tr>\n<tr>\n<td>Misses a flame to one side<\/td>\n<td>Cone of view is about 60 degrees<\/td>\n<td>Aim it, or use more than one<\/td>\n<\/tr>\n<tr>\n<td>Triggers when a lamp is switched on<\/td>\n<td>Incandescent bulbs emit infrared<\/td>\n<td>Reposition, or reduce sensitivity<\/td>\n<\/tr>\n<tr>\n<td>Looking for <code>AO<\/code> and not finding it<\/td>\n<td>This board has three pins<\/td>\n<td>Use the trimmer, or buy the four-pin version<\/td>\n<\/tr>\n<tr>\n<td>Triggers on a brief flicker<\/td>\n<td>Single reading caught a moment<\/td>\n<td>Require the state to persist<\/td>\n<\/tr>\n<tr>\n<td>Reports nothing after a crash<\/td>\n<td>The Arduino has stopped<\/td>\n<td>Why this is not a fire alarm<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Next steps<\/h2>\n<ul>\n<li><strong>Easier first:<\/strong> <em>Read a Push Button<\/em>, the same <code>digitalRead()<\/code> with no comparator.<\/li>\n<li><strong>Related products:<\/strong> the MQ-2 gas sensor for smoke and gas, and an active buzzer for an alert.<\/li>\n<li><strong>Next project:<\/strong> a bench alarm that combines flame and gas detection, with the limits of both written on it.<\/li>\n<\/ul>\n<h2>Sources and attribution<\/h2>\n<p>All text, wiring guidance and code in this tutorial are original Siratek work.<\/p>\n<ul>\n<li>The three-pin <code>DO GND VCC<\/code> header and the <code>HL-01<\/code> board marking were read from the Siratek product photographs for item 2901, which is why this tutorial treats the analog output as absent rather than optional.<\/li>\n<\/ul>\n<p>Detection range and the cone of view are given as typical figures that depend on the trimmer setting, the flame and the angle. The statement that this module is not a substitute for a certified fire alarm is a deliberate limitation of scope. No third-party tutorial text, diagrams, photographs or code has been reproduced here.<\/p>\n<p><\/p>\n<\/body>","protected":false},"excerpt":{"rendered":"<p>The black teardrop on the end of the board is a photodiode filtered to respond to infrared, roughly in the band a flame emits most strongly. Point it at a fire and an LM393 comparator on the board pulls its&#8230;<\/p>\n","protected":false},"featured_media":0,"template":"","siratek_tutorial_level":[],"class_list":["post-52241","siratek_tutorial","type-siratek_tutorial","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Flame Detection with an Infrared Sensor - siratek<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Flame Detection with an Infrared Sensor - siratek\" \/>\n<meta property=\"og:description\" content=\"The black teardrop on the end of the board is a photodiode filtered to respond to infrared, roughly in the band a flame emits most strongly. Point it at a fire and an LM393 comparator on the board pulls its...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/\" \/>\n<meta property=\"og:site_name\" content=\"siratek\" \/>\n<meta property=\"og:image\" content=\"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/flame-sensor-wiring.svg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/flame-sensor\\\/\",\"url\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/flame-sensor\\\/\",\"name\":\"Flame Detection with an Infrared Sensor - siratek\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/siratek.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/flame-sensor\\\/#primaryimage\"},\"image\":{\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/flame-sensor\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/siratek.net\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flame-sensor-wiring.svg\",\"datePublished\":\"2026-11-01T10:50:44+00:00\",\"breadcrumb\":{\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/flame-sensor\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/flame-sensor\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/flame-sensor\\\/#primaryimage\",\"url\":\"https:\\\/\\\/siratek.net\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flame-sensor-wiring.svg\",\"contentUrl\":\"https:\\\/\\\/siratek.net\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flame-sensor-wiring.svg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/flame-sensor\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/siratek.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"https:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Flame Detection with an Infrared Sensor\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/siratek.net\\\/#website\",\"url\":\"https:\\\/\\\/siratek.net\\\/\",\"name\":\"siratek\",\"description\":\"Your Best Electronic Retail Shop\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/siratek.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Flame Detection with an Infrared Sensor - siratek","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/","og_locale":"en_US","og_type":"article","og_title":"Flame Detection with an Infrared Sensor - siratek","og_description":"The black teardrop on the end of the board is a photodiode filtered to respond to infrared, roughly in the band a flame emits most strongly. Point it at a fire and an LM393 comparator on the board pulls its...","og_url":"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/","og_site_name":"siratek","og_image":[{"url":"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/flame-sensor-wiring.svg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/","url":"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/","name":"Flame Detection with an Infrared Sensor - siratek","isPartOf":{"@id":"https:\/\/siratek.net\/#website"},"primaryImageOfPage":{"@id":"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/#primaryimage"},"image":{"@id":"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/#primaryimage"},"thumbnailUrl":"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/flame-sensor-wiring.svg","datePublished":"2026-11-01T10:50:44+00:00","breadcrumb":{"@id":"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/#primaryimage","url":"https:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/flame-sensor-wiring.svg","contentUrl":"https:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/flame-sensor-wiring.svg"},{"@type":"BreadcrumbList","@id":"http:\/\/siratek.net\/index.php\/tutorials\/flame-sensor\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/siratek.net\/"},{"@type":"ListItem","position":2,"name":"Tutorials","item":"https:\/\/siratek.net\/index.php\/tutorials\/"},{"@type":"ListItem","position":3,"name":"Flame Detection with an Infrared Sensor"}]},{"@type":"WebSite","@id":"https:\/\/siratek.net\/#website","url":"https:\/\/siratek.net\/","name":"siratek","description":"Your Best Electronic Retail Shop","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/siratek.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial\/52241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial"}],"about":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/types\/siratek_tutorial"}],"version-history":[{"count":0,"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial\/52241\/revisions"}],"wp:attachment":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/media?parent=52241"}],"wp:term":[{"taxonomy":"siratek_tutorial_level","embeddable":true,"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial_level?post=52241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}