Experiments with ATtiny’s and 3D design

3D-printed lucky cat with servo motor, embedded ATttiny, and battery pack

ATtiny’s are small, affordable microcontrollers that are perfect for low-power applications where just a couple input and output pins are needed.

When I started thinking about embedding programmable microcontrollers in 3D designs for Tinkercad, my mind immediately jumped to ATtiny’s for two reasons:

  1. They are just 1cm wide, which means their small size is easier to fit into 3D models
  2. They cost $1 each, making them much more affordable compared to an Arduino Uno (which retails for ~$20).
ATtiny85 chip

Using ATtiny microcontroller in place of more expensive boards can make a big difference in workshops — if you use an inexpensive chip, it’s easy justify allowing participants to take their fully-functioning design home with them, rather than asking them to return their hardware at the end of the day!

In thinking about how to embed ATtiny’s into 3D designs, there were a few core questions I was trying to answer:

  1. How can we reduce the footprint of an ATtiny circuit so it can fit into small 3D designs?
  2. What are compelling interactive designs that use just a few pins on the ATtiny?
  3. What are different battery options that will support retaining a small footprint?
  4. How can the ATtiny be easily reprogrammable so you can quickly iterate on a design?

In this post, I’ll share a few different experiments around tackling these questions as well as models you can use for your own ATtiny prototyping!

Experiment #1: Attempt to eliminate the breadboard

The first attempt in creating a module for the ATtiny was focused around developing the smallest possible way to incorporate the microcontroller into a 3D design. One way to do this is to eliminate the need for a breadboard completely, as the ATtiny is so small on its own.

I began by experimenting with a 3D-printed “socket” for the ATtiny, where you can simply connect each pin of the ATtiny to a standard male header. The header can then be connected directly to an input or an output.

In the example below, you can see how on the underside of the socket, the power, ground, and a single output pin of the ATtiny is connected to a micro-servo using jumper wires, while the power and ground pins of the ATtiny are connected from above to a battery pack.

ATtiny socket connected to a servo motor and battery pack with headers — no breadboard required!

Using this design, I built a small 3D-printed base incorporating the socket and a hole for holding a micro-servo motor.

3D-printed base incorporating socket and holder for microservo

I created a base with the idea that anyone could model their own design to fit on top of it using Tinkercad. I really like lucky cats, so I decided to create a waving lucky cat composed of two pieces: the cat and an arm that press fits onto the servo motor horn so that when the ATtiny chip is programmed, the cat moves its arm back and forth!

Original Design in Tinkercad: https://www.tinkercad.com/things/dfQ9bJ5YgkU-lucky-cat-original-design

Here’s what the design looked like after printing and assembling:

Lucky cat using original base with ATtiny socket

The Results

Building this initial prototype made me realize a few additional factors worth considering:

  1. To program the ATtiny85, I use the Tiny AVR Programmer from Sparkfun. This requires that you remove your ATtiny from your circuit each time you want to reprogram it. With the socket design, reprogramming became challenging because all of the jumper wire connections to the ATtiny had to be disconnected and reconnected each time.
  2. The battery pack wasn’t integrated into the design itself, which makes the design less portable and self-contained.

So after my initial prototype, I decided to create a series of prototypes to compare the experience of using the ATtiny socket to using a standard mini breadboard, as well as multiple options for integrated batteries / power options.

Experiment(s) #2:

Here are three different prototypes that were created:

  1. An extension of the original design that incorporates a 2xAAA battery pack with a built-in switch (right-most in image below).
  2. A design using the ATtiny socket as well as a DC jack for plugging into a wall adapter (middle design).
  3. A clip that holds together a DC jack and a mini breadboard (left design)
From left to right: breadboard with ac adapter plug, socket with ac adapter plug, socket with 2xAAA battery pack
Close up ofassembled circuit with ATtiny socket, servo motor, and battery box.

To test them out, I brought the prototypes to a small brainstorming session with three friends, where they programmed their ATtiny’s and embedded them in one of the three designs.

The Results

Everyone found that for iterative prototyping, the breadboard was the easiest way to go because only the microcontroller needed to be removed. However, they felt that the entire breadboard should be accessible, rather than only a portion as per the clip design.

There wasn’t a strong preference for battery options, but everyone agreed that being able to simply plug your design in to turn it on (and keep it on) was a nice option, without any additional loose wires.

Based on this feedback, I decided to abandon the original idea of using the ATtiny socket, though I think it can still be useful for when you have a final design that no longer needs additional programming. And there have been some fun remixes, including this one from Lindsey Own:

Experiment #3: Breadboard holder with power jack

Taking into account all the suggestions I received, I decided to expose the entire mini breadboard while also using the DC barrel on the underside of the design. Here’s what I came up with!

Using the new holder, we had another mini-prototyping session combining the ATtiny circuit and 3D-printed base with craft materials. Here are two designs that came out of the session:

Fortune teller using a switch and servo motor
Butterfly circling flower using servo motor and hand-made switch (copper tape) — created by Ryan Jenkins

Extending

This is still a work-in-progress, so there are other things that could potentially be done to extend the design, such as,

  • Determine best practices for sharing the ATtiny programmer — it may be inexpensive to have an ATtiny for each student, but the programmer cost $20 each. How can an activity be designed to allow for easy sharing of the programmer while also letting everyone quickly iterate on their design?
  • Considering how an output like a servo motor can be more securely attached to the base, while still supporting a range of projects (in the examples above, we used tape)
  • Design ways for sensors to be built in to a 3D design using the holder.

Try it Out

Here are some links for you to try building your own:

Programming: A fully simulatable model of an ATtiny hooked up to a servo motor and battery pack in Tinkercad Circuits https://www.tinkercad.com/things/cXIEUpZGuOL-attiny-servo-full-sweep

Parts

Thingiverse 3D-printable holder for mini-breadboard and power jack: https://www.thingiverse.com/thing:2970926/files

Tinkercad design (remix to edit): https://www.tinkercad.com/things/352O17TzJ3u-breadboard-power-holder

The breadboard holder on its own: https://www.tinkercad.com/things/352O17TzJ3u-breadboard-power-holder

Thingiverse Lucky Cat Design: https://www.thingiverse.com/thing:2970937

Tinkercad Lucky Cat Design: https://www.tinkercad.com/things/asdmImbaXGJ-lucky-cat-attiny-breadboard-holder

Lucky Cat Design on Tinkercad: https://www.tinkercad.com/things/asdmImbaXGJ-lucky-cat-attiny-breadboard-holder

Acknowledgments

Thanks to Ryan Jenkins, Saskia Leggett, and Rolf Widenfelt for all their feedback!