Wireless Arduino Boiler Controller Relay with nRF24L01: Control gas boiler with relay by connecting it to room thermostat connection on gas boiler without passing any current to gas boiler or at least this is how i did it and not to worry about buildup pressure inside heating pipes as gas boiler controller takes care of that itself.

You can control High Voltage electronic devices using relays modules that are readily available in the market. I am using the HL-52S 2 channel relay module, which has 2 relays. The high voltage side output connector has 3 pins, the middle one is the common pin and as we can see from the markings on.

Check out PiHome Shop for all you need for your Smart Heating

Wireless Boiler Controller

Wireless Boiler Controller

Boiler Room Thermostat Connection

Boiler Room Thermostat Connection

One of the two other pins is for normally open connection and the other one for normally closed connection. The reason i m using two channel relay as i can not find any single channel relay with optocoupler ic.

Wireless Arduino Boiler Controller Relay with nRF24L01

Wireless Arduino Boiler Controller Relay with nRF24L01

PiHome comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. DO NOT MAKE ANY CHANGES TO YOUR HEATING SYSTEM UNTIL UNLESS YOU KNOW WHAT YOU ARE DOING, contents provided here are for information and education purpose only, I take no responsibility for any loss or damage to you or your property.”

MySensors Arduino Sketch to Control Gas Boiler Relay

Upload wireless Arduino Boiler Controller Relay with nRF24L01 sketch to your Arduino, i would suggest to use Arduino Pro 5v version so you can avoid to have 3v for arduino and 5 volt to power relay module.

//  _____    _   _    _                             
// |  __ \  (_) | |  | |                           
// | |__) |  _  | |__| |   ___    _ __ ___     ___ 
// |  ___/  | | |  __  |  / _ \  | |_  \_ \   / _ \ 
// | |      | | | |  | | | (_) | | | | | | | |  __/
// |_|      |_| |_|  |_|  \___/  |_| |_| |_|  \___|
//    S M A R T   H E A T I N G   C O N T R O L 
// *****************************************************************
// *              Boiler Controller Relay Sketch                   *
// *            Version 1.30 Build Date 09/01/2019                 *
// *            Last Modification Date 04/02/2019                  *
// *                                          Have Fun - PiHome.eu *
// *****************************************************************

// Enable debug prints to serial monitor
#define MY_DEBUG

// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69

// Set LOW transmit power level as default, if you have an amplified NRF-module and
// power your radio separately with a good regulator you can turn up PA level.
//#define MY_RF24_PA_LEVEL RF24_PA_LOW
#define MY_RF24_PA_LEVEL RF24_PA_MAX

// RF channel for the sensor net, 0-127
#define RF24_CHANNEL     125
//RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
#define RF24_DATARATE 	   RF24_250KBPS

// Enable repeater functionality for this node

//PiHome Node ID
#define MY_NODE_ID 100

#include <MySensors.h>

#define RELAY_1  3  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define NUMBER_OF_RELAYS 3 // Total number of attached relays
#define RELAY_ON 1  // GPIO value to write to turn on attached relay
#define RELAY_OFF 0 // GPIO value to write to turn off attached relay

void before()
	for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
		// Then set relay pins in output mode
		pinMode(pin, OUTPUT);
		// Set relay to last known state (using eeprom storage)
		//digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);

void setup()


void presentation()
	// Send the sketch version information to the gateway and Controller
	sendSketchInfo("Boiler Relay", "1.2");

	for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
		// Register all sensors to gw (they will be created as child devices)
		present(sensor, S_BINARY);

void loop()


void receive(const MyMessage &message)
	// We only expect one type of message from controller. But we better check anyway.
	if (message.type==V_STATUS) {
			// Change relay state
		//digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
		if (message.getBool()==RELAY_ON){
			Serial.print("Wait Start \n");
			Serial.print("Wait End \n");
			Serial.print("Relay On \n");
			digitalWrite(RELAY_1, RELAY_ON);
		}else {
			digitalWrite(RELAY_1, RELAY_OFF);
			Serial.print("Relay Off \n");
		// Store state in eeprom - we dont need to save relay state as controller take care of this, 
		// saveState(message.sensor, message.getBool());
		// Write some debug info
		#ifdef MY_DEBUG
			Serial.print("Incoming change for sensor:");
			Serial.print(", New status: ");

If your gas boiler relay module connected directly to raspberry pi gpio pins then follow Raspberry pi Multi Zone Heating Control System Relay. You need to make sure to have WiringPi installed as well on your raspberry pi and have correct WiringPi gpio pins configured for each zone and for gas boiler.