Heating Brain is a hobby project and kind of a playground. It means the code may change a lot, and there are several places for improvements.
I've started the project because I was very disappointed about "the industry device" for controlling the floor heating system in my house. It turned out that it is highly inefficient and lacks features that I would like to have. I decided to buy a Raspberry PI Zero, a Relay controller, a few 1-wire sensors and put it together. I created this application to:
- allow checking the temperatures, valves state, and gas stove via UI (i.e., heating-brain.local),
- ensure the controller won't enable gas stove until there is a sufficient heating extraction (i.e., enough floor sections are opened),
- allow introducing a complex "expected temperates time-table" for all sections.
In the future, I would like to improve the system by teaching it when to start the gas stove to achieve the expected temperature on a given hour in a given section (handling the thermal inertia of the floor).
The controller already gave my 20-30% better performance than "the industry device" in terms of gas consumption.
See .tool-versions
file.
./server/deploy
-
Install Raspbian Buster Lite on the memory card. See official documentation for details.
-
Copy
server/config.txt
into the card (asconfig.txt
). -
Configure network connection by creating
wpa_supplicant.conf
file on the card with the following content (adjust the credentials):country=PL ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="[wifi-name]" psk="[wifi-password]" key_mgmt=WPA-PSK }
-
Enable SSH by creating
ssh
file.
-
Allow password-less SSH connections:
ssh-copy-id pi@[ip]
-
sudo sed -i 's/raspberrypi/heating-brain/g' /etc/hostname sudo sed -i 's/raspberrypi/heating-brain/g' /etc/hosts
-
Fix the
cannot change locale (en_US.UTF-8)
issue:sudo sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen sudo locale-gen en_US.UTF-8 sudo update-locale en_US.UTF-8
-
Set the new password:
sudo passwd pi
-
Upgrade distro:
sudo apt-get update sudo apt-get dist-upgrade sudo apt-get autoclean
-
Install Erlang and Elixir.
-
Configure rsyslog (optional):
# /etc/rsyslog.d/01-ignore-rngd.conf if $programname == 'rngd' then /var/log/rngd.log & stop if $programname == 'rng-tools' then /var/log/rngd.log & stop # /etc/rsyslog.d/02-cron.conf if $programname == 'cron' then /var/log/cron.log & stop # /etc/rsyslog.d/99-nas.conf use local address like "rsyslog.local" *.* @192.168.2.10:514 $ActionQueueFileName queue $ActionQueueMaxDiskSpace 1g $ActionQueueSaveOnShutdown on $ActionQueueType LinkedList $ActionResumeRetryCount -1 # /etc/logrotate.d/rsyslog /var/log/rngd.log { rotate 4 weekly missingok notifempty compress delaycompress sharedscripts postrotate /usr/lib/rsyslog/rsyslog-rotate endscript
-
Create application directories:
mkdir -p /srv/backups /opt/heating_brain chown pi:pi /opt/heating_brain/ /srv/backups/
-
Configure backups:
# Add in crontab: 0 * * * * /opt/heating_brain/_build/prod/rel/heating_brain/bin/heating_brain rpc ':ok = Collector.Storage.create_backup()' 15 10 * * * find /srv/backups -type f -mtime +14 -ls -exec rm -f -- {} \;
-
Deploy the code:
./server/deploy
The first deployment will be significantly longer.
- (Mnesia manual)[http://erlang.org/doc/man/mnesia.html]
- (Raspberry Pi Pinout)[https://pinout.xyz/]
- (Installing OS on the memory card)[https://www.raspberrypi.org/documentation/installation/installing-images/README.md]