Go Down

Topic: Library for TLC5940 16-channel PWM chip (Read 37724 times) previous topic - next topic

ReSiStAnCe

@joe912: cool stuff! care to share your program/build?

Josh18657

#181
Mar 18, 2009, 02:53 pm Last Edit: Mar 18, 2009, 02:54 pm by Josh18657 Reason: 1
I'm sorry ahead of time if I am doing something stupidly wrong here  :)

first off,
using a Duemilanove
using version 11 of the tlc library
using the arduino software, v 13
everything connected as shown in BasicUse.pde w/2.2k resistor to pin 20
BasicUse.pde works fine

when i try to connect a servo and use the servo example it doesn't move at all

servo connected as follows
brown - ground
red - +5v
orange - pin 28 (out 0) and a resistor going to +5v
I have tried a 4.7k as well as a 2.2k resistor

maybe I have the resistor codes wrong?
4.7k is yellow / violet / red
2.2k is red / red / red

also a pull-up resistor is just a resistor used in a special way correct?

Thank you for any help

Josh


joe912

#183
Mar 18, 2009, 03:02 pm Last Edit: Mar 18, 2009, 03:08 pm by joe912 Reason: 1
ive never tried servos but you could always try hooking up a led to the output,  it should appear to blink or atleast do something.  

also have you tried another servo library or in a rc model to verify that the servo works

also looking closer at your photo i cant tell if the breadboard ground has a ground connected to the arduino ground

mem

#184
Mar 18, 2009, 03:02 pm Last Edit: Mar 18, 2009, 03:06 pm by mem Reason: 1
I haven't been following this thread but has anyone actually posted some code that makes that chip work with servos.

this thread may help you get your servos working: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1232572239


Josh18657

Quote

ive never tried servos but you could always try hooking up a led to the output,  it should appear to blink or atleast do something.  

also have you tried another servo library or in a rc model to verify that the servo works

also looking closer at your photo i cant tell if the breadboard ground has a ground connected to the arduino ground


led doesn't do anything that I can see besides a very faint light

the servos work fine with the regular arduino servo library

yup, all the grounds are connected to the arduino ground

Quote

I haven't been following this thread but has anyone actually posted some code that makes that chip work with servos.

this thread may help you get your servos working: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1232572239


yeah, back a page or 2 the op made a post about this now supporting servos, and an example is included in the zip file

great link, all my servo searching and I never came acrossed that one, i'll have to read those further


thanks guys for the quick responses

nphillips

Has anyone had an issue with "long-term" running of fades?

I have 4 RGB LEDs hooked up to the TLC, set to fade every 15 seconds to a randomly selected color. When I power the circuit up (I have the arduino set up as a stand-alone, on a PCB) everything runs fine. But when I came back to the board after a day or so, the whole thing was "frozen", and nothing worked -- no fades, and my inputs weren't responding.

I double-checked my code, and I don't see anything that might cause an issue. The only thing I could think of is the "old" millis issue where it rolls back to 0 after a while. So if X is the millis rollover point, and your timer was looking for X+10, you would never actually hit that point.

I found a post from this year saying that the rollover occurs after 55 days, as opposed to 9 hours (which was what I was familiar with). Maybe I'm using an old bootloader? I'm using Arduino 0012, and my chip I bought in July 2008.

TimoRozendal

I am very grateful for this library, makes what I want to do a lot easier.
Right now I have it working, I have these RGB led strips that I can control the way I want.

However, I noticed that the color differs a bit per strip, I think that is due to perhaps a difference in leds or the inaccuracy of the resistors.  I would like to correct for that using a calibration. Can I do that using the built in dot correction of the tlc 5940?

And then how should I do that with this library, my idea is now:
- set  "#define VPRG_ENABLED    1"  in in tlc_config.h
- connect Arduino digital pin 6 to TLC pin 27 in stead of GND
- use tlc_setDCfromProgmem(dcArray1); to set all the pins at once

Questions:
- is this correct? (or do you think there is a better way)
- is it also possible to set just 1 pin at once? and can I only do it from progmem? (tlc_setDCfromProgmem is the only function that sets dot correction, right?)
- is this data automatically stored in the EEPROM memory of the tlc5940? Or should I always have VPREG enabled and send the final calibration array every time I want to use it?
Is it simply a matter of setting tlc's DCPRG pin high to store it?


----------------------------
second question:
the drive capability of the 5940 is 120 mA, is that per channel? so can it do the 16*0.12=1.92Ampere? Does that require additional cooling? what are your experiences?

Mike Mc

Yes i'd like to do this too. My channel 0 is outputting a lower voltage to my 8x8 array.

is it possible to set the Dot Correction value on just one channel individually? I see the example shows how to set ALL of them to the same value, but I don't see the point in that function. How can just one channel be adjusted on it's own please?

ReSiStAnCe

According to the datasheet: VPRG :Multifunction input pin. When VPRG = GND, the device is in GS mode. When VPRG = VCC, the device is in DC mode. When VPRG = V(PRG), DC register data can programmed into DC EEPROM with DCPRG=HIGH

Each dot correction register is 6 bits, so you need to shift in 96 bits and then latch the data into the register.
Basicly it's the same MO as shifting in Greyscale bits, but you now do it while VPRG = high

Chronoless

I'm working on a project where I have 12 TLC's with 5 RGB leds each, all TLC's on separate boards connected through 10cm ribbon cable (power external). I'm trying to drive them with one arduino and this library. I've been able to get 10 boards to work however the last two give problems. As soon as they are connected the first 10 still work but the first one (the one connected to the arduino) starts to flicker and the last two boards just give some random colors. The config file has been changed and the .o file deleted. When I put my finger on the flickering board the flickering gets less. As soon as the two boards get removed the flickering is gone.
Anybody have an idea on how to fix it or what the cause is? Maybe too long leads?
I haven't got my DSLR and camcorder here, but if required I can make a few pics later.

Mike Mc

Maybe the Arduino is not providing enough power to drive all the chips? Have you tried to power the chips from an external supply?

Chronoless

The TLC's are connected to an external power supply (4,4 V) both the VCC and VLED.

acleone

Chronoless:
The flickering you describe sounds like it's being caused by long wires.  If you have a scope, see if you're getting ringing on the control lines.  Try putting resistors in series with SCLK and XLAT and one of the tlc's.
For example,
Put a 1k between the ribbon cable SCLK and the 10th tlc's SCLK (and same with XLAT). 1k is pretty arbitrary so try other values.

nphillips:
The new millis rollover was introduced with 0013(?) - it's not part of the bootloader.  I updated tlc_fades again, try downloading r012 (http://code.google.com/p/tlc5940arduino/).

TimoRozendal:
1.  Yes, that looks correct.  See the documentation for tlc_setDCfromProgmem.
The funny-looking
Code: [Select]
prog_uint8_t dcArray1[NUM_TLCS * 12]
gets stored in program memory, which is where your sketch goes (if you comment out the array, the sketch size would go down).
You don't have to set DCPRG high - tlc_setDCfromProgmem does this for you.

2.  Yes, it's 120 mA per channel.  You will need cooling if you try to drive that much current - see the datasheet.

Mike Mc:
No, as ReSiStAnCe pointed out, you have to set all the dot-correction at once.

Josh18657:
Nothing looks wrong.  The pull-up resistor value doesn't matter much, so 2.2k or 4.7k will work.  If you have access to a scope, see if the tlc is generating pulses to the servo.


Sorry to have been inactive lately - I'll try to check the forums more often.

nphillips

Thanks, AC! This came just in time ;)

I'll give it a whirl tonight!

Go Up