Pages: 1 ... 15 16 [17] 18   Go Down
Author Topic: Library for TLC5940 16-channel PWM chip  (Read 30809 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks AC great library.

Is it possible to control the brightness of each channel?
If yes can someone please provide a sample of where they have done it?

Or

Would it be easier to have another chip controlling a say mosfet to control each intensity.

Right now my setup is 3 TLC -> (3)Mosfets -> (1)RGB_LED

I thought about adding in a 4th TLC to control the common for intensity.

Let me know,
Ram
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh yes one more question.

Is it possible to bitshift or do something to turn 0 into 4096 and 4096 into 0 for n channel fets?
Logged

Holland
Offline Offline
Sr. Member
****
Karma: 0
Posts: 439
Arduino likes cookies too
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
int i = 2000;
int inverse = abs(i-4096); //subtracting 4096 makes it inverse, but negative, abs converts negative to positive, making the conversion complete

Hope that helps =)
Logged

UK
Offline Offline
Full Member
***
Karma: 2
Posts: 110
Kittens eat Arduinos
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi I noticed this interface in your initial email and wondered if it was by design ?
Tlc.setPWMperiod(PWM period (0 - n) milliseconds);

I read in the data sheet that the chip can have a max clock of 30MHz/ which works out at about 1/7th msec per 4096 clock pulses.

I guess that means the arduino has order of 2k instructions per cycle...

is that feasible?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks on the code for inverse.
I was actually thinking about adding a !buffer chip to invert the outputs to drive the mosfets off when the signal is off / lost.
As for the pwm output i was wondering that myself I havnt seen it in there I think it had to be fixed when it changed to spi mode instead of bitbang.

Ram
Logged

UK
Offline Offline
Full Member
***
Karma: 2
Posts: 110
Kittens eat Arduinos
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

=== code
int i = 2000 ;
int inverse = abs(i-4096) ;
=== or
int i = 2000;
int inverse = 4096 - i ;
===
below is a little smaller and simpler.
Logged

New Jersey
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

when would
int inverse = (4096-i)
be negative if you are inputting 0 and 4096? Unless you are going to put in values larger than 4096, I agree with dafid and you don't need abs().
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I realise that now I was in the middle of a game when I posted smiley-razz.
Logged

germany
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Has anyone tested the Library from AC with the TLC5940 in the TSSOP packages? I have a big problem with more than one TLC. Maybe you can watch my thread here:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1268821919/0
Logged

0
Offline Offline
Sr. Member
****
Karma: 8
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I'm using the TLC5941 and it's working great except for the fading function for the arduino to control 5 RBG LEDs (15 channels).

so I have  a function with this
Code:
 tlc_addFade(channel, Tlc.get(channel), green, millis(), millis()+(duration*60) );
  tlc_addFade(channel+1, Tlc.get(channel+1), red, millis(), millis()+(duration*60) );
  tlc_addFade(channel+2, Tlc.get(channel+2), blue, millis(), millis()+(duration*60) );

I would send in 'duration' to being like 300, making the transition to take place over hours. But the transitions occurs within seconds. Do you know what the issue could be?

Thanks.

« Last Edit: March 31, 2010, 08:42:00 am by mistergreen » Logged

germany
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, but I have not yet used fading. All I know is that it gives an example in the TLC library to do so.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

*** Documentation Bug Alert ***

Alex,

Thanks for the library - works great for me!

There is a small documentation bug on the page for VPRG_ENABLED:

It says

"You will also have to connect Arduino digital pin 6 to TLC pin 27"

Actually, the library uses Arduino pin 8, not 6. I stumbled over this
and dug through the pin definitions to find the problem.

Best,
-- Terrence
Logged

0
Offline Offline
Sr. Member
****
Karma: 8
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think I figured out the length of the fading issue... There isn't enough memory to handle all of the fading.

in tlc_fades.h

#define TLC_FADE_BUFFER_LENGTH    24

I changed it to

#define TLC_FADE_BUFFER_LENGTH    64

and the steps of the fades went up and occurs a few seconds longer but alas I can't pump up the buffer_length any higher without crashing the board. Oh well, it was a nice idea smiley
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 83
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

could it be used for other uses like driving a transistor that is conected to a motor?

or an lcd display??
Logged

New Jersey
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I used the library to control an hbridge to run dc motors. The code I used is here. http://github.com/compuwizard123/HTHSRobotics0809/blob/master/hths_robotics/trunk/bottom/bottom.pde It contains other stuff for serial communication but primarily controls motors. Documentation for the electronics part of the project is here. http://sites.google.com/site/hthsrobotics/components/electronics It was used to compete in the MATE ROV competition last year.
Logged

Pages: 1 ... 15 16 [17] 18   Go Up
Jump to: