Showing posts with label gfx library. Show all posts
Showing posts with label gfx library. Show all posts

Saturday, March 29, 2014

More LED Matrix shenanigans!

It's been about two weeks since my last post.   It took a few nights to wire the sparkfun button pads, and a few more days for various parts, but "we have lift-off"!!   The wiring really got stupid, fortunately I had a ton of leftover cuttoff wire from 3d printers! I used some protoboard which connects to the button pads via header / connector, then i wired up R/G/B/Row/Button connectors.   This literally took me 3 sessions of 2-3 hours each.    be patient, tin EVERY wire and double check each joint!



After wiring it all up, I realized I didn't have anything to connect this to my breadboard!  So i ordered some pre-wired 8 pin connectors, and after a few hours of tinkering (mostly trying different wiring schemes mentioned in the code), I had a few blinky lights!













I'd originally encountered the "Demystifying the TLC5940" ebook and code which got me pretty close, but my row scanning setup was slightly different.   A little more googling lead me to nearly exactly what i needed!
https://github.com/jblang/tlc5940demystified

This guy is using a similar shift register setup to select rows.   He's using a shift register / transistor in one combo device.   I'm using 74HC164 which allows you to shift out w/out the use of a latch pin, and that powers TLC59213 to source the current for the LED's.     I ran the clock of the 164 to the clock of the 59213, adjusted some pins in the code and got what you see above!

Now, this is certainly progress, but its not entirely correct. First off, he's only using a Red/Green matrix, I need one more color!   From what I can tell, in his wiring, he's doing R-G-R-G, etc.   He's also only using 1 TLC5940.  On mine, I'm doing 1-TLC5940 for each color - RRRRRRRRRRRRRRRGGGGGGGGGGGGGGGBBBBBBBBBBBBBB..   I found getting this sorted was just a matter of changing some of the math that selects the pins.   A few more quick changes, and I had both his Plasma and Scoll functions working well!

I've made a fork of the above project on GitHub which can be found here:
https://github.com/billieblaze/tlc5940demystified

Next, I'll be adding some of the Adafruit GFX library functionality and integrating my button row scanning!

Friday, March 7, 2014

LED Matrix Library

After playing with my Adafruit matrix for a few hours, I began to look at the underlying libraries.  There are two - RGBMatrixPanel (https://github.com/adafruit/RGB-matrix-Panel) which handles communication with the matrix and their GFX library (https://github.com/adafruit/Adafruit-GFX-Library) which handles the actual pixel data and manipulation.    I looked over both and found the code well commented and pretty to the point.    They also have a good article about the GFX library - http://learn.adafruit.com/adafruit-gfx-graphics-library/overview

I plan to mashup the RGBMatrixPanel library with the TLC5940 library that'll be powering my SuperUI module.   I should be able to swap out the init, data transfer and interrupt routine, leaving me with a really nice API for the graphical portion of the module.     I took a first pass and got it to compile, but haven't tested yet.  I'll check it into github when I see twinkles from my mini matrix.