Sunday, February 23, 2014

Driving 4 RGB LEDs from an ATTiny85

I'm not going to do anything with this circuit right away and I'm going to tear it down to use the board for something else, so I'm squirreling it away here.  On the left are lines from the ATTiny85.
I originally just laid this out R/G/B on all lines, but when I started driving them, I started getting the red LEDs coming on due to current looping through when driving other channels.  This is because the red LEDs have the lowest forward voltage and at 5 volts two of them can glow in series so for instance if I try to turn on the LED0 green, I put + on PB0 and GND on PB2, but if there's a red LED between PB0 and PB1 and another between PB1 and PB2, they can come on as well.

This uses my usual cheat of using the fact that only about 120 ma of current will go through the ATTiny, and I'm multiplexing these so they can't be on more than about 20% of the time at most so on average I'm staying within the LED specs.

The code for this is "4xRGB-test.c" (and .hex) at https://github.com/jridley/blinkiecode

Here's a video:




No comments: