The making of: My smart doorknob

  • My doors’ latch mechanism completely broke several months ago, as a result of the “spring” being permanently deformed, and rendered useless.
  • Metalworking is by no means my ::forte::, and given that the lock mechanism is circa 1900, my attempts to fix it were unsuccessful.
  • A doorknob is an item that is purpose built for being rotated many thousands of times, so would likely be durable enough for the project
  • It’s cool. And it feels like an, albeit nerdy, James Bond gadget

How I made it

When I was prototyping (this is a fancy word for “messing around and seeing what works”), I initially thought I’d use a Raspberry Pi Pico to interpret the resistance value, connected to a Raspberry Pi Zero which would actually perform the IoT function. However, this wasn’t feasible for a multitude of reasons, one of which being that I didn’t have a battery pack for the Pi, and would have to run a very long cable from my doorknob. Not very hidden, or cool…

  • Includes a 2xAA battery pack, so could be powered without a plug
  • Includes a Bluetooth radio, capable of sending UART messages
  • Can read analog resistance values
  • The kit it came with included crocodile clips, which are easier (and less permanent) than soldering*
Pardon the dirty table

Micro:Bit Code

I was initially intending to run MicroPython on the Micro:Bit, as… well in honesty, I thought I was too cool to use the simplistic MakeCode interface. However, it so happens that the Micro:Bit doesn’t have a large enough memory chip to load the MicroPython Bluetooth libraries and run my code. So I was stuck with MakeCode, and… it wasn’t all that bad 😆

The complete Micro:Bit code
  1. Checks whether another device (i.e. my RPi) is connected, and hence enables the UART service and sets the “connected” variable to true

Raspberry Pi Code

I was fairly unfamiliar with Bluetooth communication protocols, so I went searching to see if someone had attempted something similar before, and sure enough, they had. I found this excellent Python library designed for interfacing with Bluetooth devices, particularly Micro:Bits

Mechanics

The basic internals of a doorknob
The result of attempting to drill the gears.
  • Glue: Not durable enough, and I didn’t want to permanently modify my potentiometer
  • Drilling a hole through the centre of the rod: This is a lot harder than it sounds, especially without a drill press, or the correct bits. The rod was also very narrow, and I wasn’t confident in the tools or my own abilities to continue this approach.
A wooden popsicle stick next to a joined spindle and potetiometer with a wooden spline

Final Assembly

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Wyatt Sell

Wyatt Sell

I like programming and using technology to make awesome stuff