This is a mix of hardware and software questions, if it belongs more in programming, feel free to move…
First the hardware - application and questions…
I’m working on building some side lighting arrays for use on my power chair - I’ve seriously modified it, so I want to take off the manufacturer’s badges on the fenders, and replace them with a bunch of LED strips. The size of the badge recess dictates 8 strips of 6 5050 RGB LED’s on each side. They are “dumb” strips that control all the LED’s in a strip, not individually addressable, so I get 24 channels per side. The strips are 12V automotive strips, with resistors built into them, and each LED channel draws between 30 and 40 mA according to the bench supply I tested them on. 40ma x 16 channels = 640ma with all the channels on full, which should be well within the working range of a TLC5940, especially since I’m planning on having the strips cycling through colors so they won’t ever all be on at the same time…
Power will be 12V from the lighting output on the chair controller, though right now I’m using an 11V 2.3A laptop supply brick for development. I’m running the 12V through a 7805 regulator to make power for the Arduino and the TLC5940’s. I may switch that to a DC-DC buck board eventually, not sure if I’d save enough power to justify it though… The rest of the 12V goes to the common lead on the strips.
Since I have two blocks of 24 channels each, I’m planning on using 4 TLC 5940’s as I don’t want to have to run 25 drive wires for the second set around the chair. I plan to have the Arduino and 2 TLC’s in one fender, and run a control cable (probably using CAT5 ethernet wire, since it has about the right number of conductors, and is small and flexible) to the second two TLC’s in the other fender, which will keep the wiring to the LED strips as short as possible. The control cable would probably carry everything but the 12V power for the LED’s. Are there any special considerations I’d need to do circuit wise to drive over that cable (probably 2-3 feet long)
At the moment I’m working on breadboards, trying to get the 24 channels working on one side, and will then add the second block. When I get everything working I’ll probably spin dedicated boards, and possibly go to a bare AVR chip rather than a full Arduino since I don’t need most of it’s functions…
Since I sort of want the two blocks to be doing the same things at the same time (it isn’t an absolute requirement, but would be nice) is it possible / practical to connect the two sets of 5940’s in parallel to the Arduino rather than daisychaining them like most of the documentation suggests? Seems like that would simplify the code since I’d only need to write it for 24 channels rather than 48…
I’m currently wiring the first 16 channels to the first TLC, and the remaining 8 to the second one, so my code would be talking to channels 0-23 if I understand the library docs correctly. Any reason not to do that? If I should spread the load more evenly (presumably 0-12 on each chip) how would I deal with that in the code?
Now for the code questions…
I’m using the TLC5940 library from https://code.google.com/p/tlc5940arduino/ which seems like the most popular one. Is there any other library that might be better?
The sample code seems to work fine with just one chip with 16 channels wired. (I’m using the “Basic use” program from the library - it’s more or less what I’m going to want for an effect…)
If I try to use two chips I run into problems -
1st - the documentation says I need to modify tlc_config.h and delete tlc5940.o… I had no problem modifying tlc_config.h, but I can’t FIND tlc5940.o - where does it hide??? (I’m running on Kubuntu Linux if that matters) I can’t find any *.o files in any of the places I’ve looked…
2nd - If I try running the sample code I get long pauses as it appears the code is trying to work channels 24-31 that aren’t connected to anything… Every discussion I’ve seen seems to assume that all 32 channels are in use, but I can’t do that in my application.
I’m having problems getting the code to work with just 24 channels how do I do that?
I tried creating a number of channels variable, and simply replacing the code for number of TLC’s with that variable, but that gives me strange patterns not the “knight rider” effect… It appears to go back and forth on the first chip, then do stuff on the second one more randomly, then go back to the first…
Sketch below w/ most comments stripped for length reduction…
/* Modified by ART to specify the number of channels actually used, as opposed to the number of TLC's x 2 */
#include "Tlc5940.h"
const int chan_no = 24;
void setup()
{
Tlc.init();
}
/* This loop will create a Knight Rider-like effect if you have LEDs plugged
into all the TLC outputs. NUM_TLCS is defined in "tlc_config.h" in the
library folder. After editing tlc_config.h for your setup, delete the
Tlc5940.o file to save the changes. */
void loop()
{
int direction = 1;
// for (int channel = 0; channel < NUM_TLCS * 16; channel += direction) {
for (int channel = 0; channel < chan_no; channel += direction) {
Tlc.clear();
if (channel == 0) {
direction = 1;
} else {
Tlc.set(channel - 1, 1000);
}
Tlc.set(channel, 4095);
Tlc.set(channel + 1, 1000);
// if (channel != NUM_TLCS * 16 - 1) {
if (channel != chan_no - 1) {
} else {
direction = -1;
}
Tlc.update();
delay(750);
}
}