Cozy Heat Control With An Arduino

Control the heat with a PID

[George Dewar] and his wife live in a typical 1940’s house in New Zealand , which in case you didn’t know, have a little insulation in the ceiling… and nowhere else. Like most, they put up with the cold — but after having a baby, [George] decided it was time to start controlling the heat a bit better.

They have an electric oil radiator which works well, but isn’t very smart. It only has 6 settings — not very useful when you’re trying to stay at a certain temperature. First off, they looked into a plug-in thermostat controller, and found a cheap one called the HeaterMate. Unfortunately it left a lot to be desired. For example, it didn’t seem to have PID control at all — and for an oil radiator, when you turn it off… it’s still going to heat the room for a while. He also found that because of the high current load of a heater … the device would read a few degrees over room temperature when operating. Unperturbed, [George] took this opportunity to design and build his own PID thermostat controller instead. 

He’s using an Arduino Uno clone called the Seeduino Lotus, which has easy to use Grove connectors on it for interfacing with their plug-in modules. A temperature sensor monitors the room temperature from afar, and a solid-state relay (SSR) controls the power for the heater. Now he just needed a PID library — readily available from Arduino.cc of course. All in all it works way better than the store-bought solution, and [George] already has plans to make it even better — and if you have a use for this kind of thing, he’s posted everything over on GitHub.

For a more complex Arduino thermostat build, we love this one by [William] which even includes a vacation mode — and yes, it is internet connected.

22 thoughts on “Cozy Heat Control With An Arduino

  1. Not to wonder too much here – but unless they are renters why not add some insulation also? Depending on the type of construction not too hard to do, if he can design a fancy thermostat he should be able to add insulation, save money and make the house much more comfortable. I have helped a couple of friends add insulation in the past, takes a day or three depending the size of the house, was a DIY thing both times

    1. The home likely has plaster and lath walls, it’s not worth it most times because of how destructive you have to be with it. there are services that will blow in insulation through strategic holes in the walls, but they’re so expensive that people ignore the amount of work and money they would save doing it any other way and continue life without insulation.

      1. One house I helped add insulation to – we drilled holes in the top plate in the attic and poured granulated insulation into the walls. did not get under the windows but helped quite a bit. Also extra fiberglass bats in the attic help a lot and are easy to do.

      2. Thanks captnmike, I agree. We are actually in the process of adding more insulation in the ceiling, and considering doing the walls of the bedrooms too. We’ve also put a retrofit double glazing film on the windows. The house is not actually difficult to insulate. They’re solving different problems though. Insulation will save us money by requiring less heating, but we will still require *some* heating in winter. This solution achieves the climate control convenience and comfort of simply setting a desired temperature, which was the main point.

      3. I have plaster and lath and STONE exterior and blown in using very small drilled holes was inexpensive. It paid for it’s self in 3 heating seasons.

        People that think that adding insulation is not worth it are not paying attention. If you own the home insulating it and replacing the windows will save you so much money it’s silly. My air-conditioning bill alone dropped from $260 per month to $102 per month Heat in the winter had the same more than 50% savings.

        The $3800 I spent on insulation is now making me money as I am 5 years later and still saving the money every single month.

      4. Insulation isn’t the only way to go. Most hardware stores carry several types of peel and stick window film that drastically drops the temperature and excess light. One roll usually does 2-4 windows.

        I installed it at my sisters place and the temp dropped several degrees in the living room while I was sizing the film alone.

        Home depot carries it for about $45 a roll.

  2. If the guy is happy, then good for him. But I don’t think PID control is called for here. Now, I might be partial but the STC-1000 thermostat is really cheap, offers tighter hysteresis control and allows you to place the probe where you want it.

      1. Better is subjective. Thermostat control may well good enough to keep a stable temperature, keeps cycling to a minimum and does not require tuning.
        But yes, if PI(D) control is desired then a cheap PID module would definately work.

        1. I wasn’t certain myself, but my hunch was that given the time the heater takes to heat up when turned on, and cool down when turned off, and any other factors that introduce lag into the system, a simple thermostat control even with a very tight cycle would result in unnecessary oscillation. Implementing PID was easy and didn’t cost any extra, so I didn’t see much of a downside. I’m curious though, what do most A/C thermostats do? Are they mostly just simple thermostats?

          That STC-1000 looks pretty cool. I did have a look around at that sort of thing, but I had ideas about making this into a nice wall-mounted unit which the form factor of something like an STC-1000 wouldn’t appear to permit. Are they often used for controlling space heaters?

          1. I don’t know if I’d say they are often used for space heaters, but they are used for a lot of applications.
            Unneccessary oscillation? You wouldn’t notice if the room was 0.5 deg C too cold :) I really don’t think you’d overshoot by much from the residual heat either.
            My guess would be that the most common control in heating/cooling would be simple bimetal thermostats, that are a lot less accurate but still probably good enough in most cases.

  3. Reblogged this on heavydiy and commented:
    I think we’re clearly at a point where Arduino, Raspberry Pi, Beaglebone, etc, are no longer toys but are solving real world problems.

    I use Raspberry Pi and Beaglebone at work now to replace large and expensive, less than reliable systems and while there have been some growing pains, the advantages of these open source boards far outweigh any hassles.

  4. It is often cheaper to purchase something on Ebay to fix the problem, but having a go to solve it yourself is way more satisfying, not to mention more in the spirit of Hackaday. Thumbs up to James!
    I too live in a “top only” insulated house (in Oz) and am thinking of ways to insulate walls.

    1. Thanks dendad. Is yours a wooden house too? For us, I worked out that it’d be a good investment to reline the walls and insulate, if we do everything ourselves except plastering. It becomes far more favorable if you have old wallpaper you want to get rid if like we do.

  5. If he used a SSR, he could have it cycle very fast or even do phase angle control. I would recommend cycle by cycle zero cross switching since it gives excellent control without the EMI issues that phase angle control can cause.

    A heat pump would make even more sense, but doing advanced control on those is a lot more complex…

  6. While I guess it’s quite nice to have a fully PID controller, how is the actuator (heater, in this case) controlled proportionally. It’s connected via a SSR, which I believe is only on/off. Perhaps it’s temporary proportional, in that its on/off period is controlled proportionally, with the length of the on section being related to the integral of the error?

    Anyone care to shed some light on this?

    1. It’s basically a duty cycle. I’m not actually using an SSR, I’d just like to (that bit got lost in translation to the HaD writeup). If I did use one, the cycle could be sub-second and the switching would be silent. I’m currently using a 20 minute cycle which works fine – the room temperature doesn’t even shift 0.1 degree in the time it’s on. The output of the algorithm is capped between 0 and 100 and translates to “percent of time heater is on”.

    2. That’s pretty much it. My experience with PID is from a Watlow controller on an environmental shock chamber. Cooling and heat in the cold bay, and heat in the hot bay all controlled with PWMed SSRs. There was an option for continuously variable, zero-crossing modulation on the heat channel, but since the heater was three-phase we left everything on a 4-second cycle. The proportion, integral, and derivative all combine (additive, I think) to determine what percent of the cycle will be “on”. I’m not sure how it handled the transition from cooling to warming in the cold bay, just that I was never happy with how they seemed to fight each other.

  7. Good article George! Having seen your house I know that it will take time and money to insulate, so this is a great and cheap way to squeeze the most out of an inefficient heater until you have the time and money to get the rest done. Top marks my friend – this could save a lot of other people a lot of money :-)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.