Arduino heater control...XBee?

I have been working on a project for controlling my heater for some time now, and moving forward in making it go from a prototype to a cleaned up version. I will give a bit of history on the project.

I have a wall electric heater
http://www.homedepot.com/p/Fahrenheat-4-000-Watt-Wall-Heater-FZL4004/100192192

it has a thermostat on the front… which is just a knob, and there is no way to hook up any other thermostat so I can have it maintain a temperature in the room other than right where the heater is. I can not use a line voltage thermostat because their built in thermostat has a seperate fan control and I have to let it cool down when its done heating, not just turn off.

My only option for automation was to attach an arduino and servo to the knob so that when the heat needed to be turned off, the fan would still cool down the unit. As seen in the pictures…

I got an arduino in a project box with a servo and made a makeshift mount out of a coat hanger and zip ties… my wife hates it but I keep assuring her its a prototype to test and now I am going to make a polished project… possibly even consider mounting the servo inside the heater and belt drive the knob after I figure out if it gets to hot or not in the top section there.

Ok so part two of this project was to make a wireless carry around thermostat, but for prototype reasons, I was going to do direct line communication until I was sure that this was going to work. First a wrote a program and made a thermostat out of a 16x2 display, potentiometer, buttons and a thermistor. And spent hours trying to get the thermistor to take an accurate temperature with in a 20 degree range… that did not work as expected and at 4 in the morning when I had to work at 7 I had an epiphany. I used an old wall thermostat I had just to simply run 5 volts to it and have the relay in the thermostat provide the 5v back to an input pin… and it looks a whole lot better than a 16x2 display. The original thermostat even ran off 5v. So you guessed it, instead of going to bed I did just that with the thermostat and wrote the code.

Now the code was the easiest part for me thus far, I find it fun, and sometimes challenging. I even wrote in to have them communicate with each other constantly so there could be a fail safe mode in case one of them came off line (which would be to just turn off the heat). For the fun of it I even took one of those remote outlets and wired in the board to the remote to remotely turn off and on an outlet (with a fan) so it would run when ever the heat did. The next step was to mount everything and run a communication line. I will explain how that went.

Just to establish this is what I have on hand and I did not ant to purchase anything else until I had a working protype.

2 arduino UNO’s
1 raspberry pi
1 arduino ethernet shield

Stage 1
Heater side (arduino) <-----jumpers for serial communication -----> Thermostat side (arduino)

This worked great on my desk having the boards only inches from eachother… I read online that this could work for up to make 15 feet, and if you lower the baud rate maybe a bit more… so I wired in RJ25 jacks to the TX RX ports on both arduinos and what do you know even the 15 feet of line I had there was too much noise. Scrapped that Idea.

Stage 2
Heater side (arduino w/ ethernet shield) <----- ethernet cable -----> Thermostat side (raspberry pi)

So yes I had to re write the code to work in python, learned alot of new things I have never dealt with GPIO on a raspberry pi, and never used an ethernet shield on an arduino. I kept all the serial commands that were outgoing so I could monitor and debug added in sending and recieving udp packets for them to communicate through. This actually worked great but I had to cut down on how often they checked for eachother because they were sending to many packets it would cause a delay in responding to a call for heat on and heat off. Oh and I for got to mention it only worked if the arduino was plugged into my computer, took me hours to figure out the when I plugged power in to the arduino I needed to reset it to get the ethernet shield to work.

Stage 3
Heater side (arduino ethernet) <-RJ-45 → Router <-WiFi → Thermostat side (raspberry pi)
This works great and now I have a carry around thermostat that doesn’t have a cord hanging out the back of it.

Ok so that is the project history. I am now looking to move forward and need someone who has had experience with Xbee before wasting my money. I am looking to ditch the raspberry pi on the thermostat side because I like the arduino much better and it is better suited for this project, that wont be hard. But then I got thinking, do I even need an arduino on the thermostat? the xbee module has i/o pins can I just put the thermostat on those and tell the heater side when to turn on and off? I also got thinking that I dont need to have the thermostat and heater side communicating constantly either, the thermostat only needs to send an on command and off command and maybe recieve one reply when it is completed by the heater side, all I need to do is put on a max heater time setting on the heater side that resets anytime it receives something on the thermostat side, now I can preserve battery life for a carry around thermostat.

Then that also got me thinking, Xbee is compatible with zigbee, is there a thermostat on the market (I couldnt find one) that will already have everything built into it all I need to do is configure the heater side arduino to recieve the on and off commands.

So my two big questions are:

  1. Can I implement a zigbee compatible thermostat without the need for a base station.
  2. if not, can I program logic on an xbee module to do what I need.

My follow up question is:
3. I want to be able to comitor the serial communication wirelessly also from my computer if need be so I want to get an xbee explorer and module to plug into my computer. Can I have 3 way communication with the series one xbee modules where the heater and thermostat is multicasting out but I can also multicast or send direct to one of them. (this is assuming that a zigbee thermostat is not possible since series 1 xbee is not compatible.

And just because I would like to hear opinions on something else with this project I welcome advice on this question:
4. Battery backup? I want to be able to power the thermostat by usb set on a nightstand or desk, but if I want to move it to another room I dont want to remove power to move it from one place to another. Does anyone know any portable solutions, I would prefer not having to build a circuit for this, but if thats the only choice I hae can a low battery indicator be easily implicated.

The NodeMCU provides Wifi, it's compatible with the Arduino IDE (or just use Lua), it's cheap, and it doesn't need any AVR-based Arduino with it. It's tough to beat that price/performance. You should also look into the MQTT protocol for things like this.

Personally I think Zigbee is a protocol that will never catch on.

I wouldn't put a lot of weight into battery backup given that you're controlling an electric heater (can't control the heater if there's no power). If you need a cheap solution there are plenty of USB-based phone battery backup "things" you could use.

there is no way to hook up any other thermostat so I can have it maintain a temperature in the room other than right where the heater is.

In fact there is an easy way. Turn the knob all the way up, so that the internal thermostat is always on, and control the heater via its wiring to the house AC circuit.

A solid state relay (SSR) can handle a heater, and be turned on/off directly by an Arduino output.

jremington: In fact there is an easy way. Turn the knob all the way up, so that the internal thermostat is always on, and control the heater via its wiring to the house AC circuit.

A solid state relay (SSR) can handle a heater, and be turned on/off directly by an Arduino output.

This would be an unsafe way to do this, If I cut power to the heater, I also cut power to the fan in the heater which continues to blow after the heating element is turned off to be more efficient and to cool it down, turing off the power ot the heater will also get rid of the high temperature protection it has.

Good point. A safer approach would be to replace the thermostat heater contacts with the SSR.

Unfortunatly I don't want to go the wifi route because it then relays on a router, at the moment for the protype I am using a dedicated router that isnt on my home network.

I have been doing some more research and it looks as though I have found a solution to make the project a little smaller.

http://www.trossenrobotics.com/p/arbotix-robot-controller.aspx This could control the servo on the heater end, run the xbee module, and be programmed in the arduino ide which i am familiar with.

http://www.trossenrobotics.com/p/Xbee-Communication-Starter-Kit.aspx This gives me what I need to get the robot controllers set up with the xbee modules

I decided that I do not need a third xbee module to see traffic on the network, I realized that if I can make my thermostat carry around then I can just plug into the ftdi port to see the traffic.

The only things I need to figure out now is how to power the "remote chip" that i pulled off the remote outlet. I soldered 4 wires to it: power, ground, on, and off. all I have to do is send a power signal to the on or off. It is 3.3v, but the robot controler with the atmega controller outputs 5. I know I can tap off the 3.3v supply to the xbee module, but what would be the easiest way with less components to output a 3.3v signal, can the xbee module output the 3.3v signal, and can the xbee module input 3.3 volts? if thats the case then I might as well just use the xbee explorer and not use a second robotcontroller since the thermostat end is only inputing from the thermostat, and outputting over xbee network and to the remout outlet.

jremington: Good point. A safer approach would be to replace the thermostat heater contacts with the SSR.

Unfortunatly this would not work well either, I had thought about that.

This leaves the possibility that the fan could run constantly, I would have to turn the knob to a higher temp than I would intend to ever set on the thermostat, and the internal thermostat will always stay closed, although the heating element would be off, the fan would just continue to blow thinking that it still needs to keep heating.

I put many hours into research before deciding to go the automated way, and it just cant be done in a safe or efficient way.

Unfortunatly this would not work well either

I can't imagine why not. Can you explain?

jremington: I can't imagine why not. Can you explain?

Yes as I just said in the previous quoted post, if I put a line switch on the heater after the thermostat so the thermostat is still powered for thermal protection , it would still power the fan all the time if the room temperature is not at the set point of the heater thermostat which I would need to intentionally need to keep at a higher set point temperature so the line thermostat can control it. Make sense?