Smart Bluetooth Thermostat Arduino, Airing and Lights Control

by Gyula Ősi in Circuits > Arduino

1049 Views, 9 Favorites, 0 Comments

Smart Bluetooth Thermostat Arduino, Airing and Lights Control

IMG_0523.JPG
IMG_1845.JPG
GIFMaker.org_VtJ831(1).gif
IMG_0525.JPG
IMG_0037.JPG
IMG_0523.JPG
IMG_9927.JPG
IMG_0665.JPG
IMG_0663.JPG
IMG_0650.JPG
IMG_9929.JPG
IMG_9904.JPG
IMG_9906.JPG

Just connect and control the Heater, Airing, and Lights via Bluetooth!

An intelligent thermostat routine controls the heater gas boiler, and the system switches my kitchen lights and my bathroom airing fan with relays – can be controlled by buttons and Android device or computer via Bluetooth.

Target temperature stored in the EEPROM memory.

Celsius and Fahrenheit version also available!

All parts are handmade.


Heater working ways

1: One Time Heating (15 mins) timed mode, useful at spring/autumn evenings

2: Thermostat mode (higher priority), the adjusted target temperature stored in EEPROM memory

Thermostat Routine - Boiler save algorithm

Frequent, short-term switching would cut short the lifetime of the heater gas boiler, to keep avoid it, the program uses correction values – these declares the degree of overheating and cooling back. Lower temperature demands greater correction values, because the walls are colder and adsorb better the warmth from the freshly heated-up air, so the above described effect would stronger.

Open window detection

The program detects if a window is open, thus the temperature drops at least -0, 2°C (-0, 36°F) in one minute – the heater stops or won’t start, and the airing fan will turn on in order to help refresh the air. When the air became warmer at least +0, 12°C (+0, 216°F) due to the heat capacity of the environment, the system will switch back to normal mode, and the ‘Window Alert’ event will be dismissed.

Error detection

Measured temperature under 0°C (32°F) or above 40°C (104°F) will be evaluated as malfunction or other problem (error, broken window, fire, etc.), and all devices will shut down.

Supplies

Developed on Arduino Nano (or higher) board, uses Dallas DS18B20 temperature sensor, HC-05/06 Bluetooth adapter, I2C 128X64 bicolor OLED display– you can choose different LCD/OLED display, the u8glib supports a lot of types.

Libraries: DallasTemperatureelapsedMillisOneWireSoftwareSerialolikraus/u8glib

Video

The video shows all the important working ways, gives you ideas how to build the project from the beginning.


How to Use It

Bluetooth communication

The Android GUI app has 8 buttons, sends upper and lower case letters in order to turn on (‘A’), or turn off (‘a’) the timed heater, ‘B’ and ‘b’ turns the airing, ‘C’ and ‘c’ the lights…

The other strength of my project is the nerd-friend Bluetooth serial terminal usage. Just chat with the system via Bluetooth using a serial terminal – it can be an Android app, but even a normal PC will do – for example the Serial Monitor of the Arduino IDE.

The controller sends temperature reports in every minutes automatically, and instant reports about all events, such as an attached device has been turned on/off, the thermostat routine activated, and so on.


Blue: sent code, Green: received message

Control codes

It accepts control codes and sends confirmation messages. My command structure based on two digit numbers like ‘XY’ – where ‘X’ is the device code, and ‘Y’ is the opcode:

30, 31, 32: lighting Off / On / flip logical state

40, 41, 42: airing Off / On / flip logical state

50, 51, 52: one time heater program Off / On / flip logical state

10 – 24 numbers will be accepted as Target Temperature for the Thermostat routine

‘r’ – report about working state of controlled devices

‘w’ – manually disables the “window alert” event, if you don’t want to wait for its automated dismission

‘A, a… H, h’ – letters are accepted as the GUI app would have sent

Fahrenheit version

I was converted all the correction variables, reference and ratio values, so the system kept its calculation and working particularities.

Only a few modification. The new device codes of the Fahrenheit version:

1x - Lighting (10: off, 11: on, 12: flip state)

2x - Airing (20: off, 21: on, 22: flip state)

3x - Heater (30: off, 31: on, 32: flip state) - Timed 15min heater mode

50 - 76 numbers are target temperature values - Thermostat mode

Create the PCB

BT thermostat - Detailed schem.JPG
IMG_1081.JPG
BT thermostat - Simplified Schem.JPG
IMG_9291.JPG
IMG_9287.JPG
IMG_9782.JPG
IMG_0190.JPG
IMG_9904.JPG
IMG_0380.JPG
IMG_0263.JPG
IMG_9894.JPG
IMG_9906.JPG
IMG_0213.JPG
IMG_0370.JPG
IMG_9118.JPG
IMG_0266.JPG
IMG_20190127_130941693.jpg
IMG_1679.JPG
IMG_0525.JPG

I designed the project to made up of modules, so it can be disassembled for further experiments and tests. For ideal use of space, several layers of PCBs are connected to each other via pin connectors. The photo gallery helps to create your own.

Create the Enclosure

IMG_9255.JPG
IMG_9733.JPG
IMG_9256.JPG
IMG_9340.JPG
IMG_9835.JPG
IMG_9839.JPG
IMG_9341.JPG
IMG_9355.JPG
IMG_9356.JPG
IMG_9919.JPG
IMG_9921.JPG
IMG_9350.JPG
IMG_0057.JPG
IMG_0872.JPG
IMG_1713.JPG

I chose a simple but high-quality electricial installation box for this project, I used only basic hand tools for the design. 80 by 80 millimeters isn't so big, it demanded the compact interior layout.

Create the Temperature Sensor Unit

IMG_0318.JPG
IMG_0309.JPG
IMG_0304.JPG
IMG_0313.JPG
IMG_0314.JPG
IMG_0315.JPG
IMG_0316.JPG
IMG_0334.JPG
IMG_9712.JPG
IMG_0340.JPG
IMG_0344.JPG
IMG_0347.JPG
IMG_0348.JPG
IMG_0303.JPG
IMG_0710.JPG

To keep avoid the disturbance of the circuits operational heat output I placed the temperature sensor further away, used the top of the same box type for it, covers the place of the original analogue thermostat. For the precise measurement I cut heat insulating material into it.

Wall Mounts

IMG_0464.JPG
IMG_1691.JPG
IMG_0465.JPG
IMG_20190123_120740612.jpg
IMG_20190123_124957591.jpg
IMG_20190124_121337563.jpg
IMG_0469.JPG
IMG_0471.JPG
IMG_0472.JPG
IMG_0476.JPG
IMG_0480.JPG
IMG_0870.JPG

At the end, I mounted both of units on the wall after installing the power supply and the digital data cables.

Conclusion

I'm not kidding you. This is a tested and well-tried project, it's been controlling the heating in my apartment for five years without any malfunction. The temperature is always even, never too cold or too warm.

It's cozy to manage using a smartphone.

In addition to the Thermostat function, the One-time Timed (15min) heating function is also very useful in spring or autumn evenings before going to sleep.