Arduino Thermostat + Airing and Lights Control With Bluetooth



A simple but useful Arduino project.

Just connect your Arduino smart home 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.

Celsius and Fahrenheit version also available!

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.

Video & Downloads - the most important things!
The video shows all the important working ways, gives you ideas how to build the project from the beginning.

Attachment of this project contains a Simplified schematics (jumper wire), and a Detailed one (to solder), all needed libraries - and Arduino program codes; a Celsius and a Fahrenheit version.

The program code explains itself, useful for beginners. Well commented, describes every important steps; what, why and how. Divided into modules by functions, that’s why easy to overview.

Step 1: Working in Depth...

Working ways of the heater
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

Boiler save working- see the Graph

Since 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 more effective.

Open window detection
The program detects if a window is open, thus the temperature drops at least 0,2°C 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) 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 or above 40°C will be evaluated as malfunction or other problem (broken window, fire, etc.), and all devices will be turned off.

Step 2: Bluetooth Communication

There are two ways:

The Android GUI app - the simple way

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…

Serial Bluetooth terminal - for geeks

The other strength of my project is the geek-friend Bluetooth serial terminal usage. Just chat with the system via Bluetooth using a serial terminal – it can be an Android Bluetooth terminal 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.

Control codes:
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 function

‘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

Step 3: Let's Build!

The simplified schematics is good for try out or for absolutely beginner ones, you have to pay attention only for the pinout of the display; monochrome and bicolor displays using reversed VCC and GND pins!

I wrote the program code with u8glib, that supports a lot of display types, so you can use different types.

You can see the detailed schematics too, if you'd like to build this project for everyday use - like me.

...and the zip file contains everything, what you'll need.

Step 4: Update: 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:
1 - Lighting (10: off, 11: on, 12: flip state)

2 - Airing

3 - Heater

50 - 76 numbers are target temperature values



    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest
    • Trash to Treasure

      Trash to Treasure