Miniaturizing projects: the ATTiny85!

A couple of the projects I’m working on will require very small electronics that still need some sort of microcontroller to do something smart, like pulse an LED, respond to a button press, etc…For larger things, I’m using the Arduino series of microcontroller boards, powered by the Atmel AVR MCU (MicroController Unit), but often the final project is to be embedded in something, like a cane, visor, or prop gun, and a full sized Arduino board is too large, even the smaller ones, like the nano, and too expensive ($30+ ) for a complete board…and they are probably overkill for what you need, having far more pins (inputs/outputs) and unnecessary parts (like headers, onboard LEDs, etc.)

I happened across a Make Magazine article called “How-To: Shrinkify your Arduino Projects” that describes using Atmel’s ATtiny AVR chips, which are a much smaller (8 or 16 pin) and much cheaper (I got mine for less than $1 each on ebay) version of the brain of the Arduino, the ATMega328. You have less pins (2 digital, 3 analog on the 8-pin ATTiny8x series) but the darned thing is tiny, the size of my pinkie fingernail! Note that you could do this with the larger and more expensive ATmega chips, but if all you need is a simple microprocessor, the ATtiny is pretty awesome!

The Make Article references a post from “High-Low Tech”, an MIT Research Group. The article┬áhas since been updated to reflect the support in the newest Arduino IDE (1.03 as of this post) and describes how to wire up the ATtiny to the Arduino and program it via the Arduino IDE.

To program the ATtinys, you need an Arduino to serve as the programmer and you either wire up via breadboard the ATTiny or use an Arduino Shield for it. I got a shield from a Turkish Company, Flytron, for $20, that does both the 8 and 16 pin variants. After the Make article, lots of companies are making shields and programmers for the ATtiny platform (Sparkfun and Adafruit being the two most common and popular, but they are also all over ebay.) I do wish the shield I got had a ZIF (Zero Insertion Force) socket, as the pins bend easily taking the chip in and out, but other than that, its a nice little shield!

So, without further ado, here is my first programmed Atmel ATtiny85, running the Arduino LED Fade sketch! Its currently powered from a full Arduino board just for convenience, but sans battery the entire setup is smaller than the 2″x1″ breadboard its running on!



One Response to Miniaturizing projects: the ATTiny85!

  1. I love the ATTiny processors. I’ve used them for a number of projects, and have drawn up plans for a number of transponder units using wireless broadcast. As cheap as they are, there’s no good excuse not to have a couple of IC tubes loaded with them.

    I fabbed my own ICSP programming shield, with a ZIF so I can plug in any of the common through-hole ATTiny or ATMega processors. There’s a generic ICSP header with cable which I can plug into assembled PCBs, or plug it into one of several headers on the shield, each representing the pinout for a specific Atmel processor group (ATTiny 25, 45 and 85 share pinouts but different memory capacity, and 24, 44, and 84 share a different pinout, and there are many other ATTiny processors – yet it doesn’t take many headers to cover a lot of processors).

    Get yourself KiCAD (an Open Source PCB design tool), and you can lay out your PCBs, print transfers on a laser printer and etch at home (google for resources using Muriatic Acid and Hydrogen Peroxide – they’re readily available, effective, and much cheaper/cleaner than Ferric Chloride).

    One of my several ATTiny85 projects is an automatic chicken coop door opener which I call “Cooper”. Barrel plug power connector, motor driver IC, a couple of filter capacitors, a couple of resistors, a transistor (so the ATTiny can switch power on/off for all of the external components, and their current isn’t running through the ATTiny itself), voltage regulator, the ATTiny, and a few header pins (6 in a 2×3 arrangement for ISP, and 6 more in a strip, 2 each for photoresistor, rev counter, and motor power). All of it fits on a home-etched PCB about 3 x 4 cm – and that’s single-sided with through hole components – the SMD design is MUCH smaller.

    Do your design and coding right, and the ATTiny can sleep in between operations, drawing just a few microamps, which is awesome for battery powered projects. I’ve been experimenting with 5.5V UltraCaps, small solar cells, and Joule Thief circuits to provide power for ATTiny circuits. The JouleThief is capable of boosting the voltage from a 2V solar cell (which can be lower than 2V if conditions are poor) high enough to charge the cap and the UltraCap acts like a small battery to power the uC, but can run half a million charge-discharge cycles, which you simply can’t do with a battery.

    Viva La ATTiny!