Home | pfodApps/pfodDevices | WebStringTemplates | Java/J2EE | Unix | Torches | Superannuation | | About Us

Forward Logo (image)      

BLE Room Temperature controlled Heater
with Timer Switch

by Matthew Ford 6th January 2022 (original 25th May 2021)
© Forward Computing and Control Pty. Ltd. NSW Australia
All rights reserved.

Room Heater Control via BLE Temperature Sensor
with Accurate Timer Switch

Updated 5th Jan 2022 – added ESP-01 Timer Switch

Introduction – Why this Room Temperature Controlled Heater – with Timer Switch

The oil filled electric convection heater shown above is used to heat the bedroom over night. However it did not do a good job of keeping the room warm and by about 3am the room became uncomfortably cold. The control on the heater was controlling the heater's temperature not the room's temperature. This project uses a BLE temperature/humidity module to measure the temperature at a central spot in the room and send the reading to a BLE receiver that then controls a 40A Zero Crossing SolidState relay that turns the heater on and off. The heater's switch is on and it's own control is set out of the way, so it turns on and off controlled by the Solid State switch.

The whole unit it time controlled to only run at night. It automatically starts to control at 8pm and stops at 7am, using the ESP-01 Timer Switch. Initially a mechanical wall socket timer was used, but this proved too noisy at night and lost it time when switched off. The ESP-01 Timer Switch keeps accurate time (within a second or so) over years and automatically adjusts for daylight saving changes.

NOTE: See the warning below about controlling an oil filled convection heater.

Using three (3) (now 4 with the ESP-01 Timer Switch) previous projects, this project was completed in less than half a day. Those previous projects were the
Very Low Power BLE Temperature/Humidity Monitor (or Very Low Power BLE Nano V2
Replacement), the WiFi to BLE Bridge and the 3G/2G SMS Remote Control Power Switch.

(Alternative Temperature/Humidity Sensor Very Low Power BLE Nano V2 Replacement)

The BLE Temperature/Humidity project provides the remote room temperature sensing. It is battery and solar powered and always on ready to accept a BLE Nordic UART connection. Once it connects it automatically sends the current temperature and humidity once every minute in CSV format terminated by a newline, millisSec,temperature,humidity,1m The Adafruit nRF52 Feather from the WiFi to BLE Bridge is a BLE central device and a small modification to its code connects the the Temperature/Humidity Sensor peripheral every 2mins to pick up the CSV line, parse it for the temperature and compare it to the required setpoint (20degC). If the room temperature is low the Adrfruit Feather drives the control input to the 40A Solid State Relay via a specially configured High Drive (9mA) output pin. The Solid State Relay in turn controls the AC supply to the heater. The Zero Crossing feature of the Solid State switch means no current spikes on the power line as the heater only turns on and off just when the AC voltage crosses zero.

Update 5th Jan 2022 – Added another project the ESP-01 Timer Switch to control the on/off times for heater. This update was a 15min job using the existing project. See Construction below.

Parts List

For the parts list for this project see the parts lists of the four previous projects. Very Low Power BLE Temperature/Humidity Monitor (or Very Low Power BLE Nano V2 Replacement), the WiFi to BLE Bridge and the 3G/2G SMS Remote Control Power Switch and the ESP-01 Timer Switch. Of the three the BLE Temperature/Humidity Sensor requires the most work to construct. From the 3G/2G SMS Remote Control Power Switch you can omit the following parts:- the 3G SIM5320 module and the Mega2560 and the battery.


WARNING: This project is for Experienced Constructors Only. The board is Mains Powered and can be deadly if it is touched while it is powered by the mains.

Having already completed the previous four projects, this construction is easy. From the SMS Remote Control Power Switch, remove the Mega2560 board and the SMS Adafruit FONA board and antenna and battery and install instead the Adafruit Feather nRF52 Bluefruit LE from the WiFi to BLE Bridge. Wire the SolidState +ve control input to Pin A2 and the -ve input to GND on the Adafruit Feather nRF52. The USB power supply in the SMS Remote Control Power Switch will power the Feather nRF52 once it has been programmed. No changes are need to the Very Low Power BLE Temperature/Humidity Monitor or the ESP-01 Time Switch

As you can see from the first photo above the ESP-01 Timer Switch is powered from the 5V supply on the HAZZAH ESP8266 board and the ESP-01 Timer Relay opens and closes one of the low voltage leads (the GND lead for example) from the Adafruit Feather nRF52 that controls the Solid State Switch. This allows the timer to control the period during which the heater is active. The ESP-01 Timer Switch Relay will flicker on when powered up. This can be avoided by adding a large capacitor, see ESP-01 Time Switch. However for this application the very short on time on power up does not matter so the capacitor was omitted. The second photo is of an earlier version without the WiFi bridge and without the Timer.


To program the Feather nRF52, follow the instructions on downloading and installing the Arduino Board support for the Feather nRF52. The sketch here is using V0.22.0 of the Adafruit nRF52 board support, which differs from earlier versions.

Before programming the temperature control sketch, you need to identify the BLE address of the BLE Temperature/Humidity Sensor. If you don't already know this from its construction and testing, you can find it by using the Nordic nRF UART V2.0 app.

In this case the BLE address is C1:76:1C:1D:F1:F7 Connecting shows that the 1m CSV line is received as well as other data the sensor sends at longer intervals.

Open the BLE_TemperatureControl.ino sketch in the Arduino IDE and edit the these two lines

const float SET_POINT = 20.0;  // the setpoint in deg C
cSF(BLE_Client_Address, 20, "C1:76:1C:1D:F1:F7");

to set your desired setpoint the the address of your BLE sensor. cSF is shorthand for createSafeString( ) see the SafeString tutorial.

The first line in the setup() is

  Bluefruit.autoConnLed(false); // default is Bluefruit.autoConnLed(true);

which disables the Blue connection LED. Otherwise it will be flashing all night. When testing you can comment out this line to see when the BLE Feather has connected to the temperature/humidity sensor.

Software Features

The BLE_TemperatureControl.ino sketch is based the central_bleuart.ino example sketch that comes with the Adafruit nRF board package. The main changes are:-


The Very Low Power BLE Temperature/Humidity Monitor accumulates the temperature readings and these can be downloaded and plotted by the pfodApp. Here is the plot for one night from about midnight to 7:30am

As you can see the temperature s controlled to ~20.1 degC +/-0.1 and the heater turns on for about 10mins, at maximum heat (see below) each hour.

Warning about controlling an oil filled convection heater

An oil filled convection heater has a heating element inserted in the bottom via seals to keep the oil in. Over time the seals get stiff and eventually start to leak oil. In normal operation, an oil filled convection heater limits it temperature via a on-heater thermostat and the expansion of the metal case is limited also. In the first installation of this project the heater thermostat was turned to maximum (usually the heater was only run at half setting). The result was when the heater was turned on it became much hotter then normal and the extra expansion caused the seals to leak oil and release a strong smell of burnt oil. So the suggestion is to not set the heater thermostat at maximum, but instead set it just above what would be needed to heat the room to a slightly higher temperature then the setpoint. This will help prevent premature oil leaks.

After the heater started leaking it was replaced with a very old upright convection element in air heater, without a fan, with its thermostat turned to maximum. The resulting control is shown below.

The room responds much faster to this heater turning on and off and the heater cycles on/off about every 15mins. The control is still ~+/-0.1 degsC, in this case around a set point of 21degsC

Suggestions for Further Enhancements – Data Logging and Plotting and Setpoint Adjustment

The next stage of the project added the Adafruit HUZZAH ESP8266 Breakout back in (wired up as shown here) and programmed it to server a pfod menu that let the heater be turned on/off, change the setpoint and display the current room temperature. The pfodApp is need to display this menu. The free pfodDesgner was used to generate the basic menu. The Off/Auto/On was hand code following the example in Text Slider Button section of the pfodSpecification.pdf

The measurements are sent to from the Feather nRF52 to the ESP8266 as CSV <temperature>,<setpoint>,<state><newLine> where the <state> is 0 for always OFF, 5 for Auto Off, 10 for Auto ON and 15 for always ON and <newLine> is the '\n' character, e.g. the above display is set by the message 35.2,21,5

The two sketches for this version are in the BLE_Wifi_TempControl.zip file. Rev 2 adds Red Led indications. Flashing if no BLE sensor found (change the sensor battery or move it closer), Off if heater mode is OFF, On (bright) if heater mode is ON, if the heater mode is AUTO then the Red Led is dimly on.

This project could be further enhanced by using the ESP8266 to store the temperature measurements and the heater switching times and serve them as a plot on to pfodApp or on a web page.

AndroidTM is a trademark of Google Inc. For use of the Arduino name see http://arduino.cc/en/Main/FAQ

The General Purpose Android/Arduino Control App.
pfodDevice™ and pfodApp™ are trade marks of Forward Computing and Control Pty. Ltd.

Forward home page link (image)

Contact Forward Computing and Control by
©Copyright 1996-2020 Forward Computing and Control Pty. Ltd. ACN 003 669 994