pihome
Posts: 15
Joined: Tue Aug 09, 2016 1:35 pm
Contact: Website

DIY Open Source PiHome Smart Heating Control

Wed Nov 15, 2017 11:06 pm

Hi Guys,
Its my first project base on Raspberry pi so i thought i can share here and if you want you can download it from my site at PiHome site .

Background: i have two story house with basic heating system installed in around 2007 when house was built with three zone i.e ground floor, first floor and hot water. ground floor thermostat located in hallway which isn't ideal and its always colder then other parts of the house and same goes for first floor where thermostat was installed in master bed and no way of controlling heating in kids room. and hot water was even disaster in itself as thermostat was on water tank and not so easy to access and it was left on 79C all the time.

Home Page
Image

OnTouch Options i.e Boost, Override, Night Climate, Away etc...
Image

Boiler Graph in Hours for last one Year
Image

Schedule List
Image

Saving Made by PiHome for me
Image

Boiler Logs
Image

Boiler Logs
Image

Total Code for PiHome
Image

More Images Link

What is required:
  • Raspberry Pi with WiFi(any version would do) RPI3 is faster hence web page loading time is less.
  • One Wire DS18B20 Temperature Sensor
  • 5v 4 Channel Relay Module with optocoupler (Number of relays depend on your number of zone)
  • 5v 2 Channel Relay Module with with optocoupler
  • nRF24L01+/2.4GHz RF Wireless Module
  • nRF24L01+ 2.4GHz with PA+LNA Wireless Module
  • Bi-Directional Logic Level Converter (if you want to use Serial Gateway)
  • Node Mcu Lua ESP8266 Development Board (if you want to use WiFi Gateway)
  • Arduino Pro/Pro Mini 3.3v (number depend on your zone as each zone will have its own temperature sensor)
  • Arduino Pro/Pro Mini 5v (you need two one for zone controller rely and second for controlling boiler relay)
Step 1
OS (Raspbian Jessie) Installation and WiFi Configuration

Step 2
Install Apache, PHP and MySQL on a Raspberry Pi (LAMP)

Step 3
MySQL Access From Remote Computer

Step 4
Download pihome and Import MySQL database from /MySQL Database folder and add all view tables.

Step 5
Change Database Settings in st_inc/_config.inc.php

Step 6
Change database and MySensors WiFi gatway settings in cron/wifigw.py

Step 7
Make All Cron job folder scripts executable and Setup Cron Jobs as per cronjob cron/CronJobs List

Step 8
Build MySensors WiFi Gateway

Step 9

Build 18650 Battery Powered Temperature Sensors

Step 10 (Optional)
If you like to control your heating while you are away you can install OpenVPN on raspberry pi and connect to your pi remotely.

all sources available at pihome site for you to abuse ;)

Cost of this project
Temperature Sensors Node
NRF24L01+ 2.4GHz Wireless Transceiver 0.66€
Pro Mini 328 Mini 3.3V/8M 1.35€
DS18B20 Thermometer Temperature Sensor 0.53€
Temperature and humidity sensor plastic box 3.48€
18650 Battery 3.7V Li-ion Rechargeable Battery 1.56€

MySensors Gateway
Wireless module CH340 NodeMcu V3 Lua 2.39€
NRF24L01 PA LNA 20dBm 2500m Long Distance SPI 2.4GHz 3.87€

Multi Zone Controller Relay
4 Channel relay module with optocoupler 1.74€
NRF24L01+ 2.4GHz Wireless Transceiver 0.66€

Boiler Controller Relay
2 Channel relay module with optocoupler 0.84€
NRF24L01+ 2.4GHz Wireless Transceiver 0.66€

Raspberry Pi for PiHome
Raspberry Pi 3 or 2 or B+ which ever you want to use. 35€
Raspberry pi Casing 1€
Raspberry Power Supply 6€
SD Card for Raspberry Pi 5€

General Items used in project
Double Side Copper Prototype PCB Universal Board 6.66€
Metal Film Resistor Kit Pack Mix 4.92€
Single Female Pin Header Case For Arduino 2.20€
0.1 uF 104 50V Mono Monolithic Capacitors 0.78€
4Pin Double Row Straight Pin Female Header 0.87€
values 0.22UF-470UF Aluminum electrolytic capacitor assortment kit 1.35€

Total Cost for this project is 80.02€
Raspberry Pi - PiHome Smart Heating Control

hunty1980
Posts: 36
Joined: Mon May 22, 2017 3:25 pm

Re: DIY Open Source PiHome Smart Heating Control

Mon Dec 18, 2017 10:14 am

This looks like an interesting project and keen to give it a try. However, my hardware setup is slightly different and wondering if this will work with what I'm running?

I have a Raspberry Pi 3 connected to two relays - 1 relay controlling the Heating and the other relay controlling the Hot Water. I use a DS18B20 temp sensor, connected to a Raspberry Pi Zero W, to send the current room temperature back to the Raspberry Pi 3. I'm currently using Node-Red to communicate between the RPi Zero and RPi 3, using MQTT.

Advice and guidance appreciated on whether PiHome will work with this setup and how to achieve it.

pihome
Posts: 15
Joined: Tue Aug 09, 2016 1:35 pm
Contact: Website

Re: DIY Open Source PiHome Smart Heating Control

Mon Dec 18, 2017 1:14 pm

@hunty1980
how you are controlling your gas boiler (heat source)? pihome project works with mysensors library.

temperature sensors and relay to control each zone and second relay to control gas boiler are wireless using nRF24L01.
temperature sensors are battery powered.

i have wired systems where temperature sensors and boiler/zone relays wired to same raspberry pi but i stopped development on that project about year ago but i can give you copy of that.

pihome
Raspberry Pi - PiHome Smart Heating Control

hunty1980
Posts: 36
Joined: Mon May 22, 2017 3:25 pm

Re: DIY Open Source PiHome Smart Heating Control

Mon Dec 18, 2017 1:22 pm

pihome wrote:
Mon Dec 18, 2017 1:14 pm
@hunty1980
how you are controlling your gas boiler (heat source)? pihome project works with mysensors library.
I have a Raspberry Pi 3 connected to a relay, which is controlling my boiler - on and off. I then have a Raspberry Pi Zero W, with temp sensor (DS18B20) sending the temperature to the Raspberry Pi 3 (connected to the bolier via relay)

pihome
Posts: 15
Joined: Tue Aug 09, 2016 1:35 pm
Contact: Website

Re: DIY Open Source PiHome Smart Heating Control

Tue Jan 02, 2018 11:49 pm

@hunty1980
sorry for late reply, i have added comments in cron/boiler.php file in case if you have boiler/zone valve connected on RPI GPIO. rest of the project stay same. let me know if you this does not work for you.
PiHome
Raspberry Pi - PiHome Smart Heating Control

pihome
Posts: 15
Joined: Tue Aug 09, 2016 1:35 pm
Contact: Website

Re: DIY Open Source PiHome Smart Heating Control

Tue Feb 13, 2018 5:56 pm

Hi All,
i have added support for Zone controller relay & boiler relay directly connected to raspberry pi GPIO.
as of today. you need to uncomment following lines.

205, 206 for Zone Relay
247, 248 for Boiler Relay ON status
285, 286 for Boiler Relay Off status
Raspberry Pi - PiHome Smart Heating Control

pihome
Posts: 15
Joined: Tue Aug 09, 2016 1:35 pm
Contact: Website

Re: DIY Open Source PiHome Smart Heating Control

Fri Mar 02, 2018 10:03 pm

Hi All
i have added option for nRF24L01 wireless and wired to rpi GPIO. check out how to build link and for all wiring connections etc.. let me know what you guys think.

Wired Heating System Connected to Raspberry Pi GPIO
  • 1-Wire DS18b20 Temperature Sensor
  • Multi Zone Heating Control System Relay
  • Raspberry pi Heating Boiler Control System Relay
nRF24L01 Wireless Heating System Based on MySensors Library
  • Battery Powered Arduino DS18B20 Temperature Sensor
  • Wireless Arduino Boiler Controller Relay with nRF24L01
  • Wireless Arduino Multi Zone Controller Relay with nRF24L01
  • MySensors Serial/WiFi/Ethernet Gateway to communicate all nRF24L01 radio
Raspberry Pi - PiHome Smart Heating Control

amarden
Posts: 1
Joined: Sat May 09, 2020 6:44 am

Re: DIY Open Source PiHome Smart Heating Control

Sat May 09, 2020 6:55 am

Would like to install this alongside home assistant on my Rasberry pi 4 using docker. Had anyone done this and is a docker image available?

pihome
Posts: 15
Joined: Tue Aug 09, 2016 1:35 pm
Contact: Website

Re: DIY Open Source PiHome Smart Heating Control

Sat May 09, 2020 4:57 pm

@amarden,
img file hosted on PiHome website is for raspberry pi, compatible across all version of rpi, if you have knowledge and want to get involved in creating docker image please feel free to contact me. i have not experience in creating docker img, but willing to invest some time in it.
Raspberry Pi - PiHome Smart Heating Control

Guytas
Posts: 30
Joined: Fri Jun 26, 2020 5:19 pm

Re: DIY Open Source PiHome Smart Heating Control

Fri Oct 02, 2020 12:34 pm

Hi,

Wow, very impressed. I found this thread because I’m in the middle of writing my own thermostat application. I am almost done with the software part but i was investigating on the logic of anticipation of the temperature. I also have a radiant heat floor. I just cannot wait to get the temperature i want before turning off the heat because the temperature will keep increasing for quite a while still. So i was wondering if you can lead me to the section where you do that?
Sorry for my weird talk... I’m french

Thabks

pihome
Posts: 15
Joined: Tue Aug 09, 2016 1:35 pm
Contact: Website

Re: DIY Open Source PiHome Smart Heating Control

Fri Oct 02, 2020 2:14 pm

@Guytas
no worries at all, PiHome implement logic of anticipation of the temperature with weather temperature factor with Deadband. have look at the code, its all open source. you can download img file or if you think you can contribute any code in project feel free to have look at PiHome Github repository
Raspberry Pi - PiHome Smart Heating Control

mlp6868
Posts: 23
Joined: Sun Sep 27, 2020 11:48 pm

Re: DIY Open Source PiHome Smart Heating Control

Sat Oct 03, 2020 5:34 am

This is cool! I made almost the same thing, incidentally around the same time as you, and exactly for the same reason:
i have two story house with basic heating system installed in around 2007 when house was built with three zone i.e ground floor, first floor and hot water. ground floor thermostat located in hallway which isn't ideal and its always colder then other parts of the house and same goes for first floor where thermostat was installed in master bed and no way of controlling heating in kids room.
I haven't parsed every little bit of your project... can I ask why you need so much diverse hardware? (Nothing wrong with it, just wondering).

I use a Pi as the "head unit" to control the furnace/AC through a number of relais, mimicking the function of "dumb" thermostats. My single-purpose temperature sensors are ESP8266s with a DS18B20 that send a temperature reading every 30s or so. In a few places where I need additional functionality (front room that has a cam, garage where I control the doors, etc) I deployed Pis with a 18B20 that also double as bluetooth sniffers for "presence detection" - relax on heat or A/C when no one's home. (And yes I know I could meanwhile use ESP32s for that, predates '32's).

Very cool, I'll take some interface design hints from yours!

- mlp

pihome
Posts: 15
Joined: Tue Aug 09, 2016 1:35 pm
Contact: Website

Re: DIY Open Source PiHome Smart Heating Control

Sat Oct 03, 2020 8:03 am

Hi mlp,
My team is working on PiHome to make it compatible with North America system, and we are trying to understand consumers requirements and trying to cover all aspects of North America HVAC system, can you drop me email may be i can pick your brain.

All tech guys can work and live with rpi and bare esp with sensors connected but for ordinary person its very difficult to grasp hence our efforts to make it plug n play for ordinary person.
Raspberry Pi - PiHome Smart Heating Control

mlp6868
Posts: 23
Joined: Sun Sep 27, 2020 11:48 pm

Re: DIY Open Source PiHome Smart Heating Control

Sat Oct 03, 2020 11:59 pm

Yeah, why not. I'm normally more active in other boards, joined here just a few days ago for a specific thing. I don't see how one can send a PM here (or haven't found it). On your web page there isn't an obvious contact email either.

What prompted my question about the hardware was mostly the use of Arduinos, which tend to make a project much more expensive for a not so versatile piece of hardware.

I live in New York (the state not the City) but I am from Europe and know some of the controls you tend to have there.

Let's see what we can learn from each other.

Let me briefly describe what I had until a year ago ( when I moved to a house with a different system). The old one was a bit more complicated than this one. While I'm running my system at the new place, it is much easier and straightforward here.

The old place had a 3-zone heat (bedrooms, living area, basement) with hot water heat with circulation pumps. The head unit would control the pumps individually and turn the one in question on when a room demanded heat. But the system did not directly control the oil-fired furnace. That turned on when the temperature of the water reservoir dropped below a set value, until it was hot enough again. So I tapped into the controls for the furnace to know when the furnace was actually firing. I found that to be one of the most interesting numbers. Each day I would get a report about the total firing time, which translates into the amount of heating oil used. I could figure out which internal doors to close and which ones to leave open to minimize the firing times for a given outside temperature. I could also tell how efficient a insulation project turned to be when it was completed (New York then sponsored a free evaluation how to improve your energy efficiency). Normalized to outside temperature (degree days), I learned that the new insulation saved me 15%. Another 15% savings compared to "dumb" thermostats came from the much more agile heat control. For example, the system knows when the house is not occupied and lowers the heat (or relaxes the AC in the summer) then. Overall, in the old house, my oil delivery guy told me that my house used by far the least amount of heating oil of all his customers.

Soon I will have been a full year in the new place and know more parameters for all seasons....

- mlp

pihome
Posts: 15
Joined: Tue Aug 09, 2016 1:35 pm
Contact: Website

Re: DIY Open Source PiHome Smart Heating Control

Sun Oct 04, 2020 12:19 am

@mlp
you can contact me on info at pihome dot eu, there is no way of pm on raspberry forum for sure.
yes atmega328p is on expensive side for what it can deliver, unfortunately we dont have any hardware specialist in the team who can suggest or work on better mcu.
i was under the impression that in North America you only have one zone system, heating or cooling with fan. but you have enlightened me, as you are from Europe and living in New York so you have better experience in using both systems. PiHome definitely can befit for your experience of both worlds.
looking forward to hear from you.
Raspberry Pi - PiHome Smart Heating Control

cleverca22
Posts: 1329
Joined: Sat Aug 18, 2012 2:33 pm

Re: DIY Open Source PiHome Smart Heating Control

Sun Oct 04, 2020 2:55 am

i had also made something similiar back in 2011

the main AVR manages a network of DS18b20's all over the house, and if a certain sensor goes outside a defined range, it wiggles a GPIO in the right direction

a small bank of SSR's then simulates the thermostat, turning the heating system on/off as needed

the AVR also spits out the current reading over serial, and a normal x86 desktop (with an FTDI) records it for graphing

and a custom android app can then connect to that x86 desktop, to change what the "defined range" is for each zone from earlier

i could easily replace the x86 desktop with a pi, but that desktop is already on 24/7 for other reasons

Code: Select all

"s r 23 12 7 9 25 1 23 10 25 4 23 10 c 1023 95 0 e"
"2020-10-03 23:53:33  bedroom temp: 25.06c(77.11f), kitchen: 23.62c(74.53f), living room: 23.62c(74.53f), outdoor: 7.56c(45.61f), server: 25.25c(77.45f) VCC: over 4.5 volts portb: 00000000"
"s r 23 11 7 8 25 2 23 10 25 4 23 10 c 1023 96 0 e"
"2020-10-03 23:53:42  bedroom temp: 25.12c(77.22f), kitchen: 23.62c(74.53f), living room: 23.62c(74.53f), outdoor: 7.50c(45.50f), server: 25.25c(77.45f) VCC: over 4.5 volts portb: 00000000"
debug logs from the x86 end of things, the odd lines are the raw data over the uart, the even lines are fully parsed and F added for the silly americans that dont know what 25c is, lol

User avatar
rpdom
Posts: 17548
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: DIY Open Source PiHome Smart Heating Control

Sun Oct 04, 2020 7:49 am

cleverca22 wrote:
Sun Oct 04, 2020 2:55 am
i had also made something similiar back in 2011

the main AVR manages a network of DS18b20's all over the house, and if a certain sensor goes outside a defined range, it wiggles a GPIO in the right direction
Mine was in 2013, but using a Pi instead of an AVR.

At first it was just to maintain a steady temperature in one small room to keep my wife's pet warm while we were away fro a few days in December. That one used a DS18B20 and a relay that switch a small electric heater.

When we got home I realise I could expand that to cover the heating for the house, moved the sensor and Pi to the main room and put the relay in place of the time switch that controlled the heating. Doing it on the time switch meant that all of the safety features of the heating system were still in place. It couldn't get too hot or cold or blow up or anything.

Then I set up a database with a temperature profile to say what temperature the house should be at a particular time of day in 5 minute intervals. I also record measured temperature against desired temperature and if the heating is on or off at that point.

That Pi is still running the heating. It has saved me a lot of money by not running heating on warm days and also kept us warm on unexpected cold days.
Unreadable squiggle

mlp6868
Posts: 23
Joined: Sun Sep 27, 2020 11:48 pm

Re: DIY Open Source PiHome Smart Heating Control

Sun Oct 04, 2020 2:13 pm

Ok, I have sent you an email.

Let me put his into a bit of context. My setup is and remains a hobby project that strives to collect all data about my house, and make comprehensive controls of "everything" - well, everything that lets itself control from a computer. It does the heat controls, yes, but it also controls most of the lights, and can even control the TV (more about this later). I want to know everything to make good decisions where to invest money to increase the energy efficiency and comfort of living. I don't use light switches any more, all lights are turned on/dimmed with IR remotes and a computer, obviously, so I cannot forget to turn the light off (or leave them on if I fall asleep on my couch).

The attached pic shows what I call the head unit, a Pi that controls (this is the new house) the furnace through the 4-relais board. I have solar panels with a controller that connects to the network. This pi also provides a dedicated "IoT" wireless network for such devices, so I can firewall them off the main network - I don't control the firmware, so I don't want third-party controllers on my real network. The picture also shows a SDR dongle with the antenna highlighted in red - this one is for my gas meter. The gas meter (this house has gas heat) broadcasts its reading periodically, and I capture that with the SDR so I know when gas is used when and how much. The solar panel controller provides a pretty lame and slow web page that is practically useless; it has an API that I use to pull the info and make a much better page.

I already mentioned that I do "occupancy detection" with bluetooth - this is for the heat control to know when someone is in the house. When I'm not there, I also turn on a small light in the evening for a while so the house doesn't look so empty and all dark.

And that's also the reason for the TV controls via an IR transmitter that mimics a remote - when I'm away for a longer time, the house turns on the TV now and then, flips some channels, etc. There have been break-ins into houses that look unoccupied b/c the owner is away.

Ok, that's what I'm up to. Of course, all the controls are highly customized for what I have.

- mlp
Attachments
furnace_headunit.jpg
furnace_headunit.jpg (224.63 KiB) Viewed 707 times

Return to “Automation, sensing and robotics”