I'm Brett Slatkin and this is where I write about programming and related topics. You can contact me here or view my projects.

23 February 2014

Feeling like a kid again – The joy of 3D printing

When I was 13 I became obsessed with programming. I was finally good enough at writing code to hack away like a madman. When I found a new programming problem I would work on it all night. I would enter the flow state. I wouldn't notice time passing. I'd dream about it and go right back in the morning. I was inventing problems at the same time I was solving them. Programming made me so happy (and still does today).

For the past 30 days I've had that same feeling, something I haven't experienced since I was 13 years old. I've been creating non-stop, obsessed with my latest experiments. I haven't been able to sleep, staying up until 4am focused on making one more smidgeon of progress. It's been a blast! But my time hasn't been spent programming. It hasn't been the occasional strategy game that has a similar effect (Civilization, Sim City, Starcraft, etc). What's made me feel like a kid again is my 3D printer and the promise of rapid prototyping.

The project

I'd been considering an idea for the past few months: Design a new gear shifter for my bicycle. I wasn't interested in a typical derailleur shifter, but a custom shifter for the Shimano Nexus 8 internally geared hub used by Mission Bicycle*:

This hub is a non-standard part. The geometry is totally different than what's out there. The chain never moves off the chain rings. All of the moving parts are hidden away. It looks awesome and works great (better than my old 12 speed bike). But the standard shifters for it look like this monstrosity:

There are two other compatible, aftermarket shifters out there, but I don't like their look either.

The question was: What would it take to create my own?

Prototyping the shape

On January 18th I set out to make my own shifter a reality. The CAD software I decided to use was 123D Design from Autodesk (it's free!). I did some Alias back in school, so I'm not a total newbie, but look how horrible my first attempt at modeling the shifter was:

After a few days of experimentation with the CAD package I had a better design. What surprised me about CAD modeling is I'd enter the flow state just like I do when programming. I'd have to think hard about how the geometry moves and fits together, just like I simulate how a program will behave in my head, poking data in and out of memory. It made me ridiculously happy.

The screws and springs you see in there are CAD models I downloaded off a supplier's website. I had no idea how sophisticated the supply chain is for this stuff.

Meanwhile, I bought a 3D printer, the MakerBot Replicator 2X. I chose MakerBot because it's well supported. Here's a video of that thing in operation. The sound it makes is futuristic and haunting:

The CAD program exports an STL file (a mesh of triangles). The MakerWare software that came with my printer turns this into an execution plan (akin to Logo) that you can check for errors. The flat bottom parts are called "rafts", easily removable supports that prevent the ABS plastic from curling off the build plate.

Here it is printed into reality:

A few days later I prototyped how the pieces (screws, springs, ball bearings) would fit together, and had an assembly that could move:

What followed was a huge amount of trial and error to make the geometry shift the gears in precisely the right way. I also had to figure out how to make the holes more durable against the crushing impact of the indexed shifting springs. Here's the pack of duds I printed on my way to making it work. Each of these took about 75 minutes to print at 15% fill (meaning they are 85% hollow and chintzy):

But finally, miraculously, I made the shifter work. Here it is shifting the hub for the first time:

Iterating the design

After this things escalated quickly. I brought the prototype to the bike shop. We put it on a bike and found a design flaw: In high gears the knob would bang against the top tube when you turn the handlebars. It's finding problems like this that makes 3D printing amazing. I had been prototyping for weeks and thinking about it all the time, but I still overlooked simple constraints that become obvious once you actually try it out. Fixing those problems was fast and cheap.

I went home that night, spent a few hours rotating the geometry 90° forwards, and then did a 100% fill print to make it strong. The next morning I dropped the new parts off at the bike shop. They built the bike out. By the afternoon, all the pieces were in place: We had a fully built bicycle with the new shifter. The day was February 18th, exactly 30 days after I started the CAD drawings.

I rode the bike home that day and have been riding it a bunch since. I've also improved the design further, shrinking the base and knob to make the whole thing more ergonomic. What's crazy is how fast you can iterate. This design I thought of at 10am, had it in CAD by 10:30, had a print by 12:30, had it on the bike by 1pm. Being able to move this quickly reminds me of the liberating feeling of continuous deployment for building software. Having a 3D printer makes me feel like I can create anything. I'm no longer afraid of the physical constraints of designing real objects.

What's next

Now I'm looking for a machine shop to turn this part into a reality. ABS plastic is fine for a demo, but for durability and precision having it CNC'ed out of aluminum would be best. I want to anodize it in cool colors. I have no idea how much this will cost or how much time it will take. I'll write up that experience in another installment of this story as soon as it's done.

* Disclosure: I'm part owner of Mission Bicycle.
© 2009-2024 Brett Slatkin