# Simple and cheap way to control baseboard heater from a microcontroller?

I'm a total beginner with hobbyist electronics and I'm trying to design a way to switch off/on a mains-powered baseboard heater with a microcontroller. The microcontroller would have access to mains power and would be battery-powered. The pin outputs are 3.3V on the microcontroller. One particular issue is that I want to run the microcontroller on batteries, so I think I want a latching relay like this one.

However, that relay seems to have a coil current of about 200mA, which I think is way too high to be drawn from the microcontroller. And at that point I'm in way over my head in terms of how to switch it on and off.

I checked out an answer here, but the circuits provided there seem reasonably complex and I was just hoping for something I could wrap my mind around without worrying about lighting the house on fire.

Am I missing something more straightforward, or are latching relays the way to go in this case? Single coil? Double coil?

• You seem to be missing the fact that mains is available at the baseboard and that this is the only sensible way to go - at least for the relay part as you are going to cut into the circuit anyway. – Transistor Nov 20 '17 at 22:08
• @Transistor Sorry, I'm not sure I understand your response. I realize that mains is already available, but how do I open/close the circuit to the baseboard using the microcontroller? The idea is that this microcontroller would sit in the place where a thermostat currently resides. – aardvarkk Nov 20 '17 at 22:10
• Your question doesn't state that requirement. You need to fix the question. – Transistor Nov 20 '17 at 22:13
• @Transistor Does my edit make it more clear? – aardvarkk Nov 20 '17 at 22:15

Since you're a beginner, I'll give a simple answer: Use a solid state relay (SSR).

For your purpose, they work mostly like a mechanical relay. However, instead of a coil to control the switch, the switch is controlled by light and your circuit is really switching a LED on and off.

Find what the maximum current of your heater is, then get a solid state relay rated for at least that current, and whatever your line voltage is. On the microcontroller side, you're really just driving a LED. The SSR datasheet will tell you how much LED current you need to turn on the device. Typical values are around 10 mA, but will certainly be way less than the 200 mA your mechanical relay wants.

• How much should I expect to pay for a solid state relay? I peeked around a bit but they seemed to start around $30 or something, whereas the latching relays I was looking at were more around the$5 mark. Is that the price one pays for the convenience of not having all of these other components involved? – aardvarkk Nov 20 '17 at 22:13
• I'd expect in the $10-20 range for singles. Maybe under$10 if you do some digging and are willing to take a chance on parts and sellers with questionable heritage. It depends on what your specs really are, particularly the current. There are lots of line voltage SSRs out there, but cost definitely goes up with current capability. Another options is to use a low current and cheaper SSR to run a mechanical relay from the available line voltage. – Olin Lathrop Nov 20 '17 at 22:19
• Keep in mind that many SSR's can fail as a short-circuit. Don't burn your house down. Most temperature-control systems use redundant temperature sensors and/or current-limiting fail-safes to avoid run-away conditions. Be careful. – Chris Knudsen Nov 20 '17 at 22:32