Close
0%
0%

Tiny Blinky

A 1" round wearable with 8 LEDs

Similar projects worth following
This was a project I created for Bay Area Maker Faire 2015 to demonstrate home SMD pick-n-place and reflow.

It's an ATTinyx4 with a CR1220 battery holder, 8 LEDs and a button. It's all arranged on a 1" round PCB. The firmware has a bunch of blink patterns selectable by pushing the button. If you hold the button down for a quarter second or longer, it will turn the blinky off. When it's off, the draw from the battery is negligible (the shelf life of the battery is the limiting factor). With the blinky turned on, you can expect around an evening's use out of one battery.

It's all really quite simple.

The ATTiny has 11 GPIO pins (it's a 14 pin package with power, ground and a RESET pin that can't be used for GPIO if you want to easily reprogram it). 3 of the GPIO pins are shared with the programming interface. The LEDs will be placed on the other 8 pins to insure that the act of programming doesn't apply any voltage to the LEDs. The button will be connected to one of the programming pins, because as long as it's not pressed, it won't interfere.

The reason we want to insure that programming doesn't connect up to the LEDs is that the LEDs represent a low impedance load, which may be too much for the programmer. More critically, there are no series resistors on the LEDs. This would ordinarily be a bad idea, but in this case, the firmware ordinarily insures that the LEDs are not turned on long enough to be damaged, and the amount of current the battery can put out isn't enough to damage the LEDs.

In laying out the board, you need to figure out how to arrange the battery clip, the programming interface, the button, the 8 LEDs and the ATTiny. I chose to put the battery clip and programming interface on the back, and the rest on the front. The programming interface is designed to work with a Pogo pin programming adapter. You should use a 3.3 volt AVR programmer, but if you must use a 5V one, then you should remove the battery first and not leave the programmer connected to the board too long, lest the LEDs be damaged.

The original version of the board had a space for a series resistor for each LED, but it became clear that 0Ω was the correct value, so the latest board omits it. The original board also had a smaller SMD pushbutton, but it wasn't very user-friendly. The new board has a footprint for a button that has a much better tactile feel.

One of the big limitations of this project is the amount of current that can be supplied by a CR1220 battery. You simply can't turn more than one LED on at a time without reducing the voltage from the battery so much that the processor browns out. This means that the code has to play persistence-of-vision games with the LEDs when it wants to make it appear that more than one of them are on.

To facilitate this, a timer is used to keep a millisecond counter. This counter is the "heartbeat" of the code. The LED patterns can change with a maximum frequency of once per ms. Making the timer interrupt at 1 kHz is tricky. The system is clocked from the internal 8 MHz oscillator, but to save power, it is pre-scaled down to 500 kHz. The timer is set up with a divide by 64 pre-scaler, meaning that to get it to interrupt at 1 kHz, it needs to count to 7 13/16. In other words, it counts to 8 13 times, then to 7 3 times. The result is 1 kHz. The timer compare interrupt not only increments the millisecond counter, but it also adjusts the compare value based on the interrupt count.

The only other tricky aspect of the firmware is that you have to bend over backwards a bit to insure that all of the data is kept in PROGMEM, and access it properly. The result is that with 5 different patterns from which to choose, the whole thing takes 2270 bytes of flash and 21 bytes of BSS (static variables that start zeroed out). I use ATTiny84s, though with this firmware, ATTiny44s could be used instead.

When you hold the button down, the tiny is put into its power-down sleep state. The pin-change interrupt on the button pin is used to wake it up. In this state, the controller uses around 100 nA of current. That's so little that the shelf life of the battery will kill it first. While it's operating, the controller draws around 200 µA of current, not counting any LEDs that may be lit. The LEDs will draw as much current from the battery as it will supply until the voltage sags. The ATTiny, fortunately, has a reasonably low drop-out voltage which allows it to keep running through it all.

blinky.sch

EAGLE schematic

sch - 161.50 kB - 11/29/2017 at 17:51

Download

blinky.brd

EAGLE board file

brd - 45.70 kB - 11/29/2017 at 17:51

Download

  • 1 × ATTINY84-20SUR
  • 8 × 0805 LEDs
  • 1 × CR1220 SMD battery clip
  • 1 × SMD pushbutton
  • 1 × 10kΩ 0805 1/8W resistor

View all 6 components

  • Coming soon... POV blinky

    Nick Sayer12/04/2015 at 18:50 0 comments

    I was inspired by the Persistence Of Vision badge hacks at the Hackaday super-conference. So I made a board that re-arrranges the Tiny Blinky circuit as a sort of "propellor" of sorts. You screw the board to a dowel and twirl it between your palms and the LEDs will make POV patterns in the air.

View project log

Enjoy this project?

Share

Discussions

Alexis wrote 11/23/2016 at 22:12 point

Hi! Very nice project. I was wondering if it would be possible to program the attiny using arduino. Do you have the .ino code? 




It would be possible to use the attiny24 instead of the arduino 84?




Many thanks.

  Are you sure? yes | no

alpha_ninja wrote 12/07/2015 at 00:56 point

Looks like you're missing gerber files. Could you upload them here?

  Are you sure? yes | no

alpha_ninja wrote 12/02/2015 at 00:45 point
This is your one-week reminder to upload design documents: https://hackaday.io/project/7813-the-square-inch-project/log/28566-design-deadline

  Are you sure? yes | no

zakqwy wrote 11/09/2015 at 15:39 point

Have you considered using some kind of regulator to pull more juice out of the battery? Maybe a tiny boost circuit?

  Are you sure? yes | no

Nick Sayer wrote 11/09/2015 at 16:29 point

I've done boost circuits before - most notably for the crazy clock - but when I've wanted either to run at a constant operating voltage or the battery was lower than the operating threshold voltage. Neither of those is the case here - you can get ATTiny84s capable of operating at 1.8 volts - well below the forward voltage of the LEDs.

Also, there's no room on the top of the board for a boost circuit, and I don't have the means (or inclination) to do double-sided reflow (the battery clip is ostensibly an SMD component, but I hand-solder them).

Lastly, keep in mind that boost isn't a free lunch. You get voltage, but it costs you current. A CR1220 is just able to supply enough current to light up a single LED without dropping the voltage enough to scramble the controller. I'm not sure one alone would be enough to keep the boost circuit stable.

  Are you sure? yes | no

zakqwy wrote 11/09/2015 at 17:24 point

That all makes sense. I figured the boost circuit could help prevent voltage sags that dip below LED forward operating voltage. 

I'm thinking about using a 3.3VDC boost converter with a CR2032 for my #The Square Inch Project entry; I found this chip that seems to fit the bill:

http://www.skyworksinc.com/uploads/documents/AAT1217_202050B.pdf

If I've read the datasheet correctly, this unit seems like it should be able to supply sufficient current at 3.3VDC to light a few LEDs and power an ATtiny processor, even keeping in mind the fairly high ESR from a typical lithium coin cell (as discussed here: http://interactive-matter.eu/blog/2009/08/29/driving-circuits-from-a-cr2032-lithium-coin-cell/). In other words, even if pulling 80mA drops the cell voltage below 1.5VDC, the boost converter will continue supplying 3.3VDC as its minimum input voltage is 0.5VDC.

The space bit is harder to get around. I'm probably going to mount the TSOT-23 on the back of my board next to the coin cell clip and a few passives, so it'll likely get hand soldered. Based on the datasheet, most of passives needed to support the reg are tiny, and the inductor isn't huge either.

Might be worth looking into?

  Are you sure? yes | no

Nick Sayer wrote 11/09/2015 at 17:43 point

A CR2032 is a great deal more powerful than a CR1220. You should be ok, but I doubt a CR1220 would cut the mustard.

  Are you sure? yes | no

j0z0r pwn4tr0n wrote 11/01/2015 at 13:28 point

I just got some of these boards from OSH park and I was wondering the polarity of the LEDs as well as which footprint has the capacitor versus the resistor 

  Are you sure? yes | no

Nick Sayer wrote 11/01/2015 at 16:24 point

The cap is on the end of the ATTiny and the resistor is to one side.

There should be a dotted line nearer to the cathode end of each LED. You can also look at the copper traces. The cathode of each will be connected to the ground plane and the anode will have a line going off to the controller.

  Are you sure? yes | no

j0z0r pwn4tr0n wrote 11/01/2015 at 17:37 point

Thanks! I figured out the LEDs, but I was still lost for the other two. I'm done soldering it up, now I just need to program it. I don't have a pogo pin adapter, but I'll figure something out

  Are you sure? yes | no

Nick Sayer wrote 11/01/2015 at 17:44 point

I sell a Pogo pin adapter on Tindie. SparkFun sells one too.

  Are you sure? yes | no

Nick Sayer wrote 10/12/2015 at 18:21 point

I just do PnP by hand with tweezers. I get paste stencils from OSHStencils for some projects. Others I paste by hand with a syringe.

Even with all of that bother it's still faster in my view than TH assembly.

  Are you sure? yes | no

zakqwy wrote 10/12/2015 at 15:39 point

I'm a fan of the round board! I'd like to learn more about your experience with home PnP/reflow--any more information on that portion of this project?

  Are you sure? yes | no

Nick Sayer wrote 10/12/2015 at 16:49 point

In fact, I sell a toaster oven reflow conversion system on Tindie called Toast-r-Reflow. 

http://hackaday.io/project/3908-toast-r-reflow

  Are you sure? yes | no

zakqwy wrote 10/12/2015 at 16:52 point

Nice! Way more sophisticated than the crap I threw together last year [https://hackaday.io/project/3339-neurobytes/log/11549-toaster-oven-reflow-tangent]. What about the PnP side of things?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates