Introduction: Fireplace Friend

So that's the new fireplace our very nice landlady had installed for us when we moved in here a few years ago. It's small, cheerful, and doesn't really take large firewood pieces. It's also a fair way from my seat in the lounge room, and out of sight of me behind a short wall. This means that unless I'm supernaturally tuned in to the fire, it keeps going out. As we found out for the first year. So what to do, what to do?

The second winter, I was going to be prepared. I'd been buying up bits and pieces of hardware that bolts, plugs, or connects to Arduino boards, and had a few Unos sitting around wanting jobs to do. The project took shape that first spring, and by next autumn I'd built it, used it, and then disassembled it again after the second winter because this year I'll be extending th scope of the project considerably.

I know the more cynical might be saying "put up a chunk of mirror" or even "sit in another chair in the lounge" but that's kind of evading the technology and engineering that could be applied. %) Anyway - this was a bit of fun to play with.

So What Does It Do?

This is one of those "fun but overkill" things. I needed some way (other than getting up every half hour and checking) to tell when the fire had burned down and needed to be re-laid. The Uno is in effect acting like a repeater, lighting a LED when the infrared output of the fire fell below a certain threshold. I worked that out by trial and error, and every time the flames went out and the coals stopped giving off infra-red, the LED was my signal to get up and lay more wood in the fire. It's automation of the act of getting up and checking the fire.

Step 1: The Bits

The parts I used were

Arduino Uno (shown in the photo with some sensor wires attached, perhaps not the same pins as I ended up using, a bit long ago now to remember.)

IR / Flame sensor (the foreground bit in the other photo, with what looks like a black LED pointing to the right.) This turned out to be a bit different to what I'd been expecting, but worked in the end.

An LED and 330 ohm resistor. (not shown)

Some old phone cable.

A USB plugpack and a small cardboard box to hide the Uno in, a few ends of double sided tape, some electrical tape, and some bendable solid wire for holding the sensor in place.

The tools used were just general hand tools, soldering iron, pliers, etc.

Step 2: Assembly and Setup

Putting it together was easy - the flame sensor has four pins, two of which are supply (it runs on 5V) and it supplies a switched output and an analog signal. As I didn't want to mess with adjusting the trigger point on the sensor every time I wanted to change it, I just used three lines of the telephone cable to wire it up +, -, and A (for Anaog) and set the trigger point in the software.

The LED was also simple, wire two of the wires in a second piece of telephone cable to the pins, and a resistor in series with one of the LED's pins. (Doesn't matter which one.)

The wire from the sensor + goes to 5V supplied by the Uno on board regulator, no problem, it doesn't draw much current at all.

The wire from the sensor - goes to the Uno ground, and the A (analog output) wire I put to A1 on the Uno.

The LED is connected between Uno ground and digital pin 4. Which way around? Put one wire in the GND and the other on 5V. If that works, transfer the wire from the 5V point to D4. If not, reverse the leads and try again.

So I connected it all up, uploaded the sketch to the Uno, pointed the sensor at the fireplace, and . . . nothing . . .

Turns out fires, infrared radiation, and these sensors, really do feel the effect of the inverse square law. That was annoying. I thought perhaps the lens end of the IR detector (the black LED looking thing) might focus some IR energy but it was either too sharply focused or else there just wasn't enough signal around.

At this point I had the serial communications and a few lines of debugging code turned on and the Uno plugged into a laptop, so I could see the analog signal not changing no matter how I aimed the sensor at the fireplace door, and I experimented with how close I actually needed to put that "Flame Sensor" as the documentation called it.

Turns out that the ideal distance between the door of the fireplace and the sensor would have been around 50cm or so. Since you really shouldn't have anything that close to the fireplace without heat shielding, and also because whatever it was would be sitting there sticking up smack dab in the middle of the only walkway between the kitchen and the rest of the house, that was obviously out of the question.

I found out that I could also put the sensor up to 1.1m away from the fireplace door and still get a usable reading provided I was quite accurate about pointing it. Luckily, 1.1m away was where my home made food dehydrator is, and it had a vent hole that was pretty much in line with the glass and about 80cm up. I bent a wire clip that attached to the vent, and let me tape the sensor to it, just inside the cabinet and with just the sensor sticking out, aimed pretty much directly where I wanted it.

The rest was easy. A longer piece of phone cable was soldered to the sensor, run under the countertop to the shelf in the kitchen were the power point was, the Uno in its little cardboard box was stuck to the underside of the shelf with a piece of double-sided tape, and the LED taped where I had clear line of sight from my comfy chair.

Next stop, the program.

Step 3: The Program

The program is pretty simple. There's two lines in the main loop that read the signal, scale and invert it, then stores that in a variable, and then a second section compares that variable to a variable I set up as a threshold, and if the signal from the detector has exceeded the threshold value, turns on the LED, otherwise turns it off. The program then sleeps for a few seconds and does it all again.

The reason for using scaling was that it was the easiest way to make the sensor give a sensible reading, and one that could if need be, be stored in a small memory space. The sensor analog output goes between 1024 with no IR detected to 0 when it's at the extreme end, and it's much easier to work with if that becomes 0 at the no IR end to 254 at the upper threshold.

The "map(value, fromLow, fromHigh, toLow, toHigh)" is a really useful program element to remember if you want to scale a variable to make it fit a schema, saves heaps of brainwork.

Anyhow - the original code is lost, this sketch is close but not the original code.

Step 4: Into the Future!

It's June and here in Australia that's winter. I'm back indoors and so I'll be building a new FPF and adding bells and whistles, and maybe this time I'll take more photos as well.

The kitchen and dining room have gained a few metres of LED strip lights all over the place, in each case attached only with blu-tack or pins (we're renting) and placed in locations where they're needed. The whole area's well lit with maybe 10W worth of these lights, and they replace a 40W fluoro fixture, a few 30W - 50W quartz halogen bulbs, and several 15W work lights, so the overall saving is considerable, but I'd like to take them off manual switching with plug packs all over the place, and use a few PIR sensors and a time delay to manage them.

And there's a gas/smoke detector I might want to monitor as well, and other things like room temperature.

So the next version will probably be on an Arduino with an ESP8266 shield or some similar web enabled board so I can see it all at a glance and maybe switch a few things manually.