Teensy LC : tlc5940 and shiftpwm libs ?

localhero

Active member
Hi,
Could the tlc5940 and the shiftpwm libraries be ported for the teensy lc ?
I am trying to control the 4*4 sparkfun button pads with a teensy lc but it needs several pwm output pins.
I have bought a tlc5940 (and several 74hc595 as an alternative to test as I am almost a beginner) but it doesn't compile on the Teensy LC.
Regards
David
 
Why don't you share some details as to what your project entails ?
There is usually more than one way to accomplish one thing.

You could easily do this with WS2012b LEDs (Neopixels) , which are individually addressable and use the FastLED library, for example. No need for multiple PWM outputs.

What hardware have you already purchased other than the tlc5940 ?
 
Please post links to the button pad and tutorials you mentioned, and any other relevant material about what you're actually building. Context matters...
 
It's simple. You spend a few more bucks and buy a Teensy 3.2.

I really can't understand why people are so avaricious and buy a Fiat 500 for 11.65$ although they could get a Land Rover for 19.80$...
 
I have already a Teensy 3.1 for a while but it is used for another project.
I have recently bought Two teensy LC and the audio board for smaller projects.

It's absolutely not a question of money, it's simply I have these boards and I would have loved to use them to control rgb leds and pads.
It's also a way for me to learn, the Teensy LC has all the power I need. I simply miss these libs.
Or maybe I should use another lib I don't know ?

Here is the tutorial I have followed : http://interactingobjects.com/sparkfuns-4x4-button-led-matrix-part-1-soldering/
But I don't have enough PWM pins (same for the Teensy 3.1) so I have begun to explore shift registers and tlc5940.
And the Sparkfun button pads : https://www.sparkfun.com/products/7835

I would like to use it to build my MIDI controller/sequencer.
Regards
 
I have also purchased a 74hc4067 after reading some posts on different forums but I think I was wrong as I can control only a led at once.
As I said I am almost a beginner and I learn from every mistake I make...
 
edit..
so basically your trying to use either the TLC5940 or shift-registers to run the leds, the problem you have is that neither library is supported on the LC
 
Last edited:
edit..
so basically your trying to use either the TLC5940 or shift-registers to run the leds, the problem you have is that neither library is supported on the LC
Yep, that's why I simply had asked to Paul if these libs could be ported on the Teensy LC.
Nothing more.
If these libs are obsolete please let me know what else I can use.
 
@localhero
Post some linlks and info. I have suggested an alternate soluiton already in my post above.

@Theremingenier
An Arduino UNO may be a Fiat 500. To stay with the metaphore the Teensy LC is a Land Rover, perhaps without the premium package, but still a land rover ;-)
If you design a product and not just a one-off project sometimes price does play a role. Granted, that unlikely pertains to this project, but a Teensy LC is more than plenty to light 16 LEDs.
 
Yep, that's why I simply had asked to Paul if these libs could be ported on the Teensy LC.
Nothing more.
If these libs are obsolete please let me know what else I can use.

Not so much obsolete as it takes time to make and test the changes and there is very few people reportedly using either. So Paul just decided to spend his time on other things, there is not much stopping anyone from looking at the github and making the changes themselves and posting them.
 
This is the modern replacement for the (now ancient) TLC5940.

https://www.adafruit.com/products/815

TLC5940 is an obsolete part. I know there's a lot of web pages about it, but it's expensive, difficult to use, and the code is horrible. I really do not want to work on that code again (and nobody else ever did... which I why I ended up being the one to port it to other chips).


I believe ShiftPWM is very close to being able to work on Teensy LC. I'll take a look shortly.
 
@localhero
Post some linlks and info. I have suggested an alternate soluiton already in my post above.

I have already posted what I have built (following this : http://interactingobjects.com/sparkf...t-1-soldering/) :

So I can't change the leds now.

I am not sure to be able to understand why the lib doesn't compile on the LC but I will try.
 
This is the modern replacement for the (now ancient) TLC5940.
https://www.adafruit.com/products/815

TLC5940 is an obsolete part. I know there's a lot of web pages about it, but it's expensive, difficult to use, and the code is horrible. I really do not want to work on that code again (and nobody else ever did... which I why I ended up being the one to port it to other chips).

I believe ShiftPWM is very close to being able to work on Teensy LC. I'll take a look shortly.

Oh great :D

Thanks Paul for pointing to a replacement part. Didn't know that this TLC5940 was so horrible. Hmmm I have one for sale then.
The problem is that I live in France and such adafruit products take time to arrive :confused:
 
However, these aren't going to help much with the LEDs on that Sparfun button pad. It has 16 LEDs, each with red, green and blue. That's 48 individual LEDs to control.

But there aren't 48 individual wires routed to the 48 LEDs. So it's incompatible with TLC5940 or Adafruit product #815 or ShiftPWM. All of those would work if you connect a single LED to each pin, but that's simply not the way Sparkfun made that button pad.

Sparkfun connected it in a matrix manner. It's documented on their site. Here's the schematic:

4x4-schem.jpg

Instead of 48 wires, this thing has 12 LED wires on the right hand side, and 4 on the bottom. To make this sort of thing work, you need to turn on one of the 4 column (the GND pins) at a time, and then drive the 12 rows with the LED pattern you want for that column. Then you rapidly repeat for each column. The LEDs are on at most 25% of the time, so you need to drive them with 4X as much current. The GND pins need to carry that 4X current times 12, which means a really big NPN or N-channel transistor is needed.

This type of LED matrix driving is not a beginner level project. It's quite difficult to do correctly. You end up working with circuitry to switch large currents quickly, which is very unforgiving of minor mistakes. I do not recommend attempting the LED matrix drive. It's difficult, even for experts. The odds for success at a beginner level are slim at best.

Perhaps you could just use that board to hold the parts, but cut away all 12 of those LED row wires, and connect all 4 GND pins direct to ground. Then you could solder 48 wires from 3 of those Adafruit boards to control all the LEDs individually.
 
Just so you can see it does indeed work, here's a photo of the Teensy LC on my desk right now, controlling 16 RGB LEDs with the hardware I built years ago for testing ShiftPWM.

shiftpwm.jpg
(click for full size)
 
However, these aren't going to help much with the LEDs on that Sparfun button pad. It has 16 LEDs, each with red, green and blue. That's 48 individual LEDs to control.

But there aren't 48 individual wires routed to the 48 LEDs. So it's incompatible with TLC5940 or Adafruit product #815 or ShiftPWM. All of those would work if you connect a single LED to each pin, but that's simply not the way Sparkfun made that button pad.

Sparkfun connected it in a matrix manner. It's documented on their site. Here's the schematic:

View attachment 6145

Instead of 48 wires, this thing has 12 LED wires on the right hand side, and 4 on the bottom. To make this sort of thing work, you need to turn on one of the 4 column (the GND pins) at a time, and then drive the 12 rows with the LED pattern you want for that column. Then you rapidly repeat for each column. The LEDs are on at most 25% of the time, so you need to drive them with 4X as much current. The GND pins need to carry that 4X current times 12, which means a really big NPN or N-channel transistor is needed.

This type of LED matrix driving is not a beginner level project. It's quite difficult to do correctly. You end up working with circuitry to switch large currents quickly, which is very unforgiving of minor mistakes. I do not recommend attempting the LED matrix drive. It's difficult, even for experts. The odds for success at a beginner level are slim at best.

Perhaps you could just use that board to hold the parts, but cut away all 12 of those LED row wires, and connect all 4 GND pins direct to ground. Then you could solder 48 wires from 3 of those Adafruit boards to control all the LEDs individually.

He could use fets for each column. Run RBG for first column for a cycle, then switch to next column and repeat, the Teensy LC should be capable of switching between 4 fets to run the 4 columns. He would need to run them with higher then normal current since they would be dimmer due to the 1/4 duty cycle. Unlike PCA9685 you can use switching frequencies higher then 1.6KHz with the TLC.
 
He could use fets for each column. Run RBG for first column for a cycle, then switch to next column and repeat,

Yes, but that's a pretty advanced project. Even experts can struggle with circuitry for driving MOSFET gates rapidly, and getting the timing of everything correct, and along the way not making any mistakes that cause a 4X or 48X too high current from flowing through some part of the circuit for too long. I believe the odds of any beginner getting it working, with a lot of frustrating experiences and blown parts, is virtually zero.

I'm honestly pretty surprised Sparkfun even sells this board. Their tutorial only really talks about wiring up the buttons... for a good reason.
 
Yes, but that's a pretty advanced project. Even experts can struggle with circuitry for driving MOSFET gates rapidly, and getting the timing of everything correct, and along the way not making any mistakes that cause a 4X or 48X too high current from flowing through some part of the circuit for too long. I believe the odds of any beginner getting it working, with a lot of frustrating experiences and blown parts, is virtually zero.

I'm honestly pretty surprised Sparkfun even sells this board. Their tutorial only really talks about wiring up the buttons... for a good reason.

Yes, I agree about sparkfun and this board, its advanced and there are much easier ways of doing it. I also believe there are enough examples of different circuits out there that its entirely possible to do this project without having done it before. You cant gain experience if you don't try to release a little magic smoke.
 
Thanks Paul for adding support for Teensy LC to ShiftPWM !
I've quickly tested it with leds on a breadboard and it works perfectly :D

Now I agree that this matrix is not trivial to manage.
 
Back
Top