Introduction: Home Automation - First Steps - Knowing the Room Temperatures

I wrote this Instructable, as I have started my adventure into the world of 'Home Automation', with the initial view to control the heating in my house, with a lot of rooms being heated when it was not needed, a common story I think, plus other things for the future.

I initially thought about what the first stage was to be, since I wanted to monitor and control the temperature in each room and use this information to open and close the radiator valve, using a linear actuator. I set about buying the parts for the Controller, but also bought a couple of linear actuators and controllers, as I knew I would want them and they were available from where I was also buying a few other parts. (saved on the postage!!)

So this instructable is about the first stage in that process .. The Room Temperature Monitor / Controller.

The parts I used are listed below : (Per Controller)

1x ESP8266-01 – I used the 1Mb version

1x HTU21D

1x LCD 1602 (with I2C adaptor .. some come fitted others need it to be purchased and fitted separately)

1x 10kohm Resistor

Housing

Momentary switch (Optional if reset facility is wanted)

5v PSU (I used an old phone charger and removed the case)

Buck convertor.

Header Pins (Optional)

Various lengths and colours of link wire.

You will also need an FTDI UART to program the ESP8266

****

Let's Begin:

****

Once I had all the parts available for the controller it was a fairly quick and easy process to put them all together.

Firstly I had to make the cut-out for the LCD display in the case. This was done using a small fret saw.

I then started to deal with the electronics:

Preparing and flashing ESP8266-01 with the firmware I intended to use. (ESPEasy)

a) To use the ESP8266 it needs a 10k resistor from the Vcc to CH-EN pin.

With that done it is just needed to connect the ESP8266 to the FTDI board, to flash the ESPEasy firmware. I used the 'FlashESP8266.exe' that came bundled in the ESPEasy zip file.

Please Don't Forget :

a) Ensure the FTDI board is set to 3v3 if it is a dual voltage type. DO NOT USE A 5v VERSION or you will fry the ESP8266!! (From Experience)

b) Make sure that the ESP8266 is in 'FLASH' mode

Once the flashing process completed it was then possible to connect the ESP8266 to the local WiFi following the instructions HERE.

If you use DCHP the note the IP address allocated, otherwise if you added a static address remember it!

Assemble the HTU21D. This is a simple thing of adding the header pins to the board.

Mount the ESP8266, HTU21D (and the optional header pins) onto the stripboard and solder.

I splayed the pins out slightly to hold it in place and then cut the strip between the pins of the esp8266. Mount the HTU21D and again splay the leads to hold it in place

Solder the pins, and using link wire join the ESP8266 and the HTU21D as follows:

I used GPIO 0, and GPIO 2 of the ESP as the SCL and SDA connections and linked these to the SCL and SDA pins of the HTU21D.

Join the Vcc and GND pins on both units and take leads out ready to connect to the PSU.

(I also connected to the header pins, but this was for ease of re-flashing and testing, but it is not essential).

The LCD display needs to have the I2C adaptor soldered to it. Then add the Vcc and GND leads to the pins of the I2C board. Once I had checked the connections I powered up to check it was working … surprisingly it did first go …

Mount the LCD in the Box. (I used hot melt to the corners to hold it in place).

Mount the stripboard with the HTU21D and the ESP8266 into the bottom of the case, again I just used hot melt glue to hold it in place. Link the SCL and SDA pins to those on either the HTU21D or the ESP8266.

I then mounted the psu and buck convertor onto the back of the cover plate, so that it would be in the wall box. Connect the 5v output of the supply to the Input pins of the buck convertor and power up. Set the output Volts to as close 3v3 as possible.

Connect the 5v & GND INPUT of the buck convertor to the LCD Vcc and GND. Connect the 3v3 OUTPUT of the buck convertor to the Vcc & GND of the ESP8266 (or HTU21D).

Setup ESPEasy … to do this you will need to connect to the unit using a web browser and use the IP address noted above. The 'Lets Control It' (aka ESPEasy) wiki is a very good source of information on setting up ESPEasy, and they can do it much better than me, after all they wrote the firmware.

Once I had everything running, I calibrated the sensor(s) using a known standard thermometer and any differences can be adjusted in the Devices, open the edit section of the Sensor and adjust the formula

I now have a sensor in each of the 4 Bedrooms, Landing, Hall, Kitchen / Diner, Office and the Lounge. They all are linked to a Raspberry Pi, running Mosquitto MQTT server and linked to MySQL, which logs the temperature (and Humidity) to a database for future analysis.

These have all been working well and will be upgraded to control the radiator valves, so that the rooms are only heated if occupied or if the frost protection kicks in.

I have included a copy of the preliminary 'Rule' that is being used to control the LCD, (Turns on in the morning and turns off at night .. It's too bright to leave on , unless you want a night light as a by product. Just cut'n'paste into the rule, if you want to do the same. This is where the controls for the Radiator valves and other things I want to control based on temperature and / or time will go.

On System#Boot do

timerSet1,10

endon

on Clock#Time=All,08:30 do // controls all LCD's. Can be added to each unit rather than have all controlled by //one unit.

LCDCMD,ON

SendTo 1,LCDCMD,ON

SendTo 2,LCDCMD,ON

SendTo 3,LCDCMD,ON

SendTo 4,LCDCMD,ON

SendTo 5,LCDCMD,ON

SendTo 6,LCDCMD,ON

SendTo 7,LCDCMD,ON

endon

on Clock#Time=All,21:00 do

LCDCMD,OFF

SendTo 1,LCDCMD,OFF

SendTo 2,LCDCMD,OFF

SendTo 3,LCDCMD,OFF

SendTo 4,LCDCMD,OFF

SendTo 5,LCDCMD,OFF

SendTo 6,LCDCMD,OFF

SendTo 7,LCDCMD,OFF

endon

***

I am now onto the next bit of the Home Automation --- Controlling the Radiator Valves.

***

Note: I have found this Project in Instructables ..

which is exactly what I was going to do!! .. and using the exact same linear actuator.

Thanks AJStubbsy for saving me a lot of effort. Your work on this project is brilliant.


Update : Since finding the 'Smart Rad Valve' Instructable Project, and building 2 so far, I have added the first stage of MQTT control for the valve in the Master and Second bedrooms, to the rules section of the controller.

Just add this to the rules section and adjust the temperature you want and the topic that the Rad Stat subscribes to and it will turn off the radiator until the temperature drops below the set point. I am currently working on controlling it by time, temperature and if the boiler is called, and call the boiler if needs be. I'll update this in the future as I make progress.

Extra 'Rules' lines: Change 'MBTH' to suit your naming convention and which room the sensor is controlling

on MBTH#Temperature do // Controls the radiator valve

if [MBTH#Temperature] > 18 do // if the temp is above 18°C Closes Valve

Publish sRV_MB/move,OFF // Master Bedroom Srv

timerSet1,10

else // if the temp is below 18°C Opens Valve

Publish sRV_MB/move,ON // Master Bedroom Srv

timerSet1,10

endif

endon

Happy Automating