{"id":2834,"date":"2017-04-03T00:00:23","date_gmt":"2017-04-03T07:00:23","guid":{"rendered":"http:\/\/192.168.3.4\/?p=2834"},"modified":"2018-01-09T06:51:27","modified_gmt":"2018-01-09T14:51:27","slug":"2834","status":"publish","type":"post","link":"https:\/\/www.cloudacm.com\/?p=2834","title":{"rendered":"Space Heater Control"},"content":{"rendered":"<p>I&#8217;ve got two wall mounted space heaters made by King Electric.\u00a0 They are the Pick-O-Watt series and have a built in thermostat for control.\u00a0 They are easy to install and the option to set the load is useful.\u00a0 Setting the output wattage to match the room they are installed in saves energy.\u00a0 However, they were not centrally controlled.\u00a0 If one was left on, energy was wasted and is potentially dangerous.\u00a0 I wanted to avoid this.<\/p>\n<p>First, lets look at how it operates in factory condition.\u00a0 The thermostat directly linked the mains electricity to the load.\u00a0 When the dial on the thermostat is turned on or off, the contacts in the thermostat change to either open or closed.\u00a0 This determines whether the heater element gets electricity or not.\u00a0 The thermostat has built in hysteresis, that gap prevents damage to the heater element from\u00a0 toggling on and off repeatedly.\u00a0 The wiring is heavy gauge wire to handle the loads drawn by the heater element.\u00a0 Linking the heater element to a central thermostat would require extensive electrical wiring.\u00a0 I decided to use a micro-controller to bridge the thermostat to my controller and back to the heater element load through a solid state relay.<\/p>\n<p>The solid state relay is an Inkbird rated at 25 amps, which can be purchased for under $10.\u00a0 The relay will turn on when a 3-36 volt supply is applied to the input.\u00a0 I&#8217;m using a transistor driver circuit as a buffer between the relay input terminals and my micro-controller.\u00a0 My ATX 5 volt supply line will be used to turn the relay on.\u00a0 The relay can handle 24-380 volts AC load.\u00a0 I use it to handle a 750 watt load from a 120 volt AC supply, so that just over 6 amps.\u00a0 Higher loads would require a heat sink.\u00a0 I mounted the relay to the space heater chassis with thermal compound.<\/p>\n<p>The micro-controller is an ATTiny84.\u00a0 The ATTiny84 was selected because it has I2C support that I was able to get working without much effort.\u00a0 This micro-controller is also used in my smoke detector housed multi-sensor endpoints, which I&#8217;ll cover in later posts.\u00a0 It has the ability to handle logic conditions and do the work that the thermostat had done.\u00a0 I have several variables programmed into the sketch that are central to the logic functions.\u00a0 These memory registers collectively create the conditions that operate the space heater.<\/p>\n<p>When the thermostat changes state from on or off, it changes the Attiny84 memory register named &#8220;ThermoState&#8221;\u00a0 The Attiny84 will change the state of the memory register named &#8220;RelayState&#8221; based on the value contained in the &#8220;ThermoState&#8221; variable.\u00a0 When the &#8220;RelayState&#8221; setting is on, the Attiny84 sets the output of one of its pins high, which drives the transistor.\u00a0 This transistor then switches on or off based on that input and thus turns on or off the solid state relay it is connected to.\u00a0 The solid state relay is connected between electrical mains and the heater element load.\u00a0 This is the identical working conditions of the unit as it is from the factory.<\/p>\n<p>Next, I fed a low voltage 4 wire link from my controller to the space heater.\u00a0 This supplies the 5 volts and ground, as well as the SDA and SCL I2C data lines.\u00a0 I&#8217;ve programmed all of my I2C slaves with unique identifiers.\u00a0 With that unique ID, my I2C master can query the values in the memory registers on the space heater micro-controller.\u00a0 I&#8217;ve also setup memory registers on the space heater micro-controller so values from the I2C master can be set, these are &#8220;TimeOverride&#8221; and &#8220;TempOverride&#8221;.<\/p>\n<p>I use the &#8220;TimeOverride&#8221; to turn the space heater off at specific times.\u00a0 For example, it will not turn on in the summer or when everyone is asleep.\u00a0 I&#8217;ve also set a memory register so that the space heater will turn off after 2 hours of continuous use.\u00a0\u00a0\u00a0 If someone dials the thermostat off and on again, this resets that &#8220;TimeoutOverride&#8221; value back to zero and the space heater will turn back on.\u00a0 This timeout period\u00a0 can be adjusted on the I2C master, so no need for me to reprogram the space heater micro-controller.\u00a0 The last control variable is if the outside temperature is above a specific value.\u00a0 If it is, then the space heater will not turn on.\u00a0 I&#8217;m pleased with how well this has worked.\u00a0 In the past, I typically turned the mains circuit breaker off in spring and back on in fall.<\/p>\n<p>One last thing is I&#8217;m able to graph the usage and operation of the space heaters.\u00a0 The I2C master queries the Attiny84 registers and passes these values back to my Raspberry Pi.\u00a0 Here I use Cacti graphs that track the operation and I also have email notifications when the unit operates in an unexpected fashion.\u00a0 Fundamentally, that is how all of my smart devices work throughout the house.\u00a0 All in all I&#8217;m pleased with how this worked out.\u00a0 I hope you have enjoyed this and look forward to expanding on this subject.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve got two wall mounted space heaters made by King Electric.\u00a0 They are the Pick-O-Watt series and have a built in thermostat for control.\u00a0 They are easy to install and the option to set the load is useful.\u00a0 Setting the output wattage to match the room they are installed in saves energy.\u00a0 However, they were not centrally controlled.\u00a0 If one was left on, energy was wasted and is potentially dangerous.\u00a0 I wanted to avoid this. First, lets look at how&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.cloudacm.com\/?p=2834\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,3],"tags":[],"class_list":["post-2834","post","type-post","status-publish","format-standard","hentry","category-arduino","category-rd"],"_links":{"self":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/2834","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2834"}],"version-history":[{"count":2,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/2834\/revisions"}],"predecessor-version":[{"id":2836,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/2834\/revisions\/2836"}],"wp:attachment":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}