Thermostat and Light Control

Hi All!

Been reading here toying around with my Duemilanove for quite awhile, and have been looking at completing a project that is actually helpful.

I have a thermostat on some wall heaters that has been going out slowly. At times it will be 55F back here, other times 95F all without changing the temperature on the thermostat. The current relay that is functioning off of the thermostat is a 240VAC 25Amp single pole. I am looking at taking the old fashioned mechanical thermostat that is there and replacing it with the Arduino so that I can send commands remotely to kick the heaters on and so that it has a schedule setup to minimize power usage (I like to sleep like a bear, nice and cold but not freezing my bottled water.)

I have been hunting for a 25-30Amp 240VAC relay that I can run. I don't have any issues with bringing in an external power source and controlling that to the larger relays via a smaller one and I have plenty of space to pull this all off in. Where/which one should I use?

Also running off of this same setup I will be controlling our ceiling lights/fan via 2 additional 5amp relays, but I have seen tons and tons of writeups for those on these forums.

Anyone have a good recommendation for a temperature sensor? I have been looking at http://www.amazon.com/One-Wire-Digital-Temperature-Sensor/dp/B004G53D54 which is a DS18B20 Digital sensor.

I am going to be building a custom plastic box with a cooling fan (which is why i am not worried about a separate power source for powering the big relay) and have a linux tablet mounted on the outside of it for control.

Any advice from those with more experience in this matter would be greatly appreciated! I want to make sure that everything I do is at least 25% over the capacity that is required.

PS: The wall heaters are 1500watt/240VAC and there are three of them. If I am correct they "require" an 18.75 amp circuit, which is why I would lean more towards a 30Amp relay. My ceiling lights run a max of roughly .5 amps @120vac per circuit since they are all CFL's. The 5amp relay for that is more for if we ever go back to the maximum allowed wattage bulb we can use and the usage would jump back to 3.33amps @ 120vac.

Let me know if any more information is needed. It's been a LLLLOOOONNNNGGGG time since I messed around with voltage higher then 12v DC. I will try to get my diagram scanned in that has the layout of transistors/resistors and rectifiers for safety.

Thank you for all the wonderful information on this forum, and any advice you can point my way! :)

The DS18B20 is a very nice sensors but the first question you should ask is how precise do you want to measure. At max precision the DS18B20 does approx 0.07F in theory, in practice 0.3 or 0.6F is more reasonable (last bits tend to be more noisy). For a heating system steps of 1F is good enough.

other points: - accuracy, every temp sensor needs to be calibrated, so keep a calibration variable (just an offset) for every sensor. - the DS18B20 can fail (every sensor can), so check its CRC or the return value -127C as that indicates a failed reading. Your code should recognize these and ignore them (redo a reading) as you don't want your heaters turn on at every misreading. - think about having some sort of alarm (buzzer) for repeated failures. - consider using a logshield - http://www.ladyada.net/make/logshield/ - to monitor the behaviour of your usage. - add an outdoor temp sensor to monitor the reason why you heat. Extend that with wind, rain , sun

2 cents,

I'd go for solid state relays myself, a lot easier to interface to the arduino and they are optically isolated from the dangerous bits. Its just turning an LED on and off as far as the Arduino is concerned. It will need mounting on an aluminium plate or similar as a heat sink since they warm up a bit when they are passing current.

http://www.ebay.co.uk/itm/Solid-State-Relays-SSR-3-32V-DC-Output-24-380V-AC-25A-/260957684033?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item3cc24a4141#ht_3517wt_1189

I use DS18B20s and get the full accuracy out of them with a bit of code, first kick out any wild readings and then feed the result into a simple smoothing algorithm. It loses the jittery last bit. I just keep a variable with the last recorded temperature and if the next isn't close to it it is disregarded. (Room temperatures move slowly over several minutes, if they are being controlled by heaters) My wife seems sensitive to temperature differences of 0.5 degrees C so I would disagree with 1F being accurate enough. ;) I haven't bothered calibrating them, they agree with each other and agree with my most trusted standard thermometer. Where exactly you mount them in the room will have far more bearing than anything. Expect 3C (5F) discrepancy between a warm bit and a cool bit, probably a lot more in cold weather.

Thanks guys,

I have tons of aluminum sheets laying around that I will make the box out of, and thanks for the link on that relay, it looks like a perfect fit.

I am thinking about running 3 sensors throughout the room and grabbing an average temperature to determine when the heat should kick on. Most of the data will be processed on the connected linux box, where as the arduino will be more of a controller for the relays and information gatherer for temperature. I will have a few failsafes thrown in to make sure that if the linux machine goes down that the arduino doesn't kick the heat on full blast for eternity. Though now that I think about it more, it might be best to have the computer gather and record the information and allow me to set temps, but the arduino would be self sustainable once those temps are set.

So much to think about, thankfully being an at home dad gives me tons of time to do it!

The idea about having a counter, or flag for sensor failures is something i nearly overlooked. Will probably have it start spamming me emails when it gets to a certain count.

Anyone know where I can get ahold of that relay in the USA? I'm not entirely opposed to ordering overseas, but have had my fair share of issues with stuff getting delayed through customs.

Answered that last question myself with a simple google search....

http://www.ebay.com/itm/Solid-State-Relays-SSR-3-32V-DC-Output-24-380V-AC-25A-/250996671451 in case someone else was hunting.

@pluggy

… temperature differences of 0.5 degrees C so I would disagree with 1F being accurate enough

0.5C = 0.5 *9/5F = 0.9F so almost 1F…

That said I would go for the max precision too :slight_smile:

I have the arduino controlling the room temperature which it does itself, I have my linux controlling computer telling it what temperature to maintain and when to change it, if the linux box croaks, it continues maintaining the temperature it was last told to maintain. It doesn't have an 'off' as such, you just turn it down to a low temperature. I have mine turning down to 16 C overnight, it rarely comes on at that temperature except in the very coldest weather. The arduino does a whole load of monitoring of energy use and light levels besides controlling the heating, it passes the data out to the linux box for producing pretty graphs and running a web site. Theres a link in my signature...

Impressive work Pluggy (saw it before) - inthe top graph there is a green line that is not shown in the 2nd graph (the forced scale to display the red one).

Don't know which graphic lib you use to make these graphs, but you should try a logarithmic scaling if it is supported. Then the low energies and high energies fit perfectly together in one graph.

I came across your posts in the past pluggy, and I love what you have done.

On that relay it has these specs: Output voltage: AC 24-380V Output current: 25A Input voltage: DC 3-32V Input current: 6-35mA

Would i even need to run a transistor and additional power? I know I'd want to run a rectifier coming off of the digital pin on the arduino to prevent any back current from frying my board, but other then a resistor would anything else be needed? Probably order a couple of those today.

Anyone got a lead on a similar style low amp relay? Or would it be worth it to run my 5amp applications off of the same thing?

You guys rock.

robtillaart: Impressive work Pluggy (saw it before) - inthe top graph there is a green line that is not shown in the 2nd graph (the forced scale to display the red one).

Don't know which graphic lib you use to make these graphs, but you should try a logarithmic scaling if it is supported. Then the low energies and high energies fit perfectly together in one graph.

The green line in the top graph, is the reading from the main meter. its an old disk meter which runs backwards when the solar panels are generating more than we're using. The blue line uses a second digital meter which only runs when we're using from the grid. The arduino doesn't know which way the disk is running so it was complete baffle ball before I added the second meter. if the blue line is zero, we know we're exporting and the green line shows how much. When the electric company catches on (when they get round to it, we had to tell them we had an old meter when we applied for the feed in tariff) they'll probably change our main meter to a digital one which doesn't run in reverse. Its great while it lasts, today was sunny and the meter read less than it did yesterday by 3 units even though we actually imported over 6 units in the day.

I use software called rrdtool for the graphs, I don't think it has a logarithmic scaling option.

Leviac: I came across your posts in the past pluggy, and I love what you have done.

On that relay it has these specs: Output voltage: AC 24-380V Output current: 25A Input voltage: DC 3-32V Input current: 6-35mA

Would i even need to run a transistor and additional power? I know I'd want to run a rectifier coming off of the digital pin on the arduino to prevent any back current from frying my board, but other then a resistor would anything else be needed? Probably order a couple of those today.

Anyone got a lead on a similar style low amp relay? Or would it be worth it to run my 5amp applications off of the same thing?

You guys rock.

You don't need anything with that SSR, you just feed it the 5V straight from a digital pin - the resistor for the internal LED is built in.

THere are smaller SSR availble : http://www.ebay.co.uk/itm/ZG3M-308B-Solid-State-Relay-8A-Output-90-480VAC-/260971758719?pt=LH_DefaultDomain_0&hash=item3cc321047f#ht_2045wt_1165

Found one american side that has the same lovely screw connections. http://www.ebay.com/itm/SSR-10-DA-Solid-State-Relay-10A-Output-24-380VAC-/310210703371?pt=LH_DefaultDomain_0&hash=item4839ffb00b#ht_968wt_952

Couple of those and one of the big ones are being ordered. Nice that I just need to plug it straight in.

Don't forget the heatsinks and there is a small proviso regarding SSRs in that they pass a tiny amount of current when they are turned off, if the load goes open circuit, its possible to get an electric shock when they are off. Put them downstream from your existing breakers and open the breakers before tinkering........

@pluggy rrdtool && logarithmic

rrdtool sounds quite useful., I found the logarithmic option at - http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html -

[-o|--logarithmic] Logarithmic y-axis scaling.

Let me know if this option works, (enable waiting mode :)

pluggy:
Don’t forget the heatsinks and there is a small proviso regarding SSRs in that they pass a tiny amount of current when they are turned off, if the load goes open circuit, its possible to get an electric shock when they are off. Put them downstream from your existing breakers and open the breakers before tinkering…

I am going to be replacing the breakers at the same time, so they will be out when i do the work on the heaters/lights. I also have the relays going in down stream from the breakers and am building an aluminum box with a small low power cooling fan. I plan on adding several more relays in there to control more stuff, and want it to stay cool at all times. The relays will be mounted on a plate that has a 1/4" spacing between it and the wall so airflow can cool it from behind.

Let me know if you think this is enough, or if i should make some actual heatsinks to throw on there. I can always jbweld some fins on it for more surface area.

Everything will be well grounded, since the thermostat already has a giant ground wire running down to a metal stake in the ground. Should i still throw a rectifier between the digital pin and the relay for safety? Don’t want to be burning out my arduino.

Its difficult to say without seeing the plates and how the airflow can get to them. I’d suck it and see when they are in and running, they won’t overheat in an instant, keep an eye on them when they are first turned on. A good rule of thumb is if you can keep your finger pressed on the relay without pain when its been on for 15 minutes, its OK (stay away from the output side terminals, they’ll quite happily kill you).

A solid state relay is nothing like a electro-mechanical relay that can generate large voltage spikes when the coil is de-energised. The input side is literally an LED, so no, a rectifier isn’t going to help anything.

robtillaart :

I’ve modified my code for logarithmic scaling, on the second larger power graph (I was obviously wrong about it not having the option). Takes a bit of getting used to…