Room Heater Control Via BLE Temp Sensor and ESP-01 Timer Switch

Introduction: Room Heater Control Via BLE Temp Sensor and ESP-01 Timer Switch

Updated 2nd May 2022 – Rev 4 using simple long life BLE temperature sensor

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 very simple long life BLE temperature sensor to measure the temperature at a central spot in the room and broadcast the temperature as part of its advertised name. The Adafruit BLE board scans for near by BLE devices, picks up the temperature and then controls a 40A Zero Crossing Solid State 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.

This project is also available online at BLE Room Temperature controlled 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 the3G/2G SMS Remote Control Power Switch, the Simple BLE Temp Sensor for Beginners runs 5 Years on Coin cell, the WiFi to BLE Bridge and the ESP-01 Timer Switch

The Simple BLE Temp Sensor for Beginners runs 5 Years on Coin cell provides the remote room temperature sensing. It mounted on the side of a book case and will run for 5 years on its CR2032 battery. Every 100 seconds it advertises its name together with the current temperature, eg. T_3,22.25 The nRF52832 uC on chip temperature sensor is used. It is not very accurate, but since the temperature is to be controlled at about 20 degC, only need a single point calibration to get +/-0.5 degC accuracy.

The Adafruit nRF52 Feather from the WiFi to BLE Bridge is a programmed to continually scan for BLE devices. If the device name does not start with T_3, then it is ignored. Otherwise the device name is parsed to extract the current temperature. If the room temperature is low the Adrfruit Feather drives the control input to the 40A Solid State Relay from the 3G/2G SMS Remote Control Power Switch, with the SMS board replaced with the WiFi to BLE Bridge. The Adrfruit Feather output is specially configured as a 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 there are no current spikes on the power line as the heater only turns on and off just when the AC voltage crosses zero.

To control the over all on/off times of this heater the ESP-01 Timer Switch relay is inserted between the Adafruit Feather output and the Solid State Relay input. The ESP-01 Timer Switch is controlled via its webpage.

When the ESP-01 Timer Switch is set to Auto, it will disable the Solid State Relay input outside the set On/Off times. The ESP-01 Timer Switch uses internet time (NTP server) to prevent time drift and has the local time zone set to handle daylight saving changes automatically.

The Adafruit Feather is in turn controlled via the ESP8266 WiFi via pfodApp (no Android programming required) to set the desired room temperature and display the current temperature and weather the heat should be set ON/OFF or auto controlled by the BLE temperature sensor and to display a plot of the room temperature over the last 24hrs. As mentioned above this ON/OFF/Auto control is further controlled by the ESP-01 Timer Switch settings. If the Timer Switch is set to ON, the Adafruit Feather's ON/OFF/Auto has full control. If the Timer Switch is set to OFF, the heater is always OFF. If the Timer Switch is set to AUTO, the Adafruit Feather's ON/OFF/Auto only has control between the Timer Switch's On Time and Off Time.

The control menu, sliders, plot etc, was designed using pfodDesignerV3. Here a simple black/white color scheme is used, but pfodDesignerV3 makes it easy to choose your own font and background colors. The entire menu and plot format is contained in the Arduino sketch. No Android coding is required.

Another feature of pfodApp is that the plots can be zoomed, in both axes, using two fingers. Above is the plot of the last 3 days temperatures zoomed in to 20hrs and with the temperature zoomed into 18degC to 25degC. This shows the heater controlling the temperature within in +/-0.5 degC.



Supplies

For the parts list for this project see the parts lists of the four (4) previous projects.

The 3G/2G SMS Remote Control Power Switch, the Simple BLE Temp Sensor for Beginners runs 5 Years on Coin cell, the WiFi to BLE Bridge and the ESP-01 Timer Switch

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.

pfodApp / Adafruit HUZZAH ESP8266 are required to adjust the temperature setpoint and plot the last 3 days temperatures. If you hard code your desired temperature and don't need to view the previous temperatures, you can omit the Adafruit HUZZAH ESP8266 from the WiFi to BLE project and omit the pfodApp.

The ESP-01 Timer Switch can be controlled via a web page from any web browser.

Step 1: Construction

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 three 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 Timer 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 Timer Switch. However for this application the very short on time on power up does not matter so the capacitor was omitted.

Step 2: Programming

For the ESP-01 Time Switch, follow the programming instruction given in that project.

For the WiFi to BLE Bridge, follow the programming instructions given in the Simple BLE Temp Sensor for Beginners runs 5 Years on Coin cell - BLE to WiFi Bridge section, but use the following sketches to program the Adafruit Feather, BLE_TemperatureControl_BLE_R4.ino, and the Adafruit HUZZAH ESP8266, BLE_TemperatureControl_WiFi_R4.ino, boards. These sketches are in the BLE_TempControl_R4.zip file. Download BLE_TempControl_R4.zip and unzip it to your Arduino sketch directory. The sketches need a number of supporting libraries, SafeString available via the Arduino library manager and ESPAutoWiFiConfig.zip from ESP32 / ESP8266 Auto WiFi Config and pfodParser.zip library. The file libraries_RoomTempCtrl_R4.zip contains all the necessary libraries. Just download it and unzip it to your Arduino sketch directory.

The Adafruit Feather stores the Auto/On/Off and setpoint and senor setting in a file in flash memory so they are retained if the entire unit is turned off. The on/off of the ESP-01 Time Switch only controls the Solid State switch, not the power to the Adafruit Feather. The file system need initializing, so first time you program the Feather, uncomment the #define INITIAIZE_FILE_SYSTEM near the top of the BLE_TemperatureControl_BLE_R4.ino sketch and load and run the sketch to set up the file system, then comment out the define again for the final programming.

The red led on the Feather indicates the mode of operation. The led is off for heater OFF, on bright for heater control ON and on very dim for heater control AUTO. If the scan does not find the sensor, the led will flash rapidly.

Messages between the BLE Feather and the ESP8266 are in CSV format. See the comments in the sketches for the format

Step 3: 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.

Step 4: This Step Is Empty


Arduino Contest

Participated in the
Arduino Contest

Be the First to Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Sculpt & Carve Challenge

      Sculpt & Carve Challenge
    • First Time Author Contest

      First Time Author Contest

    2 Comments

    0
    drmpf
    drmpf

    Tip 2 months ago on Step 4

    Updated 2nd May 2022 – Rev 4 using simple long life BLE temperature sensor

    0
    drmpf
    drmpf

    Tip 7 months ago on Step 4

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