the raspberry pi is grown up now to be a perfect home automation server today i show you why and how to set it up conveniently in the end you should be able to make an educated decision for your own project crazy youtubers here is the guy with the swiss accent with a new episode and fresh ideas around sensors and microcontrollers remember if you subscribe you will always sit in the first row the raspberry pi started as a simple learning device in version 1 and came a long way to its newest iteration the pi 4. the two things never changed are the form factor and the price all other parameters followed moore's law which predicts a doubling of capabilities every 18 months for silicon chips today i argue that the pi 4 reached the level of an ideal general purpose home automation server as usual you can comment your opinion but please only if you saw all my arguments in today's video we will focus on a home automation server built with the raspberry pi 4.
Go through some of the available software choices for the pi for that purpose all used software is free of charge discuss ways to simplify installation and update show that the separation of programs and data has lots of advantages and how it is done look at which hardware has to be used and how to get it running here it will become apparent why the pi 4 is the way to go we will walk through a setup of such a server beginning with a homemade sensor to a neat display of the measured data but first what are our requirements what do we need i propose the following ingredients which of course you will discuss in the comments or on the discord channel the first and most important interfaces to various sensors and actuators homemade and commercial ones without that home automation is not possible we do not want to have a proprietary cloud solution as proposed by many manufacturers a dashboard to see the status and from there to branch into various departments to see the details a logic engine to connect sensors and actions transparently and flexibly primarily we need a programmable logic to get our many jobs done a graphical interface to show sensor data our server should be reachable from our smartphone alarming functions for two cases either something happened or one sensor does no more work both need our attention maybe a secure remote access and maybe also a private cloud with shared data like photos calendars etc let's start with my first argument for a raspberry based server the availability of software on raspberry os you have the widest choice of open source and free software for home automation and with this fact comes the dilemma you have to decide about what to use we basically can go three different ways focus on a single software package like home assistant openhab or fhem they include interfaces to many sensors as well as dashboards smartphone connections etc etc usually they are not very good at visualizing data or sharing data in a cloud but for core home automation they are an excellent choice maybe you share your experience with one or the other assemble your own su of software by installing one after the other on raspberry os this is of course the most flexible way but you need a lot of linux know-how and keeping it up to date can also become a nightmare use a pre-built raspberry image as provided by me in the past this is the most comfortable way because you just burn an image on your sd card and everything works this can be a good starting point for beginners and also a fast start for your own sue unfortunately such images are obsolete after a few months if not maintained by the creator which is the case for the images on this channel the last way combines the good things mentioned above and avoids most of the bad ones and if it is done right it solves the backup problem elegantly separating program and data enables to backup only the valuable data and if we work with docker containers arranged by knowledgeable people we can rebuild the programs quickly and fast no backup is needed for this part i will use the last method which was introduced in video number 295 and is called iot stack this project started by graham garner was further developed let's check it out but before we have to have a look at the hardware i strongly suggest using a pi 4 for our home automation server why because it is fast enough and even in the smallest 2 gigabyte version it has enough memory for the job and most important it boots from ssd yes i know the pi 3 also boots from ssd but it only has usb 2 which is way too slow for this application ssds are particularly important for home automation because first they are much faster than sd cards and second we collect lots of small data chunks over time if the pi frequency writes data on an sd card it will die after a certain time and you will lose everything in addition sd cards slow down your pi a lot who wants that so an ssd is the right way to go i use these small and cheap 128 gigabyte ssds they are fast and have enough space for the next 10 years of my sensor data if they are reliable you ask i don't know this is why iot stack has a smart built-in backup concept two things are essential to know in respect to the pi 4.
Number one it needs cooling i use passive cooling which is perfect for a home automation server because i do not like nagging fans who die after a short time in video number 288 you get the comparison between different cooling solutions if you are interested you still cannot just connect an ssd instead of an sd card to your actual pi 4 and hope it will boot it will not because the current pies have old firmware in the eeprom this firmware has to be replaced this process became much more comfortable you find the needed information in video number 341 please use the newest write-up if you want to save time i assume that newer pies will be shipped with the appropriate firmware till then you have to do this step before you can boot from ssd for my production server i use a four gigabyte version in a flurk case which is connected by cable to the internet this combination runs now for month without any problems now we can go on with the software as a prerequisite we have to burn a 32-bit raspbian os on our ssd and boot without an sd card next comes the part which makes the difference the iot stack project if you do not know it i suggest watching video number 295 it uses docker which is a brilliant concept for our purpose we get ready-made containers with our favorite software installed and pre-configured that alone is cool but we can do more if you clone the project to your pi using this command and type this command you get a menu that leads you through the process first we have to install docker next we go to build stack here we find all the goodies a lot of choices like in a high class restaurant just without prices and calories how cool is that you select whatever you need and later you can rerun the menu and add extra stuff if you want we find things like portainer to manage all containers or we find mosquito node-red influx db and grafana this is the stack i currently use and which we later will use for our example we find databases interfaces to sensors like zigbee to mqtt tasmota admin espurino hub and blink server and you find openhab if you decide to go this route home assistant in the form of hass.io will be covered later and maybe somebody will also add fhem in the future but you also find cool things like next cloud to build our private cloud server or motion i to attach your ip cameras a vibrating community on discord created this list you find a link in the description if you want to join it we select all our desires and hit ok if you selected node-red you can select a ton of nodes that will be automatically installed maybe you are asked if you want to override the service directories usually the right answer here is do not overwrite in the end this menu creates a docker compose file if you start docker in the iot stack directory it pulls the newest versions of all selected containers from the repository and installs them on your pie if you want to install home assistance you have to go to the menu again and install it in just a few minutes you have your home automation server configured and running the proof is here if you connect to port 9000 of your server you get to the portainer interface here you see all your containers in green and running also home assistance which runs on docker 2.
After login with admin admin we have to do two jobs connect grafana to our light database in influx db and create a dashboard to display the values the first one is easy we select influx db as a source fill out the needed fields and press save and test if all is good we get the green confirmation otherwise you made a mistake somewhere for the second one you are lucky again i also prepared a json file that you can import if your database already contains some values you should see them now nice the sun is shining i was not aware of this fact because i'm sitting in the basement you see a nerd's way of dealing with the real world at least i do not get a sunburn this way the last important part of a home automation server is the backup we do not want to lose all our work and data just because of a technical defect or even worse because of a human error this is why iot stack stores all relevant data in one place on the disk if you backup this data to a different machine or the cloud you should be safe two possibilities exist either save it automatically to dropbox or to google drive now we are done with the best home server on the raspberry pi ever why do i think so the pi 4 is fast enough for such a server already the 2 gigabyte version has ample memory for this purpose usb 3 is fast enough for home automation and also can be used to share data in your family it is for sure not the fastest nas on the market but with nexcloud it has a lot of excellent features it is small and does not consume a lot of energy all software is free of charge and most of it is open source we can build our server by selecting the needed software components iot stack creates our server in minutes because of docker we can separate programs from data this enables a simple data backup as well as a simple update for our programs because we do not need to backup the programs the backup file is tiny we can easily add other programs if we need the price of a raspberry pi with a small ssd and a simple case is in the 80 range one last thing if you want to add an uninterruptible power supply you can join the super power project of the last video where we build such a thing as always you find the relevant links in the description i hope this video was useful or at least interesting for you if true please consider supporting the channel to secure its future existence thank you bye
As an Amazon Associate I earn from qualifying purchases.