Tag Archives: 8-bit AVRs

AVR ATtiny10 runs LED blinker for 6 months

Check out our new AVR site. In celebration, I want to tell you about a neat project. My buddy Wayne Yamaguchi had a whole bunch of tiny coin cells left over from a project. So he whipped up a little AVR blinker using an AVR ATtiny10. The one he gave me flashes every two seconds and is quite bright. Wayne’s design intent was to put this inside a phosphor-coated globe and have a UV LED charge up the phosphors every few seconds. For this round he is just using a white LED, but you can see “UV” on the silkscreen. Wayne has done some quick calculations and it looks like if you slow it down to one 3mA flash every 8 seconds it should last for 6 months. Wayne’s trick it to take the AVR out of active mode and put it to sleep, and use the Watch Dog Timer to wake it up, flash the LED and then go back to sleep. Wayne describes the ATtiny10 project here.

ATtiny10-blinker_Yamaguchi_finger

This flasher works 6 months off a CR1220 lithium cell. Using the ATtiny watchdog timer is the secret to such miniscule power consumption.

It’s interesting to note that Wayne started out with a MCU from an Atmel competitor and found it unsuitable. As many other friends have noted about these other MCUs, Wayne said, “…a lot more coding had to be done to get the job accomplished.” He also ran into limitations where he had to do a work-around in the competitor’s chip. Another friend has commented that competing MCUs can often do one thing well, but when it needs to do two tasks, even simple ones, there are real headaches. That is why they love AVR chips. AVRs were “invented” as a complete modern architecture. Once you know one chip, it’s easy to move around to others in the AVR family, even the AVR 32-bit chips.

The only reason Wayne did not start with the AVR is that he thought he could not keep his obsolete Studio 4 install, which he knows and trusts, and still program the ATtiny10. I asked around, and my Atmel pals told me that everything Wayne would need is in the Atmel Software Framework (ASF). Sure enough that lead Wayne to a solution, and he had his ATtiny10s working under Studio 4. I kept telling Wayne to just upgrade to Studio 6, which will let you program AVR-32 and our ARM-based MCUs as well as all the 8-bit AVRs. Wayne did not want to risk changing environments, since he has several existing products that he changes and customizes and supports with Studio 4. My friends say the answer there is to just run virtual computers with VM Ware or Virtual Box. You can have Studio 4 on one Windows install and Studio 6 on another. Or you can set restore points and go back and forth between the two Studios on one install.

ATtiny10-blinker_Yamaguchi_prototype

Wayne Yamaguchi uses toner-transfer and a homemade acid bath to make prototypes in an hour.

Another interesting thing in Wayne’s blog linked above is a picture he has of the prototype. At first blush it looks like he used a router like a LPKF machine to do the board. But if you look closely, you can see some un-etched copper at the edges. Wayne uses toner transfer and a ferric chloride tank to make his own PCBs in a couple hours. The reason they look like routed boards is that Wayne is smart enough to generate the Gerbers this way so that he uses the minimum amount of ferric chloride to etch the copper. Why etch off big areas if you don’ have to? He outlines this technique in an article about prototyping I wrote a few years ago.

Now wayne did the prototype raw-copper PCB in a day to get started, but he wanted a nicer board for development (see pics and below). For this he turned to OSH Park up in Oregon. He panalized the boards as you can see from the break-away tabs on the edge. The bottom line is each PCB ended up costing him a dollar. I think he was out 20 bucks for the order and got 18 boards. OSH Park collects orders for small lots and puts them all onto a 18×24 panel used in the PCB fab industry. I like the looks of the boards since you get a silkscreen and soldermask. Don’t think, “Its just a prototype, I don’t need a silk or soldermask.” It’s you the one soldering on the board and a silkscreen tells you what goes where. It’s you re-soldering stuff and hand-soldering stuff and the soldermask is a blessing, especially with tiny parts. You want your prototype to be as close to production as possible. OSH Park panelizes two-layer boards every other day and gets a four-layer panel together every four days. You might wait a bit, but I have heard of several happy customers. For small boards like the Blinkie, they make great sense. For anything more serious I will stick with Proto-Express, right here in Silicon Valley. They do 4-mil spacing, can do 24oz copper (not at the same time!) and once your board is perfect, they have a partner in China to do high-volume for cheap. Three standard 2-layer boards in 4 days for about $90 and three 4-layer boards for $150 or so. And that is silk both sides if I remember right.

In addition to the info on his blog post linked above, Wayne sent me an email with the information about the flasher. He uses Evernote to store his notes as he does a project, so below are his notes to himself. I put in current Digi-Key pricing.

Wayne-Yamaguchi_Blinkie-LED-flasher

Wayne Yamaguchi shows the Blinkie flasher he designed.

Wayne did this project a couple months ago. What was interesting was how much longer the flasher ran compared to his calculations. We are not sure if this is because the batteries really have more energy when you discharge them this way, or maybe there is some other factor we don’t understand. It’s good news nevertheless. I can tell you the flasher he gave me a couple months ago is still flashing every 2 seconds. Here are Wayne’s notes:

CR2016, CR2032 Battery Info UV Blinker

2016 – 90mAH

2032 – 240mAH

Compute the average current if LED is pulsed 1 sec every 10 minutes.

1 minute = 60 seconds, 10 minutes = 600 seconds.

1 out of 600.  0.17% duty cycle.

If the LED current is 10mA then average is 17uA.

Attiny10 Power down supply current @3V is 4.5uA.

Attiny10 pricing (Sept 17, 2013):

All prices are in US dollars.
Digi-Key Part Number ATTINY10-TSHRCT-ND Price Break Unit Price Extended Price
Quantity Available Digi-Key Stock: 21,464

1

0.69

0.69

Can ship immediately

25

0.576

14.4

Manufacturer Atmel

100

0.464

46.4

1,000

0.4256

425.6

Manufacturer Part Number ATTINY10-TSHR
Description IC MCU 8BIT 1KB FLASH SOT23
Lead Free Status / RoHS Status Lead free / RoHS Compliant

CR1220 battery Energizer Specifications.  Typical Capacity 40mA/Hr.  down to 2V.

$0.90 each at Digi-Key (Panasonic)

The Nichia 310 in the open bag measure 3mA @3V.

Watch Dog Timer table (from ATtiny10 full datasheet):

ATtiny10_WDT_prescale

CR1220 UV Blinker Board as rendered by OSH Park.

Yamaguchi_CR1220_PCB

Here is the PCB layout for the CR1220 battery Blinkie

 Using 3mA for LED current and 40mA/hr battery capacity gives these run-times:

Delay

tiny10current

average LED current

Estimated Run Time

1 sec

4.5uA

30uA

1,159hrs – 48.3days (~1.61 mos)

2 sec

4.5uA

15uA

2,051hrs – 85.47days (~2.84 mos)

4 sec

4.5uA

7.5uA

3,333hrs – 139 days (~4.62 mos)

8 sec

4.5uA

3.75uA

4,848hrs – 202 days  (~6 mos)

0.25 sec

4.5uA

120uA

240hrs – 10.04 days

0.125 sec

4.5uA

240uA

163.6hrs – 6.82 days

64mS

4.5uA

480uA

82hrs – 3.4 days

CR2016 (20mm lithium) UV Blinker Board as rendered by OSH Park.

Yamaguchi_CR2016_PCB

Here is a PCB layout for the Blinkie using the larger CR2016 battery.

Note to self: It appears that the ISPmk2 (in-circuit programmer) does program at 3V or other voltages.  The error message during programming is verification failed.  But, it appears to be programmed correct.

As a side note, future blinkies should have the LED driven from the free pin PB2.

Run-time test: 64ms sec Blinkie.  1220 battery.

6/22/2013 2.975v

6/26/2013 – 2.750V 6:16   (Should have ended today)

6/27/2013 – 2.736V 10:08am

6/28/2013 – 2.728V 2:06pm

7/3/2013 – 2.43V 9:57am

7/4/2013 – no LED.  Could be still running, but, LED is not visible.

Wayne-Yamaguchi_Francis-Lau_Blinkie-LED-flasher

Wayne Yamaguchi (L) explains the LED flasher held by crack protégé Francis Lau. Lunch was at the Pho Kim restaurant in San Jose.

ATtiny10-blinker_Yamaguchi_flash

It took a few tries, but I finally caught the Blinkie flashing when I snapped the picture.

-30-