Experiments with ATtiny’s and 3D design
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:
- They are just 1cm wide, which means their small size is easier to fit into 3D models
- They cost $1 each, making them much more affordable compared to an Arduino Uno (which retails for ~$20).
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:
- How can we reduce the footprint of an ATtiny circuit so it can fit into small 3D designs?
- What are compelling interactive designs that use just a few pins on the ATtiny?
- What are different battery options that will support retaining a small footprint?
- 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.
Using this design, I built a small 3D-printed base incorporating the socket and a hole for holding a micro-servo motor.
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!
Here’s what the design looked like after printing and assembling:
Building this initial prototype made me realize a few additional factors worth considering:
- 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.
- 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.
Here are three different prototypes that were created:
- An extension of the original design that incorporates a 2xAAA battery pack with a built-in switch (right-most in image below).
- A design using the ATtiny socket as well as a DC jack for plugging into a wall adapter (middle design).
- A clip that holds together a DC jack and a mini breadboard (left design)
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.
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:
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
- Mini-breadboard (~$4): https://www.sparkfun.com/search/results?term=mini+breadboard
- DC Barrel Jack (~$3): https://www.sparkfun.com/products/10288
- 5V Power adapter (~$6): https://www.sparkfun.com/products/12889
- ATtiny85 (~$3): https://www.sparkfun.com/products/9378
- Micro-servo (~$3.75): https://www.amazon.com/TowerPro-SG90-Micro-Servo-2pk/dp/B01608II3Q/ref=sr_1_2?s=toys-and-games&ie=UTF8&qid=1529542480&sr=1-2&keywords=tower+pro+micro+servo
- ATtiny Programmer ($20): https://www.sparkfun.com/products/11801
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
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
Thanks to Ryan Jenkins, Saskia Leggett, and Rolf Widenfelt for all their feedback!