Setting up Home Assistant Supervised w/ WiFi on DietPi 64 bit running on Raspberry Pi 4

Start by downloading DietPi. First navigate to the website, navigate to the download section, and select the 64 bit version for Raspberry Pi.

Burn it to your micro SD card with your software of choice (I use Balena etcher on Windows). Once burned, unplug the SD card and re-insert it into your computer so you can edit your config and setup your Wifi. Use the following steps from the DietPi website:

  1. Open the file named dietpi.txt. Find AUTO_SETUP_NET_WIFI_ENABLED and set to value 1.
  2. Open the file dietpi-wifi.txt and set aWIFI_SSID[0] to the name of your WiFi network.
  3. In the same file dietpi-wifi.txt, set aWIFI_KEY[0] to the password of your WiFi network.
  4. Save and close the files

Once completed you can eject your SD, insert it into your pi and boot up! SSH into your Pi (default user: root | password: dietpi) and complete the setup. Go ahead and install Docker using dietpi-software. Now you’ll install a few dependencies:

apt install -y software-properties-common apparmor-utils apt-transport-https ca-certificates curl dbus jq network-manager

For the next step you’ll need to have your Pi plugged into either ethernet or a screen w/ keyboard. Because Home Assistant requires network-manager to function, while DietPi uses ifupdown, you’re about to run into some issues. In order to get Wifi working you’ll want to go and edit: /etc/network/interfaces. Use nano or your editor of choice and remove all of the lines associated with the WiFi configuration. Now you’re going to install Home Assistant:

cd /tmp/
curl -Lo
chmod +x
bash --machine raspberrypi4-64

Running the above commands will get the automated installer started, and you’ll quickly be presented with a prompt to overwrite your network manager settings. NOTE: If you’re on Wifi, and say either Yes or No at this step you will be disconnected!! Select Y, and the installer will proceed to install home assistant. Now, to reconnect to WiFi, the easiest approach will be to run the network-manager GUI via: nmtui. Run the command, select “Activate a connection” and enter in your WiFi details. Now you should be all set, enjoy your new Home Assistant setup!

Hotkeyboard – Part 1

I spend a large proportion of my day at a keyboard, both as a computer nerd (writing code, designing hardware, etc) and as an intern in internal medicine. I’ve come to appreciate a good keyboard when I use one, and I have definitely gotten some keyboard envy when I spy some of the fancier models bounding around the internet.

It seems like a sort of maker rite-of-passage to design and build your own keyboard, so inspired by some of the other builds I’ve seen on places like Hackaday and Thingiverse, I decided it was finally time to tackle my own.

Behold, my first attempt! Using OpenSCAD, I wrote the code to create a customizable hot-key keyboard (ie: not meant to cover the entire alphabet, more for quickly running a commonly used command or macro), which uses the common Cherry-MX switches and all of their click-y goodness. You can enter any arbitrary number of keys per row/column and it’ll spit out an STL to be used on your fav 3d printer. Wiring is easy, and using a Raspberry Pico as the brains makes it simple to start writing the script required to execute your hotkey commands/macros (more on that in another post). Now all I have to do is finish writing the script, and design some nice key-caps to match each key’s function. That and more coming up soon… to be continued!

Designing a 4th Axis for Engraving Rings on the CNC 2418/3018

Bill of Materials:

  • NEMA 17 Stepper Motor
  • 6x M5-16mm screws for securing to CNC build plate
  • 6x M5 nuts
  • 1x M3-35mm screw for driving wedge into mandrel
  • 1x M3-12mm screw for securing mandrel to stepper motor shaft
  • 4x M3-16mm screws for securing stepper motor to mount
  • 2x M3-20mm screw for axles on steady rest

It wasn’t too long ago that I impulse bought myself a mini lathe, inspired by the likes of This Old Tony among other youtube makers. I’ve relied on a scattered hodgepoge of information across the internet in order to get started actually using the thing. Safety came first, but after learning how to spin a chunk of metal at high speed and do so in a way that didn’t make me fear for my life, I turned toward learning how to actually incorporate this awesome new tool into my projects.

I came across the stellar introductory metal lathe tutorials by Blondihacks, and I am incredibly appreciative of Quinn’s ability to present the complex information surrounding proper lathe usage in such a straightforward and thoughtful manner! I would highly recommend checking them out if you’re just getting started with your first metal lathe!

I finally started gaining my footing, and by the time I reached “Metal Lathe Tutorial 16: Your First Project!” I was excited to put my newfound knowledge to good use. While there are many good options for a first project, Blondihacks kept it simple: we would make a ring (in other words, a simple bushing in disguise). I loved the idea, particularly as I had gotten my hands on some beautiful, shiny brass to start turning, I envisioned it would make a lovely ornamental piece.

I took the dimensions of my finger, drew out my schematic and organized my order of operations before setting out: facing, turning, center drilling, drilling, parting, filing, deburring, and finally polishing! Before I knew it, I’d turned a rod of solid brass into a shiny ring which slid perfectly onto my finger.

This was very satisfying, and I liked the look of the finished product, but I wanted to take this simple first project to the next level. I wanted to add some decorative elements, to up the wow factor. I also wanted to make another ring as a gift for my girlfriend, and I wanted to give it a bit more of my personal touch, add more of my craftsmanship and love to the final piece.


With this in mind, I started searching for solutions which would allow me to use my CNC machine to etchy whatever kind of ornate pattern I desired into the surface of the ring. I envisioned a simple fourth axis using a stepper motor to turn some sort of mandrel which would hold the ring in place during carving. I turned to thingiverse, thinking surely someone else had designed one already. Much to my surpise no such design existed! Determined to make it happen, I booted up Freecad and started designing my own.

Dark Grey = Stepper | Light Grey = Stepper Mount | Orange = Mandrel | Blue = Wedge | Yellow = Steady Rest

Above you can see the latest version of the FreeCAD model as of the time I am writing this post (v3, although some work still remains to perfect the design). Both the original design files and the STLs can be found on Thingiverse:


I want to share the steps that I took in order to actually put the above design into action, with the hope that one day it might help someone else looking to do something similar.

I started by finding an SVG of my design. For my first run, I used the staff of asclepius, a symbol of medicine and physicians. I pulled this into FreeCAD using the “Draft” workbench. I then convert to a sketch before switching to the part design workbench to fit it into my body of choice. See the video below for a quick rundown on my methodology.

Once I’ve got my model all setup I head over to the path workbench and create my toolpath. In the current version of freecad the engraver tool does not seem to work for pocketing so I create an endmill tool with a diameter of 0.1mm, which approximates the diameter of the tip of my V-engraver bit. I create a pocket operation with a 0.2mm final depth and 0.1mm stepdown (this is likely very conservative, but better safe than sorry). I use a 1mm/sec feedrate and set my spindle to max RPM.

The final step before starting your operation on the CNC mill is VERY IMPORTANT! With this new rotary 4th axis, you must tell your CNC machine how many steps it takes to move 1mm on the surface of your ring. In my case, I am using GRBL to run my CNC mill; additionally my control board does not have a free stepper port to control the 4th axis so I swapped out the y-axis stepper for the 4th axis stepper. Given I am using the Y-axis I went ahead and changed the value of $101= 38, which tells the control board that there are 38 steps required to travel 1 mm on this axis. (note, always a good idea to write down your default value, so you can reset back to it once your done using the 4th axis). I arrived at the number 38 using some simple math. My stepper drivers are set to 1/8th stepping, thus there are 360 * 8 steps per full revolution. I know that the outer circumference of my ring is equal to pi * diamter (in my case pi * 24 ~= 75). Thus I simply calculate (360 * 8) / (pi * 24) ~= 38.

With that final step, we were off to the races. It was smooth sailing from there, with one exception. It seems that there is some imperfection in the leveling of my setup (something I tried to avoid with the steady rest, with mixed results. Thus the bottom half of my design did not engrave as deeply as the top half. The fix was easy in this case, I simply re-engraved this section of the design after dropping my starting Z by 0.1mm. On my next run I hope to avoid this issue altogether by using my CNC’s Z-probe function to map out the height of the ring surface (it’s conductive so it should be fairly straightforward) prior to engraving. I’ll be sure share the results in my next blog post. Until then, stay happy and healthy, and may you have success in all your DIY endeavors!

COVID-19 Mask Search 2.0

Around two weeks ago, I posted about a bit of software I wrote in Python. The goal of this project was to quickly create spreadsheets of businesses in a given area, such that they could be imported into a shared Google Sheet and used in order to organize volunteers at my medical school in their efforts to call businesses and ask for donations of personal protective equipmment (PPE; namely N95s/masks) for our frontline healthcare workers. Word quickly spread and I was soon flooded with requests from students at other schools around the country to help them with fetching their own PPE data.

I wanted to publish this update both to share the good this little bit of code has helped make happen (see the map above), but more importantly to share the latest version. This new release of the software contains essential updates: not only is it cleaner and easier to understand (I hope), but new functionality has been added in to further automate the fetches of data. Now, instead of generating one CSV file per locale+industry, the software accepts a list of industries/business types and a locale and then searches for each industry in the given locale, ultimately generating an excel spreadsheet with multiple pages: one for each industry with hundres of rows of businesses and their info such as name, phone #, address, and some other added metadata for volunteers to use for organization. After that, all you need to do is upload this excel spreadsheet to Google sheets and convert it to the Google Sheets format (File -> Save as Google Sheet). Share it with a group of volunteers and let the phone calls and PPE donations start building up. This work can really make a difference for those on the frontline desperate for the PPE they need to protect themselves from infection!

Example of a spreadsheet of business data uploaded to Google Sheets.

Yelp Mask Search: Collect Business Contact Info For COVID-19 PPE Donations

See the latest updates to this project in part 2!

With the outbreak of COVID-19 in NYC, our healthcare system has demonstrated that it is poorly equipped to respond to the needs of its clinicians and other frontline healthcare workers. Most obvious is the lack of effective personal protective equipment (PPE; namely N95 respirators and other masks) which our doctors, nurses, respiratory therapists, and others need in order to protect themselves against infection with the virus. It’s glaringly obvious that if you fail to protect your healthcare workers from falling ill, your system is going to fail — and fast too. Nonetheless, we are barely at the outset of the outbreak and our hospitals are already strictly rationing PPE, causing deeply concerning comprimises in patient and provider safety.

Residents from multiple NYC hospitals reach out to our volunteers to acquire proper PPE.

The problem has gotten so bad that residents and medical students have begun scouring the community for businesses (closing down by law) with extra respirators that they are willing to donate. I was brought on to a medical student team that was calling construction businesses, nail salons, dry cleaners, hardware stores, and tattoo parlors. The volunteers had been manually entering businesses into a massive spreadsheet: organizing the info on what business had been or needed to be called, who had donations to give, and more.

Example PPE donation spreadsheet. Business info (veterinarians, construction, painters, dry cleaners, etc) retrieved from online searches manually.

I was asked to write some code to scrape the web for a list of businesses and their contact info. I went to the Yelp API, and got to work. What resulted was a simple python notebook that I am now hoping to share with voluteers at other hospitals or med schools. The code simply takes a Yelp API key, location, and search terms and generates a CSV spreadsheet of the first 1000 businesses to match the search along with their phone numbers, addresses, and Yelp pages.

You can get started using this simple data scraper by opening the Python notebook below for free using Google Colab (look for button at the top of the code). Once open, simply change the settings for your location, search terms, and API key and you can start generating your own lists of businesses to call for donations! Our group has had success with copy/pasting each industry into its own page in a Google spreadsheet. With this system, multiple volunteers can collaborate and work on calling businesses in parallel.

Repairing a Kitchenaid Mixer

I was walking down the streets of Manhattan when my I spotted it. A cobalt-blue KitchenAid stand mixer, sitting abandoned and alone on the sidewalk. I knew that it was not likely to be in working order, but I also know that many people throw away broken technology that can easily be revived with a quick repair job in the right set of hands. I picked it up and carried it over a mile back to my apartment. Let the games begin!

I was not surprised to find that, despite being in otherwise great condition, the mixer was not fully working. Luckily, when I plugged it in and turned it on, I was greeted by the sound of a happy and healthy electric motor, however there was no movement out of the mixer itself. I fetched my tools, and prepared my operating room before diving into the insides of this hefty machine.

Opening the mixer was a bit of a trial, requiring a set of security screwdriver bits, but I was not going to be deterred so easily. For $11 on Amazon, I had the requisite bits shipped to my doorstep in two short days. I pressed onward, opening the contraption’s heavy cast-iron shell to reveal its inner workings. I scraped away the heap of food-safe grease which encased the drive train and the problem because obvious fairly quickly: the worm gear which coupled the motor to the mixer’s output had been completely destroyed.

The white gear seen at center of the image was completely chewed up, no wonder it wasn’t moving.

It turns out that this is a common issue that befalls the owners of KitchenAid mixers. In fact, this failure was an outcome of an intentional design decision by the KitchenAid engineers. In the event that the mixer is overloaded, this gear is destroyed, rather than the other metal gears in the drive train or the motor itself. A replacement can easily be purchased online for a mere $8-10, but I had another idea of how I wanted to fix this thing up.

A quick perusal of the internet revealed that I could easily print out a replacement gear, and so I put my Anycubic Kossel Linear Plus 3D printer to work! In less than a half hour, I had a replacement gear made out of PLA. I wanted the new part to be strong, so I went ahead and heated up my toaster oven to 170 C, turned it off, and then popped the newly printed gear in. As the toaster cooled, it heated the gear to its glass-transition temperature, allowing the molecular structure of the plastic to rearrange, thus reducing any stress that had been present in the structure as a result of the 3D printing process (this process is known as annealing, and has been demonstrated to significantly increase 3D printed part strength!).

Newly printed gear after annealing!

Now came the scary part. I extracted the old gear from its gearbox and used a jeweler’s saw to remove the old plastic gear from its metal core. I then used a blowtorch to heat the metal core to approximately 200 C and carefully pressed the new gear on (using oven mitts to avoid burning my hands). It wasn’t perfect, but afterwards I had a fully functional replacement gear that fit snugly into it’s new home!

New PLA gear fitted onto the metal core, alongside the old gear it was replacing.

I finished reassembling the mixer, and was overjoyed when I turned it on and I saw everything moving as it should. It works perfectly, and so far seems to be more than strong enough to do its job! Next up is trying to build/buy a pasta maker so I can get some more fresh noodles in my life, wish me luck!