Week 11: Output
Charlieplexing RGB LEDs on an ATTiny

Files
Eagle Schematic
Eagle Board
Fab Library
Roland Modela png
Stencil for soldering
Arduino code

Circuit Board Design
The schematic and board were designed in EagleCad using the Fab Library. It was then milled using a Roland Modela. A stencil was made to apply soldering paste to the contacts and then a toaster oven was used to solder components the components to the board. See weeks 4, 5 and 6 for more details on these techniques.
Notes, I manually designed the wiring on for LEDs. There isn't really a grand method/organization to it, I drew traces close to what my schematic looks like as best I could and then just used 0 ohm resistors to hop over wires as needed.


Programming the Board
The board was programmed with Arduino. Code is here. There is decently explicit pseudocode in the introduction explaining what is going on, also available at the end of this page. I wanted to control all the red lights, green lights, and blue lights as groups, and the code reflects that rather than more general individual light control. It works well for understanding and visualizing how Charlieplexing works and ties in with the RGB LEDs well. If I was a more proficient programmer I would have written more general, all purpose code and then applied it, but this is sufficient and quite informative on what is going on while Charlieplexing.


Final Board
The final board initially lights all the reds, then blues, then greens for a second each. Then the board cycles through the individual lights one at a time.

Hat Tip to Jeff Putney for awesome video editing/musical selection.


CharliePlexing Psuedocode

/*Charlieplexing Concept


RedLights = {AnodePin=High , CathodePin=Low} -->
={{PA0, PA1},{PA1,PA0},{PA2,PA0},{PA3,PA0}}

BlueLights -->
={{PA0, PA2},{PA1,PA2},{PA2,PA1},{PA3,PA2}}

GreenLights -->
={{PA0, PA3},{PA1,PA3},{PA2,PA3},{PA3,PA1}}

In the case of the first red Light:
PA0=High
PA1=Low
PA2=Disconnected
PA3=Disconnected

To light all of the reds and none of the Blues or Greens

Load RedPins array
Loop Through Red Pin Array such that

(
Anode and Cathode pins are turned on
First Red Light {PA0=HIGH,PA1=LOW}
Delay very small time (5? milliseconds)
Restart loop for next red light
)

To Light all of the reds, than the blues, then the greens

Run redpins array loop for 1000 milliseconds
Similar Bluepins,
Similar Greenpins
Restart Loop

*/


Home
Projects