Custom Smart Thermostat

Last year I programmed my own custom smart thermostat using Home Assistant and a couple of WiFi enabled heaters. I’m writing this article mostly to document the process of how I control my heaters in the living room and to hopefully inspire others to implement their own solution. I will also try to update the numbers in this blogpost as I make changes to it in the future.

It was important for me that this system would work the entire year round and always provide us with a comfortable indoor temperature whilst simultaneously saving money by (temporarily) turning down the heat whenever the electricity prices are high or when we don’t need a heated living room because we are for example sleeping. Ultimately, this system should run in the background without any of the inhabitants even knowing that it exist.

I got inspired by a blogpost by Martin Bekkelund (article in Norwegian). His basic idea is as follows:

  • Change the heaters set temperature based on a couple of variables such as time of day, electricity price, etc.
  • Allow for a couple of ‘overrides’ such as vacation mode to lower the temperature when nobody is around.

I took this idea and started defining how it should work. Firstly I looked at the operating temperature. In Martin’s blogpost he defines his minimum temperature to be 5°C. This was a bit low for my liking, so I upped that to 18°C. Even if we’re away I don’t want the temperature to sink much below this as it would take a long time to heat the house up again and probably keeping a temperature of 18 degrees would not cost that much more energy than letting the house cool down and heating it up again to 18°C. At the time I programmed this I also wasn’t sure my algorithm would always predict perfectly if people were home or not, meaning that even if the algorithm messed up people in my living room would at least be sitting in 18°C.
For the maximum temperature I decided to go for 22°C. After running this system for a year I experienced that my wife finds 21°C a bit too cold, so we now use 22°C as the maximum.

Secondly, I had to define which variables would influence the set temperature.
After a year I have the following variables contributing:

  • The outdoor temperature.
  • The energy price:
    • General energy price (is today an expensive day?)
    • Peak energy price (Is energy significantly more expensive this hour compared to the rest of the day?)
  • Amount of sunshine entering through the window.
  • Manual override.

My idea was to look at these variables and assign a number to each of them, depending on their value. I would then add all the numbers together, and this would create a temperature offset. This way I quantify as many variables as I want and directly translate them to a desired living room temperature.

Thirdly I defined 3 overrides:

  1. Night Mode. Turns on at 22:00 and turns off at 06:00.
  2. Weekend Away mode. Turns off automatically on Sundays at 15:00.
  3. Vacation Away mode. Does not automatically turn off.

Temperature Offset

The temperature offset will be a calculated number based on the variables defined above. I defined the base temperature in the house as 21°C, and the temperature offset will be added to this temperature to give the final setting for my heaters, within a minimum and maximum of 18°C and 22°C respectively. So for example, if the temperate offset is calculated to be -2, the heaters will be set to 21°C – 2 = 19°C. If the temperature offset is +5, the heaters will be set to 21°C + 5 = 26°C 22°C as the maximum temperature is 22°C.

After a year of running the system my variables are quantified as follow:

Outdoor Temperature Offset
< -10°C +3
> -10°C & < -5°C +2
> -5°C & < 0°C +1
> 0°C & < 5°C 0
> 5°C & < 10°C -1
> 10°C & < 15°C -2
> 15°C -3
General Electricity Price Offset
< 1 NOK/kWh +3
> 1 NOK/kWh & < 2 NOK/kWh +2
> 2 NOK/kWh & < 4 NOK/kWh 0
> 4 NOK/kWh -1
Peak Energy Price Offset
Hourly Price < 130% Daily Average 0
Hourly Price > 130% Daily Average -1
Sunshine through the window Offset
Yes -1
No 0
Manual Offset Offset
Manual offset. Resets daily at 00:00 Between +3 and -3

Remember that a + means more heat, a – means less heat. As mentioned the algorithm goes through all the variables one by one and adds/subtracts the offset value based upon what that variable is at the time the algorithm runs. Whenever one of the variables change the algorithm reruns to recalculate the offset.

Additionally I defined an offset for the override modes. They’ll just get a large minus number to make sure they always default to the minimum temperature of 18°C.

Mode Offset
Night Mode -9
Weekend Away mode -10
Vacation Away mode -10

Night mode has a different offset than Weekend Away mode and Vacation Away mode to in the future allow myself to differentiate between the two, in case I want to expand the system and for example want a different temperature when we’re away vs. when we’re sleeping.

Implementation in Home Assistant

This algorithm runs inside my Home Assistant instance. Home Assistant allows the definition of so-called ‘helpers’. I created a number of these helpers and virtual sensors which help create the main automation that calculates the offset:

Helper Explanation
Heating: Manual Offset Manual input number which can vary between +3 and -3.
Heating: Night Mode A schedule which defines when night mode should be active.
Heating: Offset An input number which holds the current offset.
Heating: Offset Calculator An input number used during the calculation of the offset.
Heating: Outdoor Temperature Combines my 2 outdoor temperature sensors into a single number.
Heating: Sunshine Switch A threshold sensor that turns on when the light sensor in front of my window senses more than 1000 lux.
Vacation Away An input boolean which can be turned on and off manually.
Weekend Away An input boolean which can be turned on and off manually. Automatically turns off on Sundays at 15:00
High Energy Price Binary A binary sensor that turns on when the hourly energy price is >1.3x the daily average energy price

Additionally I am getting the energy price from my energy provider Tibber.

Automations

There are 2 automations running in Home Assistant. The first one calculates the Heating Offset, while the second one sets the heater’s temperature based upon the newly calculated Heating Offset number. This is because the Heating Offset can be calculated multiple times during the day but won’t necessarily change all that much. As long as it doesn’t change, the heaters will be left alone and won’t receive an update.

The first automation to calculate the Heating Offset is in essence a large If/Then/Else function. If any of the overrides are on Then we set the Heating Offset Calculator to the value of whatever mode is active. Else we calculate the Heating Offset Calculator based upon the variables and their respective offset described in the table above.

Actions in Heating: Calculate Offset.

When this action is done I set the Heating Offset variable to the value of Heating Offset Calculator, which was just calculated. Setting Heating Offset to a different value triggers the next automation which sets the living room heaters to their new required temperature. If Heating Offset does not change compared to the last time the automation ran then the second automation is not triggered.

Set Heating Offset from Heating Offset Calculator

Experiences last year

Last winter we experienced some of the highest energy prices in Europe since ever. This mainly drove the Heating Offset during the winter, lowering the temperature of the heaters whenever there was a peak and thereby lowering my energy bill. Unfortunately I do not have numbers on how much money this has saved.

In the summer the Heating Offset is mainly influenced by the Sunshine sensor and the Outdoor Temperature sensor, lowering the heaters to 19°C/20°C during most of the month of August. Additionally we were on holiday in the beginning of August, causing the heaters to be at 18°C all day.

Living Room heater requested temperature vs Outdoor temperature in August 2023. Click to view in full screen.

The last couple of weeks the outdoor temperature has been fluctuating around 0°C. This has caused the heaters to be 21°C (22°C since last week, when I changed the maximum temperature) almost continuously:

Living Room heater requested temperature vs Outdoor temperature in November 2023. Click to view in full screen.

Now when the weather is getting even colder I expect the heaters to be on 21°C/22°C for most of the time, as long as the energy prices are not getting out of hand again.

Improvements

As I mentioned, this system has now been running for over a year. During this year I’ve made a few minor changes, mainly tuning of the Outdoor Temperature offset and the addition of a Manual Override to add/subtract to the Heating Offset. The system has mostly been running in the background and whenever I glanced at the heaters the set temperature often made sense. My house inhabitants have unfortunately complained a couple of times about my system (so they do know it exists), but the root cause was almost always a broken WiFi connection with the heaters, instead of the algorithm making weird calculations. To improve this I have created a 3rd automation which resets the power to the heater, by toggling a power switch connected to the heater’s power cord, whenever Home Assistant notices that it stops reporting its measured temperature, forcing those pesky heaters into submission!

I feel the minimum and maximum temperatures might be a bit restrictive, so I might tune this in the future. As said, I’ll try to update the numbers whenever I make changes. If you have idea’s please let them know below!

NOAA Weather Satellite reception

Sometimes when I’m browsing the web I come across something I just feel I have to try. The other day I was recommended a video of somebody who built a system that can receive NOAA Weather Satellite images. The cool thing about these satellites (NOAA-15, NOAA-18 and NOAA-19) is that they fly overhead roughly twice a day and beam down weather information as they pass by. This includes a visual scan of the earth, participation measurements and a bunch of other values. The data is free to be picked up by anybody who owns an antenna and is able to tune in to the correct frequency (~137MHz).

People naturally have already developed tools to receive and process this information into readily available pictures. One such tool is this project, a software collection that runs on a Raspberry Pi. Since I have a few of them unused laying around I practically only lacked an antenna and a SDR (Software Defined Radio). So I went ahead and ordered a kit that includes both. The antenna is a bit primitive but will surely do to get started.

If tests are successful my plan is to build a proper antenna (a QHF antenna seems pretty good) and place it at our cabin. From there I can auto-upload the pictures to my server and have them displayed on my Magic Mirror once they come in.

Yamaha Diversion XJ600S

I own a Yamaha Diversion XJ600S from 2001. I bought this beauty in February of 2015 back in the Netherlands, right after I got my A2 driver’s license. Since then I’ve ridden over 20.000km with it, and over time I have installed some upgrades to improve safety, appearance and comfort.

Back in 2015, buying my “Div’je”

In 2015, my Diversion had the following:

  • 600 cc, 4-stroke engine.
  • Special air inlet rings to limit the power to 33.5 HP, to allow it to be ridden with an A2 driver’s license.
  • Dual front brakes (opposed to the single front brake Diversions that were made before 1996).
  • GIVI Monokey top and side suitcases.
  • LED front indicator lights.

Digital display

In 2018 I built a custom digital display. This is a 1.3″ OLED display with 128 x 64 pixels. I installed this board inside the speedometer cockpit.

2018-12-19 14.17.03
2018-12-17 15.10.58
2018-10-31 15.29.44
The display fitted inside the speedometer cockpit

The display shows me the following information:

  • GPS based speed (the control board includes a GPS chip).
  • Date and time, which is updated via GPS.
  • Temperature inside the speedometer cockpit.
  • A warning symbol if my battery voltage is below 11.5V.

It also has the possibility to add an SD-card to log the trip and a secondary temperature sensor which can measure the engine temperature. I however never implemented these options in the software, which I’ve also written myself.

In parallel with this change I swapped all the incandescent lightbulbs inside the speedometer unit for LED lights. They light up brighter, increasing the visibility of the analogue meters and indicator lights. Lastly I changed the backlight from an incandescent bulb to a unit which has LED’s and has a smoked screen.

IMG_20200804_161230
IMG_20200804_164159
Old vs. New backlight unit

 

Incompetent transport causing mass upgrade

In April 2021 my Diversion was in need of its usual yearly service. Transporting it to the workshop was done inside a closed trailer, and when the doors of the trailer opened it showed that my Div had fallen over on both sides, breaking both the left & right mirror and the windshield.

IMG_20210421_084417
IMG_20210414_155136
IMG_20210414_155152
The damage after the transport

The shop didn’t feel much for repairing such an old bike, so after a bit of mental revalidation I decided to take this opportunity and order many other parts of the bike that I deemed needed upgrading. So in addition to a good clean and some silicon spray to make it shine nicely, the following parts ended up being replaced/added:

  • The stock mirrors were replaced by PUIG RS1 rear view mirrors. I feel they give the bike a sportier, more modern look.
  • The windshield was replaced by a taller GIVI D116S windshield, offering more protection against wind.
Rider’s view of the new windscreen and mirrors.
  • The top case and side cases, GIVI E460’s, used different keys. I ordered a set which included 3 new identical locks, meaning I now only need 1 key to open all suitcases.
  • Talking about the top case, I added the following items to it:
    • GIVI E81B, a metal rack on top of the top case.
    • GIVI E92 LED brake light, an additional brake light inside the top case.
    • GIVI E79 Backrest, for a little added comfort for any passengers.
IMG_20210429_184412
IMG_20210425_211418
The added components to the top case
  • Lastly, I replaced the headlight unit:
IMG_20210429_184324
IMG_20210511_210015
Old vs. New headlight unit

This headlight unit is actually made by a Norwegian, who developed this kit specifically for the newer Yamaha Diversion XJ600S models. The standard headlight of the Diversion lit the road quite poorly, so this upgrade was much needed. It also changes the appearance of the Diversion quite drastically, shaving off at least 5 years of its visible age.

What’s next

At this point I have recently done the upgrades written above, and I’d like to get some kilometers with them to see what I like and don’t like. I have plans to install engine protectors, which ‘catch’ the bike in case it falls over. At some point in time I also need to upgrade my A2 driver’s license to an A license, which would allow me to unleash the full 61 horses inside the engine (or however many are left after 20 years).

I’m also considering installing handlebar protectors, but my main point of irritation has been the indicator lights on the back. I haven’t been able to find a good replacement of the incandescent bulbs due to the way they are mounted on the GIVI rack, nor have I been able to find clear covers for the lights which would allow the placement of yellow LED bulbs. Those bulbs are right now the last non-LED’s on my Diversion, and replacement of these two is in my opinion way overdue.

Preparing the cabin

A special thanks to Helge in assisting me preparing the water pump, checking the drain and a thanks to both Arve and Helge with hogging the trees!

I recently got the keys of our cabin. Since this time I’ve been preparing it so my parents can come and be there for a few weeks during the winter. There are 1001 things I want to do there, but for the first few jobs we prioritized the ones that were most essential. The most essential was the water. During the winter the waterpipe freezes as it lies on the surface, so the cabin only has a pipe with running water from roughly April to October. If somebody wants to be there during the winter they need to bring and store their own water. The cabin has one (very old) sink and drain pipe, but the previous owner said they never used it. This meant we were unsure on the status of the drain, and if water actually leaves the cabin.

In order to make life at the cabin a bit more comfortable we installed a small pump and a waterpipe inside the cabin which allows you to wash your hands. In addition to that we checked the status of the drain, and made it so that water can safely be drained during the coming winter. We plan for this solution to be here only for a few months until spring allows for building something more integrated, but it is now possible to operate it as-is for at least a few years (just in case). Lastly, we decided to cut down some trees to get more light and a better view.

Installing a pump

Beneath the cabin there used to be a well which in the old days was used for supplying water. A handpump was connected to this well, which allowed you to pump up the water and for example wash your hands or fill up a bowl over a small sink. This system is still mounted on the wall, but the pump is disconnected from the well.

Original situation.

In order to get running water in the cabin we bought a small boat-pump, a hose, a switch and a bucket. The bucket will hold (drinking-)water which is filled up with the use of jerrycans. The pump can be lowered into the bucket and will, once powered on, pump the water through the pipe which is mounted with zip-ties to the old water pipe. This system was installed in a few hours, where the biggest challenge was to find a good location for the on/off switch and running the wires/pipes in a neat way.

Cutting cables and hoses

During installation we found that a small cutting board that was nailed to the wall. It was there to hide a hole in the wall, and turned out to be a perfect holder for our switch.

The old cutting board with the new switch.

A few hours of work, and suddenly we had running water!

The completed setup.

Checking the drain

Checking the drain turned out to be a more difficult job then we initially expected. The drain is a single pipe running from the sink to a concrete box outside filled with sand and small stones. These filter the water, after which it is released into the nature.

We had hoped that the water would run through this entire pipe and into the box. However, when we tried to pour water through the sink no water appeared inside the box. That meant the pipe had a breach somewhere, and we would have to locate it in order to make sure no water was leaking inside the cabin.

Firstly, we attempted to go underneath the cabin to check if we could find the drain pipe. This we did not, but we did find the old (disconnected) well which in the old days was used for the water supply.

Old well in the crawl space.

Outside the cabin we found that the drain pipe was overgrown with a tree. Judging by the size of the tree the pipe must have been there for many decades. It looked like this was at least one of the places the pipe was broken.

Tree which has grown over the drain pipe.

Ultimately we were able to find a spot outside where the pipe was easy to take apart and where water which was thrown into the sink was running out. At this point we dug a hole in the ground and filled it with gravel and stones. This will act as a filter, and allows us to use the sink during the upcoming winter without a risk of the pipe clogging up.

Preparing a hole with stones and gravel to prevent the drain pipe from clogging up during the next winter.

While we were working outside I installed some Christmas lights to make it a bit more cozy.

Christmas lights on the veranda.

Getting that view

The cabin is located at some height, but the view is completely blocked by mainly a big fir tree and many smaller trees. Cutting down trees is a job which can be done in a day and does not need much preparation, so we therefore decided to go to the cabin one day and start cutting down on the trees which were blocking the view.

The view before the trees were cut.

We started by cutting down the tree which had grown over the drain pipe and the large fir tree.

Cutting down the trees went surprisingly fast. Since we had the entire day we continued cutting down on some rotten trees and in general thinning out the amount of trees which were in the way. To assist we had a 4×4 which was very useful in pulling trees down in the right direction and in moving the cut down trees.

4×4 to assist with moving the cut down trees.

When the day was done there was a much better view and much more daylight! The increased amount of daylight is a welcome addition in the short winter days.

The view after the trees were cut down. One can now see the water in the distance, and the cabin receives much more daylight. There is also a decent gap in the tree line left to the house in the background

The cabin is now ready to be inhabited for a couple of weeks in a row. We have many jobs left which we hopefully can start on during the spring, but for now there is (some form of) running water, enough wood to heat the cabin and a decent view with sufficient daylight to not get depressed.

Cheers, Jesper

OpenVPN on a Raspberry Pi

My parents and I, who come from the Netherlands, have recently bought a cabin in Norway. We have a lot of wishes and ideas for this cabin, but one of the first projects I started on right after we signed the contract was the setup of a VPN server on a Raspberry Pi. The goal is to have any device connecting to the WiFi in the cabin appearing to be in the Netherlands, so that my parents can ‘work from home’ from the cabin and can stream Dutch TV and Dutch Netflix. For this to work, we need a router that can act as a VPN Client and a VPN Server to connect to.

By having the router connecting to the VPN Server, any device that connects to the router will also be connected via the same tunnel to the internet. By installing the VPN server on a Raspberry Pi, I can just ship a readily installed unit to the Netherlands with minimal setup steps for my parents while they remain 100% in control of their VPN endpoint. This is important to ensure that for example Netflix will not block their stream, as any data appears to come from their own home instead of a (known) VPN provider.

For this project we use the following components:

I recently bought an Asus RT-AC66U B1 router, which I know can act as a VPN Client. The Asus 4G-AC68U is a model from the same product line, which also includes a 4G simcard slot.

Software-wise, we only need only a handful of services/programs:

  • The latest Raspbian Lite
  • PiVPN
  • A Dynamic DNS provider, I’m using Google Domains
  • ddclient

Setup

The first step is obviously to flash Raspbian on an SD-card and shuf it into the Raspberry. I’m using Raspbian Lite since we know exactly which software packages we are going to use, and any dependencies will be installed with them. This will keep the overall system performance as high as possible.

After setting up Raspbian, we use SSH to log in as root and install PiVPN. PiVPN will install either OpenVPN or WireGuard, in our case OpenVPN as this is also supported in the Asus router. I have set up the IP configuration to be dynamic, so it can adapt to the setup in my parent’s house once it arrives in the post. Other than that I’ve used the standard settings, obviously choosing the right DNS Provider (Google Domains). I had also set up a Dynamic DNS entry in Google Domains prior to the Raspberry Pi installation, which will be used for this VPN setup.

Dynamic IP lookup

Since I don’t know the public IP address of my parents house (and they might have a dynamic IP address that changes every once in a while), one can use Dynamic DNS. Basically, Dynamic DNS checks the current public IP address of the host and sends this to a pre-configured DNS provider. The provider matches the IP address, for example 185.176.244.205, to a subdomain name, for example cloud.jessendelft.org. This way, anytime a device tries to find cloud.jessendelft.org they only have to ask the DNS provider, which will then provide them with the correct public IP address. To achieve this on the Raspberry Pi we can use ddclient. ddclient only needs to know a few basic parameters such as the login credentials of the DNS provider and does the rest by itself. It runs as a deamon in the background, automatically checking and updating the current public IP address in the DNS register.

I generated two OpenVPN configuration files which can be uploaded to VPN Clients and allows them to connect to the server, one for the Asus router and one for my private PC so I can test & debug the entire setup. These configuration files include instructions to use one of my subdomains to find the current public IP address of the OpenVPN Server in the Netherlands. This keeps the setup easy and flexible.

Lastly, I entered the Wi-Fi credentials of my parents house in a file called ‘wpa-supplicant.conf’ and placed this in the /boot/ folder of the Raspberry Pi, so they can use it both in wired and wireless mode. After running a few tests it was then ready to send it in the post, and hope that all works! I also included a guide for my father to set up the required port forwarding in his router in the Netherlands, so the VPN Server can be found from the internet.

Testing the setup

When the Raspberry Pi had arrived in the Netherlands it was time to put it to the test. We forwarded the required port in the router, gave it a static local IP address and attempted to connect from Norway.

Connecting was successful!
However, the test-pc did not have internet access.

The VPN Server in its natural habitat.

Some debugging later revealed that the ethernet port did not have the default eth0 name, but something more tropical. Changing the name of the ethernet port in the configuration (iptables) fixed the problem and allowed internet access through the VPN tunnel. Hooray!

Lastly we installed Log2Ram, which limits the logging done to the SD-card to extend the lifetime of the system. SD-cards can get corrupted when written too often to, so in order to limit the amount of write cycles Log2Ram will save all logs in RAM memory and only once a day write the entire logfiles to the SD-card.

A reboot to make sure everything works and it was finally time to check the speed of the connection!

Speedtest over 4G

Honestly, this is 10x as high as expected when we started on this project so we’re certainly very happy about this! This will allow my parents to comfortably travel to their cabin and use the internet, while they appear to be in the Netherlands.

Playing with Grafana & InfluxDB

In my search for a way to display the data being collected by Homey I often have seen Grafana as an option. Grafana is a tool to visualize data in graphs, gauges, tables, etc. It reads data from a database, is very responsive and easy to work with. As a bonus, FreeNAS offers a community plug-in which has both Grafana and InfluxDB installed and ready to go, so I could easily set up a jail to try it out.

Homey by itself does not log any data. To have it upload its variables to the InfluxDB database I just had to install the InfluxDB App, fill in the IP address of the Grafana jail & credentials of the database, et voila! From the Grafana interface I started seeing the potential Query fields being populated with all the data that Homey had to offer. Not much time after that, I had my first Dashboard populated with energy measurements, real-time power consumption and temperature data from different rooms in the house. With a little more playing around this Dasboard was shown as an iframe on my Magic Mirror.

Grafana dashboard shown as an iframe on the Magic Mirror

After doing this I realized that FreeNAS is also a great source of data (CPU usage, network & HDD speeds, RAM usage etc.) and a place where I’d like to get some more overview of what’s happening. Naturally, a quick Google-search yielded tons of people who had done this before, and I followed this guide to get FreeNAS to upload its data to a separate InfluxDB database and create a Dashboard in Grafana. I then used this dashboard as an inspiration to create a similar one for Homey and by the end of the day I had 3 different dashboards which give me a neat insight in how well my core-components from my smart home are working.

An additional line in the reverse proxy configuration and the Grafana jail was accessible through the internet. Curious on how it looks? You can find it here: cloud.jessendelft.org/grafana/.
Username: viewer
Password: viewer123

I am not sure yet if I want to keep using this system, as I ultimately want some form of 2D/3D interactive map of my house to show this information. As an interim solution though, this is quite nice and I was surprised by how easy it was to include this in my system. I like the fact that all the ground-work is up and running (FreeNAS, Reverse Proxy, Homey, etc.), and that it apparently is working so well that it is easy to build layers of complexity upon them with for example the Grafana dashboards. If you have comments/ideas on what I can do with my data, or how I can improve my system even more, please let me know in the comments!

Cheers!
Jesper

Steampunk Taptower build

I can’t believe this project took me almost a year to complete! In August 2019 I was browsing around Thingiverse for some cool idea’s to 3D print, when I found a Steampunk Tap Handle made by Fuzzie/The Beergineer:

I knew I wanted this as well, so I 3D printed the parts, spray-painted them and assembled them together with some scrap tubing and 8mm screwing rods. I also had some leftover APA102 LED strip from the Ambilight system laying around which could be used to light up the tap handle, and I ordered a couple of Arduino Nano’s to control this LED strip.

The assembled beer tab, with multi-colored LED’s on the inside.

The prototype was up and running rather quickly. I put the Arduino on a breadboard, connected the light strip to it and uploaded the code from The Beergineer. Before it worked though I made some changes to the code, which can be found on Bitbucket (including the changelog). Most notably I introduced interrupt-based reading of the push button opposed to polling it. This push button is used to change the light pattern shown inside the tab handle. I also programmed it so that every time the button is pressed, the new state is written to EEPROM so the same light pattern is shown after a power outage. Lastly I changed the main loop from an if-else loop (which had 4 if-statements) to a switch, to prevent unnecessary calculations.

Arduino Nano on a breadboard. Note the beautiful ‘push button’, aka red wire with capacitor.

And it was at this moment where this project ended up in a moving box, and didn’t find it’s way out until June 2020…

Installation

Almost 10 months after I started this project I dug up the beer tap as we would be going to our cabin during the holiday, which is where I planned on installing this. Before installation the Arduino was put inside a plastic box and covered in hot glue, to give it some resistance against rain. I soldered the wires to the headers, installed a push button on the outside of the case and put a Molex connector on the wires to make installation easy. Additionally I added a switch connected to the Arduino, which can turn the LED’s inside the handle on and off.

IMG_20200630_154312
IMG_20200701_131908
On the top: planning the box-layout.
On the bottom: components are in place.

 

At our cabin we have a refrigerator with a beer tab on top. Installation was a matter of unscrewing the old tab and screwing on the new tab.

IMG_20200704_151937
IMG_20200704_153851
IMG_20200705_195329
Installation of the Steampunk Beer Tab.

 

During the night, the LED’s inside the Tab Handle create a very cool looking scene:

IMG_20200725_223256
IMG_20200725_223221
IMG_20200725_223210
The Beer Tab at night, showing different light patterns.

 

I think this was a fun little project to do. Unfortunately I wasn’t able to properly hide the cables as the metal in the tab tower was too strong to drill through with the tools we had available at the cabin. Therefore, they run on top to the black box which holds the Arduino. Other than that, I am very happy with the result.

Cheers! And don’t forget, keep Beergineering!

Jesper

Roborock S5 Max

Please meet Dustin! For my girlfriends birthday I bought a Xiaomi Roborock S5 Max, after having talked about it for many months. I dislike vacuuming and do this at most once a week. My girlfriend on the other hand would like me to vacuum every day, so we both agreed this could be a very good solution for the both of us! The Roborock S5 Max is able to do both vacuum cleaning and mopping, and I haven’t been able to find any negative review of them, hence why I choose this model.

The Roborock S5 Max has the possibility to change the name. So after a short brainstorm session with the family ranging from Bob, JARVIS (which is already the name of the house) and Dusty we landed on Dustin.

First impressions

My first impressions with this product are very positive! Dustin has a LiDAR sensor peeking out from the roof, which it uses for navigation and mapping. The mapping feature is very impressive, as it creates a 2D map of my house while it is vacuuming. Simultaneously it logs on the map where it is and where it has been. In addition to the LiDAR it has a big bumper with a pressure sensor on the front to stop it running into low items, and sensors on the bottom preventing it from falling down the stairs.

Screenshot_20200628-102150
Screenshot_20200628-120551
  • Running Dustin for the first time. On the top, mapping the house for the first time. On the bottom, mapping and cleaning were done.

After the house was mapped you can manually divide it into different rooms. This allows you to clean specific rooms, or set different vacuum/mopping settings depending on which room it is in. The map also allows for setting ‘no go zones’ and ‘virtual walls’, which make it not go into a specified area.

The LiDAR is slightly offset from the middle. This means it can do a 360 on the spot to very accurately see depth, which means you can manually set it anywhere in your house and it is able to locate itself and automatically drive back to the dock. I have tried this a couple of times, and in ~80% of the instances it successfully managed to locate itself in the house and return to the dock.

Screenshot_20200628-173154
  • Mapping complete, and the house is divided into rooms. Also a no-go zone (the red square) and no-mopping zones (the purple squares) have been set up.

Using the map you can also drop a pin to where you want it to go to. After it reached this location, you can tell it to do a ‘Spot Cleaning’, which cleans an area of 1,5m² around that spot. Very handy!

Are there any shortcomings?

I have found a few so far. When the LiDAR sees a mirror, it is convinced the room is 2x bigger than it actually is due to the reflection. This causes it to misjudge where walls are, and it get’s confused as it tries to reach these spaces. In my case, when cleaning the hallway it finds that there must be a room connected to the hallway that extends into the wardrobe, and that it actually extends all the way into the living room. It then tries to drive around to the other side to access this room, only to see that there actually is a wall there. It tries this three times in a row before it gives up cleaning this area (but hey, it shows commitment!).

Screenshot_20200703-141416
Screenshot_20200703-141841
  • On the left, the map is shown as when Dustin is placed in front of the mirror. The closet is painted red in Photoshop, and it can be seen that the walls on the back of the closet have disappeared. On the right, you can see that Dustin tried to drive back and forth a couple of times, and that when it is on the back side of the closet the walls are drawn as they are.

Another shortcoming is that it sometimes gets stuck on the doorway steps, especially when it tries to drive parallel over the doorway steps. There might be a solution by creating a separate room over these doorsteps as suggested on Reddit, but I haven’t been able to test this properly yet.

Lastly, I haven’t been able to find a way to integrate this unit into my Athom Homey. To centralize all my automation’s I’d like to have it integrated into Homey, but unfortunately the Xiaomi Mi Home library is not updated which means it cannot talk to this Roborock model. For now I integrated it directly into Google Home (an integration that would normally have been done through Homey), which at least enables voice steering.

Conclusion

So far, Dustin has been vacuuming our house multiple times in the last week. The rest of the family seems to be happy with him as they are using him extensively and without my help. I have good faith in that I’m able to fix the doorway problem, and if all else fails I can always make them lower so that Dustin is able to clear them better. All in all, I am very happy we finally have one running around :).

If you have any tips/updates on the Homey integration or the other issues I’m seeing, feel free to drop me a comment below!

Awning Motor #2 – Installation & Configuration

Installing the Dooya awning motor was a bit cumbersome, due to the sheer size of the awning. Our awning is 7 meters long, which means that it requires at least 3 persons to lift the unit off and on the roof. In total we needed 2 installation attempts. During the first attempt we managed to remove the old, manual crank system and slide the motor into the awning. After we slid in the motor we found that the manual crank system was wider than the new motor, which meant the motor could not be slid in completely whilst also being attached to the side plate supporting the awning:

IMG_20200616_112025
IMG_20200606_170328

Old crank vs. new motor. The lower picture shows that the motor is not fully slid into the awning.

To allow the motor to be slid in completely there were basically 2 options:

  1. Shorten the support beam holding the awning to the roof.
  2. Use bolts to offset the motor from the side plate.

Shortening the support beam would be the most elegant solution, although this means that reverting to the manual crank at a later time will not be possible. The quality of the motor is not known, and failure is always an option. Therefore we chose to get some 50mm M6 bolts and a whole bunch of washers to offset the motor from the side plate. Simultaneously, the motor was rotated 180 degrees so that the power cable and antenna would exit on the top instead of the bottom, allowing for neater cable management.

The motor with the 50mm offset. Now the motor is fully slid into the awning.

After pairing the remote control to the motor and adjusting the outer limits, it was very satisfying to find out that it working well. It looks like the motor has enough torque to comfortably pull the awning back up, which hopefully means it won’t break in the near future.

Homey and Google Home integration

The remote control uses Z-Wave to steer the up & down movement of the motor. Homey is able to steer Z-Wave devices, and according to the Homey forums the Brel Motors app should be able to be paired to and control the Dooya DM45RM motor that is installed here.

Screenshot_20200616-121136
Screenshot_20200616-121217

On the left: Pairing the Dooya motor
On the right: The control interface in Homey.

Pairing was very simple. The app asks to push one of the buttons on the remote control that is already paired to the motor. From that signal it can determine the unique communication key to the motor (which ensures that a neighbor won’t accidentally control my motor), as well as the correct up, down & stop signal. A concern I had was that Homey was too far away to reliably control the motor, as it is positioned 3 rooms away from the motor, but the Z-Wave signal seems to have no problem reaching the motor.

My Homey was already integrated into Google Home. After a quick refresh, the Sunshade appeared in the Google Home app. Sweet!

And finally, it was time for a test:

You may notice that I say ‘close the sunshade’ instead of ‘lower the sunshade’. This is because Google recognizes the awning as blinds, which means they can only be ‘closed’ and ‘opened’. Fortunately this is not a problem whatsoever as it is easy to remember, and in the worst case Google doesn’t understand our command and we need to say it twice.

Some more Homey configuration

With Homey being able to control the awning, I could program a couple of ‘flows’. Flows can be compared with IFTTT applets that are managed and run inside Homey.

Screenshot_20200616-122944~2
Screenshot_20200616-123017

To the left: 4 flows to automatically steer the awning.
To the right: detailed view of the flow that lowers the awning.

I set up 4 flows for now:

  1. The first flow automatically lowers the awning at 11:00 if the weather is good.
  2. The second flow retracts the awning at sunset.
  3. The third flow retracts the awning when the weather applet shows it’s raining.
  4. The fourth flow retracts the awning when the weather applet shows the wind speed is over 39 km/h, which equals to Beaufort 6 or higher.

The flows that retract the awning will always run once they are triggered, regardless if the first flow has been triggered or not. This is because we are able to lower the awning manually with the remote control, and this motor only allows for a one-way communication. Therefore Homey has no way of knowing the current state of the awning. If the awning is already retracted, the motor is blocked by the end-switch and nothing will happen. To avoid spamming the motor with retract-signals a timer set to 1 hour is activated, which blocks new retract signals.

With this project done the balcony refurbishment is (for now) complete. We can now comfortably sit outside, enjoy the view and get ourselves some shadow whenever we want it with very little effort. The last couple of days have been quite sunny as well, so we have been able to enjoy our new setup quite a lot.

Renovating the balcony

It’s Corona-time! Therefore (almost) everybody has a lot of time at home, including me. In order to make the most out of the situation my girlfriend and I decided it was a good idea to invest some time and money into our balcony as we can see this directly from the living room. During the day this is also the part of the house that gets the most sun as it is located at the south side of the apartment. Renovating this part of the house will therefore allow us to enjoy the outdoor weather during the spring/summer and simultaneously improve the view we have from inside the house.

The first step in renovating the balcony was to make a list of things that needed to be done.

IMG_20200503_103223
IMG_20200503_154832
IMG_20200503_154844

The situation before the renovation

  • The floor was rotten, so that needed to be removed. Underneath the wooden floor were stone tiles, which we decided to leave in place as they made a relatively flat surface, were pretty heavy, and we wouldn’t know if the concrete below would require a lot of maintenance (what you don’t know can’t hurt you).
  • All the grass in the planter needed to be removed to make room for new plants that look better.
  • The walls and planter could do with a paintjob.
  • To make the balcony safe(r) a wooden fence was placed onto the planter. To allow for painting, the fence has to be disassembled, and can then painted as well.
  • There are plans to do a large overhaul on the balconies and planters in this neighborhood in 1-2 years. One option we considered was to build a terrace similar to the one build on the veranda at the other side of the apartment, however this would have to be destroyed if they start the large overhaul. We therefore decided for IKEA RUNNEN decking, which both looked good and is easy to remove again when necessary.
  • Lastly we wanted some nice lounge seats so we could sit outside in the sun.

Preparing the balcony

I started with removing the wooden fences. This was easy as they were hanging on the planter with the help of hooks, and they were only fastened by screws in the bottom. After removing the fence it was time for the grass and the floor. First the grass was gathered in waste bags, after which I cut up the floor in pieces of 90cm (so they would fit perpendicular in the trunk of my car).

IMG_20200503_154844
IMG_20200507_141857

Before and after the floor and grass removal

I then could drive all the old flooring to the local landfill. With everything removed it was the perfect time to paint the walls. Both the red and the white had to be done, so on a nice (semi) sunny day I set to work.

The result after painting red and white.

To determine the color of the fence I made a 3D model of the balcony in Google Sketchup. In our area there are 3 common colors: red, white and brown/black. The 3D model allowed us to quickly change the color to see what looked best:

Balcony_brown
Balcony_red
Balcony_white

In the end, we decided white would look the best. Brown/black made it look like a barcode, while red would not really fit onto the white planter and the trees in the background. We therefore choose to paint the fence white.

The rebuild

It was then time to lay the new floor. The RUNNEN floortiles are very easily clicked into place, and give a very nice result for such a short time. I again made a timelapse of the process, which can be found below:

At this point, we bought some plants and planted those in the planter. After replacing the fence and securing it into place the balcony was almost done.

IMG_20200514_172147

Lounge set

The last thing that was missing was a nice place to sit and enjoy our newly refurbished balcony. After some consideration we again reverted to IKEA, this time to buy an ÄPPLARÖ 4-seat lounge set.

I’m really looking forward to drink a cup of coffee there during the morning, and to enjoy a beer during the evening. The entire family is happy with how it turned out, and hopefully we’ll get a lot of sunny days this year to enjoy the outdoors!