I love creating cloud-native applications, this not only translates into my field of work but also my projects at home. Projects in which I can simplify processes and apply my knowledge. This also happened with my most recent project: Coldplay. Where I added music to my elevator. How, and why, I'll tell you in this blog. 

In 2019 I bought a house with an elevator in it. It goes from the ground floor to the attic. It is actually inside my house. Not an apartment on the 5th floor with a central elevator. This one opens up in my living room! In this blog I'll tell you what I did with it. 

Being the tinkerer that I am, I really wanted to do something with this piece of machinery in my house. However, with 2 little kids, a day job, and enough regular things to do in the house I never got around to it. Until…

elevator

(Shoutout to my grafanacon 2018 presentation about this actual washing machine)

Idea inception

In October I was having lunch with my colleague/friend Ruan. We were talking about fun projects around the house and together we came up with the idea of adding music to my elevator. It would be a fun thing to show people when they come to visit. It's also something that could be fun to talk about at a conference at some point in the future.

Then, after visiting KubeCon last year, while waiting for my flight in Detroit, I thought I should pitch this idea to talk about at KubeCon in Amsterdam this year.

Setup

I ordered a TF Luna lidar sensor and mounted it at the top of the elevator shaft. It's connected to a Raspberry PI with a small program in Rust to take measurements and send them out via NATS.

Elevator project 1

With an additional component that writes them out to Prometheus, I can now graph the elevator height:

Elevator project 2

As you can see here, the elevator moves up from about 0cm height to 544cm height and goes back down. And it takes about 54 seconds for this journey, both up and down. If I graph out the speed:

elevator project 3

You see that the speed is pretty consistent 10cm/s. Which is actually really slow, but very useful when moving heavy stuff.

The sensor is not without faults though. As you can see in the graph below, the distance varies quite a bit during the day. This jitter probably is related to the temperature, luckily, the TF Luna also reports a temperature.

elevator project 4

If I graph the height vs the temperature we get this graph. So there is some correlation, as you can clearly see at around 23.00 and 03.30, but the slow rise between 23.00 and 03.30 is clearly not related to a change in the temperature of the Luna itself.

elevator project 5

(note: the quick change in temperature between 29 -> 28 and 28 -> 27 is probably due to the Luna measuring in rounded values, not due to a sudden drop in the ambient temperature of exactly 1 degree).

Muzak

After getting the measurements, it was time to add some music, after some sidesteps (more on that at Kubecon) I decided on a "duolith", the rust component does the measurements and a go component takes all the measurements from NATS, pushes them to Prometheus, serves a real-time user interface and does some calculations in order to decide if it needs to play music or a floor announcement.

My colleague Patriek really wanted me to elaborate on the whole elevator music/muzak thing, but this wikipedia page probably covers it better than I ever could. 

The logic for playing music/announcements is actually pretty easy:

  • check if the elevator just started or stopped moving (otherwise, nothing to do)
    • If it just stopped: 
      • If it is on a floor  (+- 5cm): stop music & play floor announcement
      • if it is between floors: do nothing (continue playing music)
  • If it just started: start playing music

The sounds are loaded into memory when the "monolith" starts and are played instantly whenever they are needed. There is a short delay between the elevator starting and stopping movement because the measurements are sent out at most every 500 ms. 

Alerting

Because I now have metrics, it is time to define some alerts! 

- If the elevator is stuck between floors for more than 1 minute

- If the elevator moves faster than 15cm (safety margin) in either direction

- If the system reports any value below 0cm or above 544cm for any duration

- If the elevator is moving at a speed lower than 9cm/s but more than 2cm/s

I don't really worry about the elevator failing, but the implication of the elevator being stuck between floors is that someone is in the elevator and not able to get it to a point where they can exit. And the last one is mainly interesting for detecting if the machinery within the elevator is slowly degrading in performance.

Kubecon 2023

If you're also interested in hearing about all the failures of this project, of which there are certainly plenty, come see me talk about this project at Kubecon 2023: Using CNCF Projects for Adding Music and Announcements to My Home Elevator

P.s. It's called Project Coldplay because I wanted up*lifting* music ;)

 

Erwin is a DevOps Engineer at Fullstaq. He loves educating people on what it means to build cloud-native applications (and it’s not just using the “cloud”). Using the Cloud Native landscape to make application delivery and lifecycle simple and reliable. At home he is always looking for sidequests; monitoring his power usage to send notifications when his washing machine is done, connecting the garage door to the internet (securely) and adding music to his elevator are just a few examples. His experience makes him a very practical engineer, finding a simple solution is more important than having a modern, shiny solution.
April 17, 2024 | BLOG | 3 MINUTES

KubeCon: K8s as the OS for cloud-native apps and the role of Kubernetes for AI

KubeCon & CloudNativeCon means immersing yourself in the realm of open-source cloud-native technologies. This premier cloud-native conference was held in …

March 28, 2024 | BLOG | 11 MINUTES

Optimizing Azure SQL Database Performance with DTUs: A Comprehensive Guide

With Kubernetes' ability to scale rapidly, application power is greatly improved with a few simple steps. But with many microservices heavily relying on …

January 11, 2024 | BLOG | 14 MINUTES

Why Kubernetes? Focus on the API, not the servers

In this blog I will be talking about how you can unlock the potential of Kubernetes by focussing on it's API, while trying to avoid the complexities you …