Building  Automation & SMART HOME based on ESP8266 microcontrollers & Raspberry pi platform

Home (building) automation may decrease home maintenance costs or reduce wasting and definitely increases comfort of the household members

Purpose of the project:
The project has been motivated by author's hobby. Electronics, programming  and networking it's a great mix while almost everything may be done especially having Internet of Things (IoT) support. 


Project approach:
The project is NOT based on "ready to go" smart devices/systems dedicated for home automation like Tasmota, ESPhome solution or smart sockets with branded firmware, however some of them are in use too. 
The project is mostly based on microcontrollers ESP8266 which can work with a number of Arduino peripherals. Adding some code (C++) gives control on their input/output with desired logic behind. Thanks to that, a ESP8266 with Arduino sensor, stepper motors, radars and so on, may be used in many roles and do whatever is needed.
All of it, is integrated with user-friendly User Interface (UI) which is based on Home Assistant software hosted on local Raspberry Pi server. HA UI does use its own API based on XML which is parsed by ESP8266 microcontrollers. Data is stored in Home Assistant database and it may be pulled by standard SQL queries.
Quality of used sensors is good enough. After few years of using Arduino sensors, I can surely say, they are reliable. Most importantly, the sensors fulfill their function in all the cases. Measures are done in an accepted measure tolerance, so there is no need to looking for new solutions. It has to be pointed too - the prices of these microcontrollers and sensors are extremely low, means ESP8266 + relays + temperature sensors + PIR sensor may be build withing less than $10 USD.


Place of implementation:
This project has been implemented in two-floored house with basement and attic. It also covers backyard, garden and estate gate and gateway. It does use home WiFi network.
Portable module may be used everywhere on our Globe where GSM coverage exists.


Technologies used:


System characteristics: 


Some of the main features: 

Fans:
Kitchen, bathroom/restroom, whole floor.
Exhaust fans (750 m³/h each) are installed on chimney. One is dedicated for the kitchen cooker hood, second for bathroom/restroom. There also two fans installed inside (~540m³/h each) for internal air circuit and to supply fresh air from outside. Small fan is also installed in pantry and is connected with bathroom steerage.
All these are based on single ESP8266 board.

Some use cases:


LED strips lighting (kitchen, bathroom, staircases and restroom):
To achieve cost saving, the LED lights (60W in total) are configured to auto turn on/off depends on PIR detection in specific area. Ideal solution if small kids at home.
All these automations are based on ESP8266 board.


Photovoltaic (PV) management:


Central heating and hot water management:

If it meets given conditions, means:

It turns on the water pomp for specific time (currently 5 min). It also sends states of pump and water temperatures to Home Assistant UI to gather statistics. 


Other home Devices management:


PBX based on Asterisk:

All the features above are based on Raspberry PI GPIO. 


Audio notifications:


CCTV:


Presence detection:
It is useful to know if there is anyone at home. There is specific solution implemented - if set of PIRs on a level detect move, they triggers specific virtual button and keep it active until in next 15 minutes there will be no movement. 


Other:


Back-end features that improve stability of whole system:


Home alarm:
There is expanded alarm management. It will not be described here due security reasons. However there is interesting feature that brings comfort to household members:


Raspberry PI - roles:


Home Assistant - roles:
Home Assistant software is critical as it is interface for human as well as interface for esp8266 microcontrollers. That means that data send by devices is used by other microcontrollers and devices as their input. For instance, weather station gives data about humidity outside, so esp8266 that manage fan for bathroom may trigger fan in desire moment. Weather sensor gives also data about  light (day/night), so microcontroler responsible for lights may turn them off/on depends of time of day.
Home Assistant is known from add-ons or, let's say, plugins so called "integrations". Integrations may be official, fully supported but also may be created by community (over HACS). Community integrations give huge chances that there will be software that is currently needed.
Home Assistant in this project has following integrations (so far):


In deployment & planned features:

ESP8266
Pic. 1. Microcontroller ESP8266
Pic. 2. Own made electronic board
Pic. 3. Electrical relay (230V) combined with ESP8266
Pic. 4. Raspbery PI platform
Pic. 5. Asterisk software Logo
Pic. 6. Home-Assistant 
Pic. 7. ESP8266 as nodeMcu DevKit
Pic. 8. AC regulator for went speed control