Help choosing a relay for a thermostat

Hi all, I am making a thermostat arduino project.

I want to switch on my boiler at a temperature that I set.

I'm trying to find a suitable relay but I have not used them before. I need to try and find some info on my boiler but I don't think the thermostat input will draw much current but will be 240v (UK)?

I will make a PCB for the project and I have found this relay

Do you think it would be suitable for the project?

Your Arduino works on 5V so to use that relay you would need both a 12v power supply and a transistor to switch the 12v.

You would be better served with a relay with a 5v coil that draws 30 mA or less. That way you can drive it directly off the Arduino pin.

Thank you John that is a good point. I thought id have to use a regulator just to get 12v for the coil. Are there parts availble with the attributes that you mentioned that can switch 240v?

Thanks again

In the United States the wires for the thermostat control are 24V. I can’t imagine them being 240V; that would be quite a bit of overkill for a simple contact circuit – not to mention the safety risk. would be the most straightforward place to look for a relay that meets your needs.

Looking at the info from my boiler it says the thermostat must be able to switch mains voltage and looking at the diagram it switches the live power to all the circuitry. does not mention current draw though

I’m not having much luck finding a relay that will switch 240v, with a 5v <40mA coil at the moment, do they exist?

This sort of thing looks idea but 40mA coil draw :frowning:


just found these ^ pricey compared to the ones I have been looking at but as long as the current I will be putting through it is not more than 1.5A I think it should work?

dtokez: Looking at the info from my boiler it says the thermostat must be able to switch mains voltage and looking at the diagram it switches the live power to all the circuitry. does not mention current draw though

In the USA we use a box called a Safety Relay. There is a low-voltage loop that goes to the thermostat. For an oil heater it has a flame sensor that checks that the furnace has lit so it can shut down the pump/blower if the ignition fails... don't want to fill the firebox with oil! For a boiler there is also a connection to a pressure switch so the burner can be turned off when the steam gets up to proper working pressure.

Gas-powered furnaces often use a thermocouple pilot-light sensor to enable the gas valve. In some cases the thermostat is just put in the millivolt circuit. The gas valve is opened if the pilot light is lit and the thermostat closes the circuit from the thermocouple to the gas valve.

Is your boiler electric? Oil? Gas? Something else? What regulates the steam pressure?


This is a solid state relay. I think using an SSR would be a safety issue given that when there are failures they are more likely to fail in a "closed" state.

On the Farnell site you want to look in the "Relays -> Power - General Purpose" category for mechanical relays. There are 1941 relays with a contact rating > 240V.

John, it's a gas boiler, below is the info I have on it. The room stat connections are in the middle of the page. I guess the current pulled through the thermostat relay is pretty much the operating current of the boiler itself? It does not have a thermostat connected at the moment so much have the link fitted.

Chagrin, I though that about using solid state, I will avoid them then. I can find loads but none with a low enough coil current to be able to be driven from an arduino pin

I'm a little confused about the neutral connection. Is it's only purpose to allow power at the thermostat?

In the UK, some boilers use 240v thermostats and some use low voltage thermostats. The diagram you posted shows that your boiler needs a 240v thermostat, and that the current draw is something up to 2A for the gas valves, plus the current for the CH pump or the HW pump, plus some current for electronics. I would look for a relay with at least 4A current rating to be certain.

A quick search of Farnell turned up||,1000291||,1001483||,1001606||,1001699||,1001764||,1001955||,1001998||,1002177|110156458|,1002223|110167038|,1002251||,1002291||,1002320|110184747|,1002494||,1002738||,1002846||,1002918||,1002992||,&filtersHidden=false&appliedHidden=false&autoApply=false&originalQueryURL=%2Fjsp%2Fsearch%2Fbrowse.jsp%3FN%3D2031%2B202502%26Ntk%3Dgensearch%26Ntt%3Drelay%26Ntx%3Dmode%2Bmatchallpartial%26No%3D0%26getResults%3Dtrue%26appliedparametrics%3Dtrue%26locale%3Den_UK%26divisionLocale%3Den_UK%26catalogId%3D%26skipManufacturer%3Dfalse%26skipParametricAttributeId%3D%26prevNValues%3D2031%2B202502. For greater choice, use a transistor to drive the relay.

Hi dc42.

Thanks for explaining that. I guess its a good thing that it needs a 240v thermostat, I can power my circuit from it - I’m thinking of ripping an old 5v Nokia wall charger, not sure how good that will turn out but I think it will supply enough current (about 700mA from memory without having one to hand) and will be pretty small. The entire thermostat needs to end up being small enough to be housed in a flush 2 gang box. I think I will use a arduino nano.

Thanks for the search link, Farnell searches sometimes confuse me with all the different parameters one can select. I see most of them state 40ma current draw, do you think it will be ok to max out the arduino current sinking capability? Or best to use a transistor anyway? I would prefer less components though for size, complexity and things to fail.

Thanks again for the help

It's hard to find relays that take less than 40mA at 5v, apart from reed relays that can't handle the voltage and current you need to switch. If you've spare pins on the Arduino, you could connect two pins in parallel if you customize the code that drives them. Choose 2 pins that are on the same physical port in the MCU. Connect the relay between the pins and +5v, and digitallWrite LOW to both pins in setup(), but do not make a pinMode call (so that they will both be inputs by default). When you want to energise the relay, write to the data direction register for that port so as to turn both pins simultaneously into outputs. To de-energise the relay, write to the data direction register to set both pins back to inputs again.

Thanks that is a great idea that I had not previously considered.

Upon further thought, I have decided to use a transistor to drive the coil and then I could also drive an LED as a indicator that the relay is engergised.

Not having much experience with electronics and knowing that you have a vast knowledge of it, could you please recommend a transistor that would be suitable? - up to about 100mA I guess then that leaves me plenty of head room to drive a LED also.

Many thanks :)

Lots of transistors are suitable for that. I would use BC337.

There are so many transistors my mind boggles! Thanks, I think I have 1 or two 337s around the place :)

Should I use a 1k resistor to the base?

Also, I guess I need to put a diode across the relay coil, but not sure which type? Is there any other protection that I might need?

Thanks again, you are a great help

A base resistor in the range 470 ohms to 1k would be about right. The diode may be any type that can take the 40mA relay coil current, I would use 1N4148. Of course you must use mains-voltage rated wire to connect the relay contacts, and keep those wires as far away from the coil contacts and the Arduino as you reasonably can. Regarding other protection, you might need a snubber network across the relay contacts because the pumps and gas valves are inductive loads. However, it is quite likely that the boiler already has one. Watch for arcing across the relay contacts when they open. A small amount is normal, but if it looks bad, consider adding a snubber.

I homebrewed a SSR for switching my boiler on and off, its a 240V switched UK one. A K3020P optoisolator, a Z0103 1A 600V Triac, a 4.7nF High voltage capacitor and a couple of resistors on a lump of strip board. 1A limit (250 Watts ish) its been happily running for a couple of years. I adapted the ciruit from this - D3 is substituted with the Z0103. Ignore the stuff to the left of the K3020, with the exception of R5 and you connect Gnd and a digital pin from the arduino across it. The Z0103 is a plastic TO92 job so there isn't any isolation problems. Keep the mains side away from fingers, it will quite happily kill you..........

Thanks dc42, I was not aware of snubber networks. I will bare that in mind. When you say watch for arcing, do you mean physically watch for a spark? I'm currently looking at the info on this relay It looks like it has some pretty high anti-arching capabilities, what do you think? Should I be looking at relays that adhere to certain approval bodies?

pluggy - That is an interesting read - thanks for the input. Looks like a novel way of doing it. I think i'll stick to the method that i'm semi comfortable with though, triac's and the like are a bit out of my comfort zone lol.

I think with a relay rated at 10A like that one, you should be OK without a snubber network, especially as the boiler or pump may already include one. I did mean watch for a spark, but if the relay is sealed in an opaque case then you can't do that.