Showing posts with label rgb led. Show all posts
Showing posts with label rgb led. 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.    


Tuesday, March 4, 2014

Starting on some UI Bits for my Arduino project

Now that I've proof-of-concepted the Master / Slave communication between the microcontrollers, I figured I'd start in on some of the UI components.     The biggest reason I had for breaking off functionalities from the main arduino is the SparkFun RGB Button Matrix that I've been using (https://www.sparkfun.com/products/7835).    In the first iteration of my Midi Sequencer, I used this and literally a HANDFUL of shift registers to handle the RGB LED's and the button matrix.   Very tedious wiring, high parts count, lots of overhead associated with it in general.  The library I was using "ShiftMatrixPWM" is pretty damn cool, I'm not gonna lie but it ties up all sorts of other bits (timers / interrupts) and then i still had to scan the buttons.   I found that this caused instabilities in my more timing sensitive functionalities.

Initially, I was looking at the MAX7219 "Serially Interfaced, 8-Digit, LED Display Drivers" but they lacked PWM on individual LED's.  Who wants to do an RGB matrix with a limited color set?!   not me!    I kept searching and ultimately found TLC5940 "16-Channel LED Driver w/EEprom DOT Correction & Grayscale PWM Control" (http://www.ti.com/product/tlc5940).   This chip seems to do just about everything I need besides the row scanning.   It seems like I can use a few transistors to source the current required to use this chip.    I found the corresponding arduino library and some shcematics here: http://fritzing.org/projects/tlc5940-and-arduino and a few minutes later had 16 led's dancing away!

I'm planning to use an atmega328p for this particular core but might go with Attiny2313.  I don't think the ATTINY85's will have enough io to make this simple and I'd like it to be able to handle all the matrix functionality - rgb led and button matrix.    I do also like the fact that I can just scale my current setup (8x4) out to 16x4 and beyond with ease!     I'll be working on a PCB for this after I finish breadboarding the row scanning.  This guy seems to have the row scanning down, so i'll surely be referring to this alot: http://www.thebox.myzen.co.uk/Hardware/Hexome.html

I'm also starting to amass quite a bit of test sketches and conceptual code which i'll post to github soon as well!