Photon Thermostat Based on Spark Nest - Added Web Control, Anticipation, and Scheduling

Github here: https://github.com/davegutz/myThermostat-Particle-Photon

I was frustrated last year, unable to connect the marketplace offerings for web thermostats to my Triangle Prestige boiler because the marketplace offerings all seem to use solid-state relays (SSR) that work with AC control circuits but not simple DC control circuits used in the Triangle. So I thought: “Why not just do it myself? Should only take a couple hours.”

I probably should mention that I think some of the newer thermostats work with DC but I haven’t actually verified that. I bought and returned two of the SSR devices (NEST and Honeywell) last year. My furnace is a European style that uses DC control circuit and the first offerings by thermostat guys don’t deal with that here in the US. If you’re reading this and live somewhere in Europe, you’ll want to use a Reed Relay instead of a SSR to switch your furnace.

This project can be tried on a bare Photon using an embedded heating system model, turning on the LED on a heating call after Web setting and will help you understand Blynk setup for other things.

FYI: the DC control concept is the old fashioned idea where a relay such as a mercury switch in a round Honeywell thermostat closes the 28 Volt DC circuit to the furnace. Simple. New furnaces use fancy AC solid state stuff that does fancy things to try to minimize power consumption, such as SSRs. Those don’t work with DC circuits because when it is on and then commanded to shutoff the SSR waits for the current it passes to go through zero so as not to create a spark. Going through zero never happens with an SSR on in a constant voltage DC circuit so the furnace never turns off! You need a Reed Relay instead.

I began with the Spark Nest thermostat project. The electrical schematic is awesome and ultimately proved accurate. Everybody swore I’d need pull-up resistors for the I2C circuits but I did not. The code provided some ideas but had to be extensively rewritten to accommodate my grandiose requirements (see the topic title). The cabinetry in the Spark worked ok but is too small to be any fun for you.

There is a spreadsheet in the project schematics folder showing the layout I finished with and the part numbers to order. All those parts were high quality and worked well. They cost about $100 at Mouser.

One of the things I found most useful was setting up compiler options to run the application on a bare Photon so I could check out code, including the Blynk interface, independently of the installed Photon.

Also the letters self-dim to make a little dot when the heat is off and a little “+” sign when the CALL is on. I move them around randomly to extend the life of the LED matrices.

The Spark Sketchup drawing worked ok and I made the case on my lathe out of cherry and Plexiglas. Do yourself a favor and make it about 20% larger or just lay it all out in a flat format with a box cover and a knob to adjust temperature. If you have ever tried to repair a mechanical washing machine control you know what I mean.

To the code I first added a scheduler. This is a simple table of on/off for each day of the week. Many thermostats I’ve had do two on and two off each day and that works for me so that is what I started with. You can add as many points as you want as long as the number of points on all days are the same. If you want to ignore some on some days such as Saturday, just leave the temperature setpoints on the extras to the same value as the ones before and after.

Also to the code I added a web application that uses Blynk to allow you to monitor while on a trip and set it up or down if you forget before leaving for example. Blynk is awesome!

Finally I added some temperature anticipation to start the furnace earlier on cold days. It was easy to add the timing change to the schedule by biasing time but finding out the outside temperature over the web is another story. See what I did. Most of the code in the github repository is to get temperature using openweathermap and JSON, ugh.

So is this fun? It was extremely rewarding to me to master some skills that I was amateur at and exercise my prowess in areas I already knew, applying it in new ways. Overall I spent about 80 hours on this. There was one day I was sure I “bricked” the thing and was one of my low points of the whole year. It was a broken solder joint. Actually that happened twice. Hours of bliss punctuated by moments of profound disappointment.

All the equipment I bought at Mouser per the list provided, as well as the Photon device, turned out to be rock-solid high quality and I wasn’t struggling with the anticipated “made in China” issues despite a lot of the stuff actually made in China.

I would be negligent not to mention SAFETY. You should make sure that if your thermostat fails it does not leave the furnace on. I simply wired it in series with my old thermostat that I then set to 72 F. Also if your thermostat fails off you’ll need a way to over-ride. I used a parallel switch circuit to push control back to that same series thermostat which can then be set as usual. You could also wire a normally open thermal switch set for 45 F in parallel with the whole setup.

Best of luck and ask me any questions you want. I’m sure you can improve on this!

Github here: https://github.com/davegutz/myThermostat-Particle-Photon
There are some pictures in there too.

2 Likes

Lots of information, and a very neat project!

Using webhooks would make this SO much simpler, requiring barely any code at all, since the cloud parses the data for you. Check out this project for a great example of that. There’s even a neat little tutorial over here.

1 Like

Thanks I’ll check it out. We do learn things the HARD way!