Go Down

Topic: Simple CharliePlexer Test Sketch (Read 1 time) previous topic - next topic


Dec 22, 2011, 05:55 pm Last Edit: Dec 22, 2011, 06:02 pm by deltaflyer666 Reason: 1
First post so lets see how this goes.

Luckily, my beloved wife is just as big a geek as i am, but when it comes to programming ... not her thing. But she loves to dump things on my desk and crack the whip as it were.

Given the traditional christmas emails that get sent showing people that have decorated their houses with lights conducted to music, and her fascination for all things sparkly and pretty she went on a geek out and decided she wanted to build (for next year luckily) her own outdoor xmas lights setup, unfortunately once she starting designing circuitry the complexity of the task meant she needed me to code the arduino.

So in an effort to build an arduino sketch capable of proving her theories would work i have constructed a sketch that from the user perspective is quite simple to use, assuming you understand the basics of a Charlieplexer.

Modify the sketch so it knows how many wires you want to use, and it will automatically calculate how many LEDs (or in my case Channels) are allowed and generate the PIN connections that are required to get the Charlieplexer working and if you switch debugging mode on it will even show you these combinations as shown below (for a simple 3 pin setup) in the serial output.

PIN                    2      3      4
LED 1 set to        +      -      
LED 2 set to        -      +      
LED 3 set to               +       -   
LED 4 set to               -       +   
LED 5 set to        -              +   
LED 6 set to        +              -

Not only that, it then actualizes these pin combinations and if your circuit is wired up to the required pins it will actually sequence through all channels (or LEDs) exactly as it should.

I have tested the sketch up to a limit of 10 pins, which gives a total of 90 LEDs or Channels (more than enough for her needs i hope otherwise here come the shift registers) and thought i'd share it with the community as i had difficulty finding anything similar.

I intend to develop this further to allow serial input from a computer to control the light sequences but thats for another time, for now she and my granddaughter are thrilled to watch 90 LEDs apparently "chasing" each other around 15 breadboards :)

There are heaps of comments in the file hopefully explaining how i've done this, so it should be a decent start for you if you are as lost as i was 2 weeks ago.

Worst case scenario, it will prove completely confusing but will at least help you prove your Charlieplexer circuit is working properly.

Full sketch attached, it may be 16.5KB in size, but the actual compiled upload to the arduino is only 7538 bytes.

Go Up