Open Source Android Thermostat

Put that old Android phone to good use by mounting it on the wall as a smart thermostat. This open source hardware and software project lets you replace your home’s thermostat with an Android device which adds Internet connectivity and all that comes with the increase in computing power.

The brunt of the hardware work is taken care of by using an IOIO board which makes it easy to interface any Android device with the simple hardware which switches your HVAC equipment. We’ve been waiting for the launch of the new IOIO design and if it comes in at a lower price as has been rumored that makes this project in the price range of the least expensive of programmable thermostats (assuming you already have an Android device to devote to it). Simply etch your own board to host the relays and voltage rectifier and you’re in business.

There is a client and server app, both free in the Play Store. The server runs on the wall-mounted device with the client offering control via a network connection. The features of the system are shown off quite well in the video after the break.

This sounds like a perfect use for that phone you ripped out of the pages of a magazine.

39 thoughts on “Open Source Android Thermostat

  1. *PLEASE* be careful with hacking on your home heating system! Mistakes have the potential for freezing your pipes, killing your pets and plants, burning down your house, or even killing someone!

    Thermostats look simple, but I designed them for a living for Honeywell and Robertshaw — a lot of effort goes into making them safe. Here are just a few concerns:

    1. You need a fail-safe turn-on device (usually a mechanical bimetal switch at around 40 deg.F) to call for heat. Otherwise, your pipes can freeze if the thermostat fails.

    2. You need a fail-safe turn-off device (again, often bimetal). Otherwise, it can overheat your house if the thermostat fails on.

    3. Furnaces have elaborate fail-safe protection so they can’t turn on the gas flow without proving the burner has lit. They typically try to light a few times, and then “lockout” to require human intervention to check it and fix the problem. The lockout is reset by removing the call for heat, and then re-establishing it. If your thermostat does this on its own, it can DEFEAT the safety lockout, and flood your home with unignited gas!

      1. What would qualifies as “Modern”? I have a combination heating/cooling system at home, with brand new central air and original (70s era) gas-fired baseboard heat. I thought about getting one of those Nest thermostats, but rolling my own would be fun.

    1. Thanks for posting leeahart. I think we all accept a certain level of risk by building any of the devices listed here, but if there are reasonable ways to mitigate that risk, I certainly want to investigate them. I’d be interested in talking to you quite a bit more on this if you’re willing. Could you email me at jeremy [at]

      There are a few safeguards to help address these problems already, such as automatically relaunching the application on bootup, limiting the target temperature range from 50-90, using relays that fail in the open state and the need for a cyan aux power line which limits this thermostat for fairly modern furnaces with better safeguards. The thermostat is unaware of if the furnace is successfully doing it’s job or not and will continue to leave the heat relay closed until the temperature increases over the set point rather than continually attempting to cycle the system, so I don’t think there’s any risk of scenario #3.

      I haven’t seen purely mechanical shut-offs in any of the other electric thermostats I’ve looked at, but this sounds like a great idea if there’s a practical way for hobbiest to achieve it. I would really like to talk to you about that. The fire risk would be strictly from an electrical problem unless I’m missing something. I don’t think this risk can be totally eliminated with everyone creating their own boards, but I’d love to hear any input you have to help mitigate it.

    2. 1 & 2 are very easily implemented, if desired. I am relatively certain that these ‘features’ aren’t built into all thermostats other than by means of minimum and maximum setpoints. Further, I would pose that a system such as this could be more effective because they could notify the homeowner of the fact that the temperature has varied by more than 10 degrees from the setpoint.

      3 should not really be an issue either. At least on my furnace resetting the thermostat will not reset the furnace controller in case of an error condition. It is required to remove line voltage from the furnace to reset the error condition. I would expect that to be standard lest someone would simply turn the stat off, and back on, to the same end as you proposed.

      While setting this type of system up to a single stage HVAC system is fairly straight forward, setting this up to a multistage system would be a bit more complicated programmaticly. Making certain the stages are called in the correct order (and in some cases timinig), that the reversing valve is properly set…

      Another concern, that is more likely to be overlooked in home systems is the need for the thermostat to handle the time delay (normally 5 minutes) before calling for the compressor to turn on (cycle delay). Either due to power outage or normal cycling of the system. This delay is needed to prevent the compressor trying to start when the pressure differential is too great. Some compressors have this circuitry built into them, some systems expect the thermostat to handle this.

      I have an arduino controlling my HVAC system. It monitors temperature in every room, calls for blower, heat, A/C and even has a programmed ‘anticipator’ that uses the outside temperature and history to stop the call for heat / cool to prevent temperature under / overshoot. It also controls the blower speed (when not heating or cooling) to allow for quieter operation when not heating or cooling.

      1. Do you have a write up for your arduino controlled HVAC system? I want to do this with my house, but I can’t find a good example. The system that you described is exactly what I want to use.

    3. Your concerns are valid, but is is there a know failure rate for programmable thermostats and temperature sensing components they use? There’s that chance the a bi metal coil thermostat could fail, have they included fail safes over the years? Automated gas appliances in buildings that use pilot lights use burner of pilot light not on fail safes that are totally integral to the furnace, no doubt that the case for electrical ignition. AFAIK thermostats never had a role to play in burner not on fail safe methods, why bring that up as a potential hazard with DIY programmable thermostats? Any furnace that allows access to the burner fail safe via consumer accessible low voltage or data lines would be a result of poor engineering, and probably doesn’t exist.

    4. I think some of you guys are missing the point. The problem isn’t that the user will set too high or low of a temp. The biggest problem is that the Android will turn the furnace on (or off), and then CRASH. Then the furnace will remain in that state (on, or off) indefinitely. How often does a bimetallic strip ‘fail’, compared to the frequency of software/hardware working together fail?

      Another solution (not as good as failsafes) are to have a ‘watchdog’, which is capable of detecting whether Android has crashed and rebooting if so.

    5. Well, someone should have told the designer of the Honeywell thermostat that cost our family a $6000 repair bill, because it had no backup low temperature switch It was a battery powered programmable thermostat that, when it’s battery died while we were on vacation, failed to turn the furnace while the temperature was below 10F outside. Burst pipes all over the house….

      1. Thank you caerdeee. You perfectly illustrated my concern. A thermostat that is not fail-safe can lead to costly failures!

        Let me guess: This was a thermostat with the Honeywell nameplate on it, but built in China, after Honeywell was bought out by GE and all its US thermostat operations were outsourced. That “happysizing” cost me my job!

        1. @Lee Hart:
          Honeywell was never purchased by GE… Anyone who follows mergers and acquisitions knows this. That potential deal occurred way back in the late 90′s and was kiboshed by the EU…. So any downsizing that occurred at honeywell after that was a result of something else… if you ever actually worked there.

          1. (Just discovered this thread was still active). Correct; the merger was blocked. But Honeywell did indeed lay off lots of us to make their balance sheet look good in anticipation of it. And they did indeed outsource their thermostats and controls to China etc. And yes, I did indeed work for Honeywell designing furnace controls.

            My original point still stands. PLEASE be careful when making your own thermostat! Mistakes, program crashes, and component failures really CAN cut off your heat entirely (leading to frozen pipes etc.) or leave it stuck on (roasting our house), or in a worst-case scenario, even defeat the safety lockouts.

      2. The message to take away here is to always turn off your water when going away on vacation (also turn off your water heater). There are *many* ways that heat could fail and burst pipes can sometimes even happen when the heat is working fine

        I have a cheap digital thermostat on our downstairs system and I have (of course) had it apart and there appear to be no safeguards at all. Of course, it is a small, dedicated system and quite likely there is no way it can reasonably crash short of cosmic rays. Android is a much more complex system and I have seen it crash if you look at it wrong.

        The better way to go would be something small and dedicated like an arduino or PIC microcontroller with watchdogs and safeguards built-in being controlled and monitored by an Android (or R-Pi or iPhone or whatever) device.

        1. In an electronic thermostat, look for a small rectangular metal “can” inside the thermostat. That’s a bimetal switch. It’s there so if the electronics fail, the bimetal will turn the heat on anyway if the temperature falls below about 40 deg.F.

          There may also be a second one (or a one-time cylindrical thermal fuse) that forces the thermostat to shut OFF if the temperature exceeds 110 deg.F or so.

          It’s rare for manufacturers to leave these off, because it leaves them wide open to lawsuits if something goes wrong!

          On lockouts: It’s normal for a gas furnace to try several times to light the main burner. If it fails after (say) 3 attempts, it gives up (i.e. is in “lockout”). You reset the lockout by turning AC power off, or pushing a reset button, or turning the thermostat down so it stops calling for heat, and then turning it back up again. The exact method used depends on the furnace control.

          A normal thermostat can’t cycle on/off without a temperature change, or some kind of human control operation; so it can’t accidentally reset a lockout. But some start-up or off-brand thermostat manufacturers (and hobbyists) have tried making thermostats that cycled on/off by themselves, in an effort to save energy to get more uniform household temperatures. This turned out to be a deadly idea, as it could inadvertently reset the safety lock-outs in a failing furnace!

          1. I know this is resurrecting a fairly dead thread, but this is absolutely wrong:

            “or turning the thermostat down so it stops calling for heat, and then turning it back up again” – No this does NOT happen.

            WHY? Because the FIRST thing a furnace does when it enters a lockout or limit trip is to interrupt power to the R wire. No power to the R wire means no power coming back on the Rh wire – meaning NO CALL FOR HEAT.

            So you claim that no thermostat should be causing a call for heat to reappear/disappear without a temperature change – but the FURNACE ITSELF does this.

            As an example, for a furnace that had a clogged blower due to landlord negligence (did not install filter when remodeling, leading to 1/4″ of crud on blower surfaces) leading to overtemp limit trips:

            Thermo calls for heat
            After approx. 10-15 minutes – overtemp limit trips
            Furnace removes power to R wire, causing thermostat display to go blank. Note that without R wire power, there can’t be any signal on the Rh wire – therefore the furnace interrupted its own call for heat
            Furnace cools down, eventually resumes providing power to R wire
            Thermostat sees temp below target, immediately calls for heat
            Rinse and repeat

            Resetting the lockout requires removing AC power to the furnace, it can’t be done from the thermostat, considering that if this were possible, the furnace would wind up resetting its own lockout automatically.

      3. An inexpensive way to provide backup is to run two separate mechanical thermostats, old school mercury or otherwise, in an inconspicuous location. Both set to heat mode. Set one at high point and the other at low.
        Run the heat demand from your ‘fancy’ DIY thermostat serially through the high set point, it will force a break under overtemp conditions, and bridge those in parallel with the low set point unit, which will request heat regardless of the state of the ‘smart’ unit. Protection on both sides.

    6. really, huh, there is very little you are going to do with the thermostat that could hurt the furnace. worst thing is probably short it out.

      almost no common thermostat have these fail safes you are talking about. not even the more expensive digital ones. if a standard thermostat fails there is nothing that is going to turn your furnace on at any temperature like you are suggesting.
      and your other concerns. there is absolutely nothing in the thermostat that could bypass any of the safety options of the furnace. including the glow plugs. and the safety start for when there is no gas flow or if the chimney is plugged (the furnace will stop trying to start and lock out) all that is built into the main furnace board.

      1. agreed, the HVAC codes and safety standards have been sifted thru quite thoroughly over the years. this was done not only to protect the people who get to feel warm (or cooler) but also to prevent the lawsuits that could ensue if slipshod work or design was passed off to the general public. what many novice designers often fail to understand is, the accumulated years of experience and vast knowledge (millions of man-hours) that precedes them, in nearly all products. ( aka ‘dont redesign the wheel and call it ’rounder’) by the way, i designed a new nail yesterday, anyone interested in buying my design for a trillion bucks? errr, i didn’t think so!

  2. I doubt I’d try to wire this to an old 70’s style furnace, but the furnace I currently have has it’s own controller with it’s own set of diagnostics and safety features that remain isolated from the thermostat itself. I’d definitely give this a go on a modern setup.

    1. Actually, a 70’s system would be more easily suited to control by a home made system. They normally had a dumb mechanical stat that used a mercury switch to open or close the circuit for the call for heat or A/C. They were simple 4 wire setups. Many newer systems are 5 or 6 wire and the thermostat has to control multiple stages of heating and cooling.

  3. OK anyone who has surplus of Android phones that as a computer to this degree, and don’t know what to do with them all please sell one to me at a poor boy price :) Only functionality through the USB port or Bluetooth is important, I can’t afford the data plan to use as a phone.

  4. I’d prefer to use something like the wr703n and then access it from my android phone / web browser to set temperatures remotely.

    It’s $20 ordered from China and has some gpio pins available for hacking! The day after I ordered one I saw it on HackADay: ).

    A few simple buttons for basic warmer/cooler on the wall with the device but otherwise control everything from your phone, tablet or laptop?

  5. @Zee exactly what I’ve been doing! After connecting a reprap to my 3d printer (see previous hackaday post). I was digilently building a raspberry pi based thermostat. With same feature of being able to switch on/off the heating while at work!

    It doesn’t have a fancy touchscreen just a + and minus button. But it will have a fancy web interface so you can connect with your android tablet or pc to the thermostat.

    and the version from last year that already worked on an iphone:

  6. Just wondering. How did you integrate the charger for the android phone? I’m guessing you need to have mains nearby the android to charge it 24/7 otherwise it will loose it’s power.

    Still great write-up and neat idea. But I’m missing the schematics for the board that contains the temp sensor and the relays or mosfets to do the switching on github I only see sources for the android apps (maybe I’ve overlooked them though…).

    1. Most modern furnaces provide a cyan wire with 24vac auxiliary power for thermostats. I’m using this to power the IOIO which provides power to the phone over USB. The wiring details are on the assembly instructions page at

  7. There are so many ways things can fail I’ve seen lockout conditions cause bursted pipes. The arduino though is prone to issues that would leave it in a certain state the best way to combat this is to modify the project and adapt it to work with cheaper esp8266’s this way if one fails the other can pick up. This may actually be better in the long run to have DIY thermostats in the case of a power outage you could setup so that a battery backup would kick on and start your generator to boot I think DIY is the best possible path the hive mindset will overcome things like this there is a solution to every problem while some are cost prohibitive. It is nearly impossible to protect against every scenerio that would play out however it is important to look into them and discuss them and weed out the ones that could lead to injury or fatality without question costly things likes pipes bursting are no good either so it may be an excellent idea to be sure to mitigate the risk through the use of a watch dog like someone mentioned here. Or a dual setup. Interesting project I am looking into the timer aspect of things more so than anything.

    I have trouble trying to come up with weekly timer code in my brain currently and how to address it in a small elegant fashion the problem is there will be 48 timers for per day for my project 8 relays 6 timers per day per relay… how to avoid collisions queue executions etc…The more I type and read the closer I get without any real answers it is like I feel as if it helps me think so sorry for the tldr.

    But in the mean time anyone interested in controlling things is welcome to jump on board and visit us…

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.