A fun 70's industrial inspired "launch" control panel with a Yubikey key switch. If the Yubikey is authenticated as valid by Yubico servers and is recognized as enrolled on the device, it pulls a solenoid and allows the user to turn the Yubikey like a real key, engaging the system.
Watch a demo of the prototype in action!
This project was insprired by an idea a friend and I used to joke about back in 2011/2012 timeframe, when he was working at a small startup and they wanted something more fun to push their code to production. They were already using Yubikeys to authenticate against the deploy server as a second factor and we thought why not make it a standalone device. The idea at the time was something more akin to those covered buttons that took a key to flip open the lid, and when you pressed it, it would turn on a police-style spinning light 🚨 while the deply was going on.
Flash forward to the winter of 2019 when this idea was brought up over a beers with friends and I decided I had the skills and components laying around to actually make this happen. It started as a sketch one evening to realize the central mechanism was all about a USB port that only fit a Yubikey, disguised as a lock cylinder. After a few spins in Fusion 360 to work out the lock mechanism, and some detailed sketches of the various bits and bobs I thought were needed, I was able to 3D print a succesful machanism.
From that foundation, I worked through the rest of the placement, and had a friend with a wood shop cut some scrap wood to make the prototype case. The sizing is wrong (I forgot to take into account the breakout board needed, and the Raspberry Pi case) and the metal work is rough (I don't have the right tools for sheet metal work, so I made do) but it was enough to get it together with some solder, hot glue and a bunch of heat shrink tubing. And some extra screws to lift it up enough to fit everything.
Keep an eye on this repo for updates to the software and more details about the internal mechanism, parts used, and some hacks I did to pull it together into a working prototype.
The launch control is composed of a handful of parts, mounted on a sheet metal cover and in a wooden box. Below are the parts I used, however they can be swapped out for your needs and the software tweaked for the specifics of your setup. Additionally, the central component is the Yubikey Lock, which is 3D printed, lightly sanded to make rotation smooth, and parts hot glued, screwed or rubber banded into place. More on that later.
Launch Panel:
- Illuminated toggle switch ‡ modified
- Adafruit 14-segment display and backpack
- Mushroom push button
- Lit power button
- 5V 8A power supply with socket
- Raspberry Pi 3 and case (dealer's choice)
Yubikey Lock:
Misc Other Parts:
‡ The illuminated toggle in the parts list didn't quite work for my needs, due to the LED and the switch being electrically connected internally. In order to isolate them, so that the LED can be controlled independently by the Raspberry Pi at a different voltage level than the GPIO sensing the switch. To do this, you need to pry open the metal sides of the switch, careful to take note of where everything is inside. Clip the resistor lead connected to the bottom pin, notch out part of the plastic case and feed the wire through. Solder on and extension wire, and wrap in heat-shrink to protect it. Bend the metal case closed, put everything back in and snap it shut. It didn't perfectly close for me, so I had to wrap a bit of Kapton tape around it.
Print out all the parts from the STLs folder. There are individual STLs for each part, as well as a combined one that fits in my teeny Monoprice printer. Before assembly, you will likely need to sand down the core to smooth out some of the 3D printing lines. Be sure it slips into the shell and rotates without too much friction. Don't sand it too far, otherwise there can be problems with binding later.
- First, solder wires onto the USB female port, then onto the microswitch.
- Carefully bend the end of the microswitch arm into a slight curve, as shown in the photos and sketch.
- Hot glue the USB port into the core, then hot glue in the microswitch, and add a bit more hot glue to secure the wires of the USB and microswitch into the center, along the axis of rotation.
- At the other end of the wires from the USB socket, solder on the male USB-A and wrap the wires in heat shrink or electrical tape.
- Rubber band the solenoid onto the base plate.
- Use a heat-set tool or a soldering iron to put the heat-set inserts into the shell, insert the core into the shell and use the retainer to lock it in.
- Finally, place the base plate with the solenoid onto the shell and screw it in with M3 screws.
- Due to tolerances in 3D printers and imperfect alignment of the inserts, you'll have to play around with how tight you tighten the screws down to make sure the solenoid and core can still move freely and doesn't bind.
With everything assembled, now is the time to test that the movement is smooth, the USB pass-through works, the solenoid retracts properly, and to tweak the rouded bend on the microswitch to engage right at the end of the key turn. It should contact somewhere after turning 45°, preferrably right before a full 90°.
Using the provided diagram, solder everything onto the Adafruit Perma Protoboard, using sockets for the trinket placement. Write the [SoftPower][soft-power] firmware to the trinket, and socket it into the board. On the right side of the board, use sockets or screw terminals for the Raspberry Pi connector (I used screw terminals, if I were to do it again I would use sockets to make maintenance easier). Solder wires from all the Raspberry Pi terminals/sockets to the appropriate place on the board, according to the provided diagram. Sorry, I don't have better build progress photos for it. Ideally, this would be a dedicated PCB to make it more compact and make wiring a no-brainer.
To finish everything up, just... cut some pieces of wood and sheet metal, a bunch of lengths of wire, cut holes in the metal, screw and bolt the bits in place, solder the wires onto all the bits and shove it all inside. Install the software and power it up.
More on the above later.
-
Get a new API Key from Yubico.
-
Clone this repo onto the launch control Raspberry Pi and run the following:
cd launch_control pip3 install -r requirements.txt cp config.json.example config.json ./bin/install
-
Edit
config.json
with your API key and secret -
Reboot to validate operation. You can view and follow logs with
journalctl -u launch_control.service -f
TBD
I have included a bunch of build and notebook photos taken across the project. These are numbered in order to tell a story, not necessarily chronological order, as can be seen by the dates in the notebook photos. Additionally, here is a short CAD demo of how the Yubi-lock works, taken from within Fusion 360.
- Script to enroll a Yubikey locally and pair it with a given action
- A script in bin to read a Yubikey, extract the identifier and ask for a script to run for that device's launch action
- Create a general display asyncio Task for running the display
- Some function to set display to static string, scroll, or the launch animation and the display Task itself to run an infinite loop looking for changes to the display mode and to tick the display forward.
- Scroll a custom name string for a recognized Yubikey on the display
- Additionally take a display name for an enrolled Yubikey and extend the display loop to show it
- Automatic (or scripted) updates via Git pull and service restart
- Make a cool icon or logo for this project. PRs welcome 😇