Spaceballs — The Switch! (Zigbee’ing a device)
If you grew up in the same period of time that I did, you’re probably a big fan of Spaceballs. So, when I saw somewhere that a company was making the switch from Spaceballs, I knew I had to have it. But it was just a potentiometer and a flip switch. But I wanted it to be more: I wanted it to control my office setup.
What happened next is that due to some other projects, I got a 3D printer (Creality K1C) and did a few different Zigbee projects (eg. aircleaner-control for a Corsi-Rosenthal box). So it was a natural progression to make the switch into my office light/monitor/whatnot controller.
If you decide to buy this device (or any other device with 100K potentiometer and a flip switch), I’ll be sharing full printable 3D models, code and guidance to make it super easy for you to recreate the switch.
First, let’s see the actual device:
First, I figured out the software part (which was quite easy with ESP-IDF, setting up a potentiometer and high/low GPIO will pull down resistor). So, all you need to do is to model 5 switches in Zigbee.
Then I started modelling a 3D printable case for the switch and thru quite a few 3D prints, I converged on a design. You can see some of my missteps below:
Also the software side looks like this, paired with Home Assistant (I’m using a cheap TI CC2531 USB off Amazon):
Picture of the prototype on my desk:
Of course, a few iterations were needed (and adding bunch of lead weights into the case). But the device itself works well.
If you want to build one yourself, you can use my ESP-IDF code. The device acts a Zigbee router so it should be able to extend your Zigbee network as well.
All you need to do is install ESP-IDF 5.2, compile, flash, print and solder. You’ll also of course need a ESP32-C6 device (any will do most likely).
The code is available here, alongside with the 3MF and STL files for the case. Please note that it’s one of my first 3D models, so it’s not gonna quite perfect, however, you can use it to build your own, especially with regards to the mounting pin layout. There is a hole for a USB-C socket in the rear, and a possibility for a magnet to further keep the device in place.
The code: https://github.com/rosmo/spaceballs-switch
The 3D case is modeled using Shap3r on a iPad (I can’t say enough praise about Shap3r for a new 3D modeler compared to Fusion for example — except that it’s wildly expensive).
The switch itself presents as a 5 switch Zigbee device, where one is the Go-button and 4 other switches (that are kept turned on, you can change the functionality by defining by uncommenting the INDEPENDENT_SWITCHES
here).
Feel free to contact me if you’re having trouble, for example of Twitter or just shoot me an email.
Finally, a photo of the final product:
PS. Since writing this article, I have upgraded with an additional switch and the code has been refined a bit to support that (and updated to latest ESP-IDF Zigbee library. See also my other article on how to control Spotify using the Fortunate Son switch.