January 18, 2017

Since I don’t think I’ve done a proper parts breakdown for the Data Knife yet, I’ll post it here. This model was designed around the following parts:

12BH510-GR Battery Holder for N-Style Batteries

A23 12V Batteries

SPPH410100 Latching Pushbutton Switch

CPE-220 Piezo Buzzer

3mm Blue LEDs x2

Adafruit Arduino Trinket Microcontroller (5v)

Adafruit Neopixel Jewel (RGBW – Cool White)

I’ll go on record as saying that the A23 batteries are not ideal. The Neopixel Jewel can draw a lot of current at its peak, and the A23 batteries are basically just a couple of coin cells in a tube. That said, they’re something I had a bunch of lying around, and they fit in the handle without too much hassle. All I’m saying is, buy 10 of them, not just 1, because by the time you’re done testing everything you’ll have gone through 2 or 3.

The switch is also something I just happen to have kicking around. It’s overkill for this, but it’s a push-button toggle with a satisfying amount of travel, so you could do worse.

The Adafruit Trinket is a great little board, but it has some limitations. First, it only has 8kb of programmatic memory to work with, and ~2.5kb of that is taken up by their bootloader (which is excellent, as bootloaders go, by the way!). I trimmed absolutely as much fat as I could from the code below to get it under the Trinket’s default maximum of 5310 bytes, and I was able to get it under that threshhold, but then I discovered that I could use another, bigger Arduino (such as the Uno) to program the trinket and free up all that extra space that the bootloader was taking up. The secret to this is – those particular instructions tell you how to put the bootloader back on in case you screw it up, but the same method can also be used to push code onto the trinket, using the “Arduino as ISP” programmer in the Arduino IDE. Once I found out I could do that, I relaxed a bit, and added a few extra things like the startChime() feature below, which produced a nice little start-up noise. If you’re desperate to fit this on a stock trinket, you can, but you’ll have to comment out some functionality.

This code uses Adafruit’s NeoPixel library, because it is excellent and does what I am not smart enough to do. If you have not installed this library, make sure you do.