ATTiny85 with 5 LEDs and Sleep mode. Is it possible?

Hey everyone,

I need to make a circuit which uses the ATTiny85 as the processor (using my Uno as ISP to program it).

With the press of a button it needs to awaken from sleep mode, illuminate 4 white LED's, and fade a 5th on and off for several seconds before going back into sleep mode.

What will be the best way to bring the voltage down from 9v (PP3) to 5.5v for the attiny, and also the best method for stringing the 4 LED's together?

The 5th LED will get its own pin i'm sure. I have no problems coding (at least i haven't so far!), its just the physical side of things i need help with.

Sorry for the noob questions. I tried searching for similar posts but none really satisfied my questions

Thank you for reading this far.

The Jabberwocky

It would be good to know the current requirements for the various LEDs. For now, I’ll assume they are 5mm types, and require maybe 10mA each.

Are you dead set on a 9V battery? Two or three AAs (or AAAs) would be better, would last longer, and would avoid additional parts (voltage regulator) and the attendant power loss which is never good in a battery powered situation.

That said, the four white LEDs should probably have a transistor to drive them. With a 9V supply, they could be wired in series or maybe two pairs of two in series. With the lower voltage supply, I’d wire them all in parallel, each with its own current-limiting resistor. The fifth LED can be driven directly by an MCU pin through a current-limiting resistor.

So yes, absolutely possible. Just need to think about the best approach from an electrical standpoint, and how that fits with whatever other requirements you may have.

'Twas brillig…

Hahaa, wonderful thank you!

[quote author=Jack Christensen link=topic=167835.msg1249677#msg1249677 date=1369252247]It would be good to know the current requirements for the various LEDs. For now, I'll assume they are 5mm types, and require maybe 10mA each.
[/quote]

Here is the datasheet for the LED. They are indeed 5mm, though does that say 30mA for current? or am i reading that wrong.

I'll happily use AA's in place of a 9v. Aside from the benefits you mention, they are considerably cheaper. I believe i also have a 3AA holder laying around too.

Any help you give me will be beneficial!

Thanks once again

Ah then go for the 3 AAs, that's a no-brainer. 30mA is the absolute maximum for the LEDs. Note that the other characteristics are specified at 20mA, that is the most I would try to use. Typically, I will experiment to determine how much current I need to give the brightness I want. 20mA may be more than you need, if so then that's good for battery life.

So no regulator required, use 68-ohm current limiting resistors, that will come close to 20mA. I'll work up a quick schematic and post it shortly.

This should be close, I’m not 100% sure about which pins the LEDs are connected to, I forget which timer is available for PWM, depending on which core you’re using.

Thanks again for your help Jack,

By core, do you mean which version of ATTIny85? If so, it'll be the Attiny85-20PU 8-pin.

Also, i noticed that your awesome 1,000,000 ohm toy uses an ATTiny85. Are you using a sleepmode after the 5 minutes is up? How difficult was that to incorporate.

To program an ATtiny85 with the Arduino IDE, you need to install a "core" that supports it. I've tried a couple, Arduino-Tiny, and one from the High-Low Tech group at MIT; I prefer the former. There are several others out there as well.

The "Million Ohms" project was programmed with Arduino-Tiny. It's an open-source project, check out the code here and the hardware design here (the schematic I posted above was modified from it, there's a lot in common). It uses the power-down sleep mode.

Gotcha. I installed the Hi-Lo groups core a couple weeks ago, but obviously can't test it as my ATTiny's are in the mail, hopefully they should be here by the weekend.

With regard to the schematics you made above, what is the ICSP part down on the left?

Never mind my ICSP comment, i know what it is now.

Its been a long Wednesday...

Don't try to use PWM on Timer1 (PB4) with the Hi-Lo core.

Also, there was another thread a short time ago that was remarkably similar.

http://forum.arduino.cc/index.php?topic=166602.0

I also posted sleep demo sketches for ATmega328P and ATtinyX5 on GitHub:

Showing my lack of electronics wisdom here, but would a 2N3904 substitute for the 2N4401?

Jabberwocky:
Showing my lack of electronics wisdom here, but would a 2N3904 substitute for the 2N4401?

More than likely. 2N3904 has a maximum collector current rating of 150-200mA IIRC, which should be plenty. 2N4401 is good for maybe twice that. Both have similar current gain specs.