Controlling a heater with an Arduino

so… total noob here :wink:

got an arduino as a gift and been messing around with it and have successfully got it tracking temperature in my room.

my fireplace (a gas fire) has an on/off switch that can have an external remote attached (see page 32 / section 7.2 http://napoleonproducts.com/downloads/fireplaces/manuals/W415-1337.pdf) so you can guess what I’m trying to work out how to do…

I’d like to take the existing arduino that’s monitoring the temperature and apply some smoothing to the graph (so it’s not constantly toggling) and have it control the on/off switch …

problem is… I don’t have a clue where to start, so can’t even do sensible searches! I’m guessing I need to use a relay to open/close the circuit in the fireplace?

any guidance, pointers or even better Bing search terms than what I’ve been trying would be gratefully received :slight_smile:

Start with the blink sketch and learn how to programme an arduino.

Controlling anything gas related could have serious safety implications but if your boiler is designed for external inputs it should not be a problem.

Heating systems generally use simple thermostats at mains voltage.
I am not sure what you want to do , can you elaborate.

As Boardburner2 said, Safety first (its not just a catch line)!!!! What you are doing could result in injury, damage to property, loss of property, and possibly death. Make sure everything is PERFECT before letting the system do its thing on its own, and even then, id keep an eye on it. My help does not imply liability in any form, if you blow something up, that's on you. That being said, here I go....

I am actually working on a heating controller myself, but its working on MUCH higher temperatures. It works, but I'm having some tuning issues. For your project, you probably don't need the PID to control temperature, you can probably do it by an if statement of the temp, when its too low, turn on heat, when its too high turn off heat. Give it a bit of wiggle room and the temp will probably slowly rise and fall around the desired temp.

Here is a topic of my project. The main code is there, the libraries are easy to find, and it might get you started if its not too complicated for you to look through (it has no notes or comments).

As for the smoothing of the graph, I had a similar situation with the graph on my projects display, I ended up showing only the portion of the y axis that was relevant, and limited the top and bottom range so that the lowest value in the graph is at the bottom of the graph, and the highest value is at the top, as the lowest and highest values change, so does the scale. See the GraphTop and GraphBot variables to see how I did this. Of course, this is assuming you made your own graph, since you did not specify your graphs details.

Good search terms would be "Bang-Bang regulator" or "Temperature PID Controller". There is a PID library, the Bang-Bang system youll have to research and build yourself, I wasnt able to find a library, and it seems simple enough to not need one.

How everything hooks up is going to depend drastically on your input options on the fireplace and the tools you have to manipulate them and the approach you want to take. It looks like you've started answering some of your own questions with the relay question at the end, thats a good place to start. Based on what you have provided, It looks like you could put a relay (or better a SSR), in place of the thermostatic accessory. Alternatively, you could use something like a solenoid or servo to toggle the switch, or replace the switch entirely, or...well you get the idea...lots of options.

Hope this helps.

So long have you dont try to play with the gas fire an it is can be controlled by an external signal i do not see a problem,.
If mains electricity is involved however in the UK that would be covered by part p legislation requiring a suitably certified person o sign it off.

I've noticed that my home AC/heating system will wait about two minutes if I change it from AC to heat, and set the temp up to get heat. What that means, I think, is that the folks who designed it decided that a two minute average of ambient temperature was about right for initiating actions.

As to not having it cycle too often, that's called hysteresis: that means that if you turn it on at, say 72 deg. F, you will let it run 'til it hits, say 74, before shutting it off. That is a range you can tune as the circumstances warrant.

jrdoner:
I've noticed that my home AC/heating system will wait about two minutes if I change it from AC to heat, and

As to not having it cycle too often, that's called hysteresis: that means that if you turn it on at, say 72 deg. F, you will let it run 'til it hits, say 74, before shutting it off. That is a range you can tune as the circumstances warrant.

jrdoner:
I've noticed that my home AC/heating system will wait about two minutes if I change it from AC to heat, and set the temp up to get heat. What that means, I think, is that the folks who designed it decided that a two minute average of ambient temperature was about right for initiating actions.

As to not having it cycle too often, that's called hysteresis: that means that if you turn it on at, say 72 deg. F, you will let it run 'til it hits, say 74, before shutting it off. That is a range you can tune as the circumstances warrant.

yes most heating systems have hysteresis.

There are good reasons for that.

Without it there would be many off on cycles which are undesirable especially for mechanical switches (thermostats) and pumps,

pick a different project.

you cannot use a heater that has only an ON/OFF control as a variable output device. what you will wind up with in the end is a lot of experience and a project that has a thermostat, and you cursing.

put another way, say you have a car that only does 60MPH and your tools are a start switch and a boat anchor as a brake.

when you turn on the heater, it opens a gas valve, the heater gets hot, then radiates heat. over time that will warm the room.

if you try to short cycle it, you will wear out the valve.

by all means, try it, but do not get your hopes up for a successful result. the way heaters are designed are to run turn on, heat up, turn off and cool down. heat the room, called a thermal mass. and that thermal mass is what you are really after. insulat that and you have less thermal interaction with the outside. less need for heat. insulat it too much and you will heat it with body temperature alone and always be looking for cooling, 365 days a year, just like office buildings.

dave-in-nj:
you cannot use a heater that has only an ON/OFF control as a variable output device. what you will wind up with in the end is a lot of experience and a project that has a thermostat, and you cursing.

...

when you turn on the heater, it opens a gas valve, the heater gets hot, then radiates heat. over time that will warm the room.

...

Um...actually...he can do exactly that...and you gave the first steps to a basic project already. Add to the second line I quoted: when the room is warm enough, turn off the gas valve, the heater cools off and stops radiating heat, over time that will let the room cool, when its too cold, repeat.

The arduino by its digital nature already provides the on/off control method, one only needs to use that 5v (or 3.3v) on and off to control the actual on and off of the other device (heater in this case).

I may not be an expert by any means, but I know this is COMPLETELY possible and actually quite simple compared to most of the projects I see people requesting help for.

thanks for the responses.

the reason for including the PDF for the heater was to reassure folks that I wasn’t working with gas or mains voltage directly :slight_smile:

the heater only has an on/off switch (that can be controlled by an IR remote, or physically toggling the switch) and that is what I want to control from the Arduino.

the idea is that I will have one board that’s tracking temperature and if it drops below a certain level for a certain amount of time it will trigger the second board to turn the heater on. If temperature holds steady above a certain level for a certain amount of time then the system will send the off request.

I will actually have a number of devices tracking temperature inside and outside the house and updating a web service. The board attached to the heater will poll every x seconds/minutes to see if it needs to change status. Potentially also could monitor the NEST CO2/Smoke detector and if that detects a problem send the off signal.