Jump to content
43oh

RGB LED Lamp


Recommended Posts

Store link:

RGB LED Bar Graph

 

This one has been on my mind for a long time now and I have finally settled on the design.

I will be using 12 5050 RGB LEDs and one TLC5971 driver from TI, which is an awesome chip by the way and requires only 3 external parts. I was also looking to build more powerful lamp, one with 16 or 20 LEDs, but for now I will how this one works out.

Suggestions are welcome.

 

[ image removed since the SF's component's footprint is incorrect, see later posts. ]

Link to post
Share on other sites

You're looking at 3.6W maximum power dissapation here. I don't really know if you need a heat sink, but if not, you might need thermo vias to get the heat to the bottom layer.

 

Now, the only thing missing here is a Bluetooth connection and an Android App to control the color :D

 

Cheers

TomKraut

Link to post
Share on other sites
You're looking at 3.6W maximum power dissapation here. I don't really know if you need a heat sink, but if not, you might need thermo vias to get the heat to the bottom layer.

I do have some thermo vias and will add more.

I will be powering this unit with either 10V or 12V.

At 10V, I am looking at 730mW Pd and 1260mW at 12V, which is below TLC5971's 1.6W(85F)-3.1W(<25F) power rating.

One possible way to lower Pd might be adding 4th red LED in series on the back side (which will lower Pd to 570mW & 1100mW respectively) or simply use dot correction.

I am also thinking of ordering 2oz copper boards and I have included special pads for attaching small heat sink.

 

Now, the only thing missing here is a Bluetooth connection and an Android App to control the color :D

Cheers

TomKraut

I was actually thinking about adding CC2500 board. However, if I do decide to add CC2500 I will abandon TLC5971 and use MSP430/MOSFET to drive LEDs instead.

 

Does anyone have any 5050 LEDs like those?

 

I almost got taken for a ride by SparkFun, again!!!!!

I used 5050 RGB from their library to do my board just to find out their connections do not match with commonly available parts, not even 5050's they sell. This is a third or fourth time I found issues with their library. I have to redo my board now.

Be aware when using SparkFun's library!

Link to post
Share on other sites

Created another board (need to do something with those leftover 5050s :) )

This one is 1.8" x 1.8", 16 chip, 4 row RGB bar graph, can be daisy chained.

To lower TLC's Pd, there are 2 separate power rails, one for red LEDs and one for green & blue LEDs.

On-board 1A DC/DC (TPS5410) can be used to power red LEDs (only a single DC/DC is required for up to 8 boards.)

Edge connectors make it easier to connect multiple boards with a 0.05" ribbon cable.

 

post-197-135135539498_thumb.png

post-197-135135539491_thumb.png

Link to post
Share on other sites
  • 4 weeks later...

Here's the second board, 4 x 4 LED bar (eventually, I will assemble 3 more boards to create 4 x 16 bar.)

DC/DC converter is not assembled yet, but once it is, it should reduce Pd by about 320mW. That should eliminate the need for a heat sink.

 

 

post-197-135135542689_thumb.jpgpost-197-135135542692_thumb.jpg

Link to post
Share on other sites

You could put 3 Li-ION batteries in series: (3.7)(3) = 11.1V

 

It would probably like that amount of current too.

 

I've had good service from Tenergy for Li-ION batteries. Shipping costs to Canada suck though. You might be able to get a free shipping coupon from them since you're in the US.

Link to post
Share on other sites

Here's a simple 5971 test code

 

#include 

#define SCK_PIN BIT5
#define SDT_PIN BIT7

void write(char data);

/*
* main.c
*/
void main(void) {

WDTCTL = WDTPW + WDTHOLD; // disable WDT
BCSCTL1 = CALBC1_16MHZ; // 16MHz clock
DCOCTL = CALDCO_16MHZ;

P1SEL |= SCK_PIN + SDT_PIN;
P1SEL2 |= SCK_PIN + SDT_PIN;

UCB0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
UCB0CTL1 |= UCSSEL_2; // SMCLK
UCB0BR0 |= 0x0F; // SPI must be slower
UCB0BR1 = 0;
UCB0CTL1 &= ~UCSWRST; // clear SW

_delay_cycles(5000);

// test pattern, 8 color
char r[8] = { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF };
char g[8] = { 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF };
char b[8] = { 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF };

char data[4] = { 0x94, 0x5F, 0xFF, 0xFF };

char byte = 0;
char seq = 0;

while (1) {
	byte = 0;
	while (byte < 8) {
		if (byte > 3) {
			// swap g and b for LEDs with Anode on pin 1
			write(b[seq]);
			write(b[seq]);
			write(g[seq]);
			write(g[seq]);
			write(r[seq]);
			write(r[seq]);

		} else {
			// write command, function control, global brightness
			write(data[byte]);
		}
		byte++;
	}

	_delay_cycles(8000000);

	seq++;
	if (seq == 8)
		seq = 0;
}
}

void write(char data) {
while (!(IFG2 & UCB0TXIFG))
	;
UCB0TXBUF = data;
}

 

And here's the code for lamp (round board) controller. This one can control 4 lamps with simple commands like setColor(LAMP_ONE, r, g, B)

 

#include 

#define SCK_PIN BIT5
#define SDT_PIN BIT7

#define BLANK BIT5
#define DSPRPT BIT6
#define TMGRST BIT7
#define EXTGCK BIT0
#define OUTTMG BIT1
#define WRITECMD 0x94
#define OFF 0
#define ON 0x01
#define RED 0
#define GREEN 1
#define BLUE 2
#define GREEN_OR_BLUE BLUE
#define BLUE_OR_GREEN GREEN
#define LAMP_ONE 0
#define LAMP_TWO 1
#define LAMP_THREE 2
#define LAMP_FOUR 3

void write(char data);
void blank(char lamp, char status);
void setGlobalBrightness(char lamp, char color, char value);
void setBrightness(char lamp, char color, char value);
char getBrightness(char lamp, char color);
void setColor(char lamp, char red, char green, char blue);
void sendData();

char lamps[4][3] = { { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00,
	0x00 }, { 0x00, 0x00, 0x00 } };
char cd[4][4] = { { WRITECMD, DSPRPT + 0x1F, 0xFF, 0xFF }, { WRITECMD, DSPRPT
	+ 0x1F, 0xFF, 0xFF }, { WRITECMD, DSPRPT + 0x1F, 0xFF, 0xFF }, {
	WRITECMD, DSPRPT + 0x1F, 0xFF, 0xFF } };

/*
* main.c
*/
void main(void) {

WDTCTL = WDTPW + WDTHOLD; // disable WDT
BCSCTL1 = CALBC1_16MHZ; // 16MHz clock
DCOCTL = CALDCO_16MHZ;

P1SEL |= SCK_PIN + SDT_PIN;
P1SEL2 |= SCK_PIN + SDT_PIN;

UCB0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
UCB0CTL1 |= UCSSEL_2; // SMCLK
UCB0BR0 |= 0x0F; // SPI must be slower
UCB0BR1 = 0;
UCB0CTL1 &= ~UCSWRST; // clear SW

_delay_cycles(5000);

// test sequence
while (1) {
	setColor(LAMP_TWO, 0xFF, 0x0, 0x0);
	blank(LAMP_TWO, OFF);
	sendData();
	_delay_cycles(16000000);
	setColor(LAMP_TWO, 0x0, 0xFF, 0x0);
	setGlobalBrightness(LAMP_TWO, GREEN, 0x3F);
	blank(LAMP_ONE, OFF);
	setColor(LAMP_ONE, 0x0, 0x0, 0xFF);
	sendData();
	_delay_cycles(16000000);
	setGlobalBrightness(LAMP_TWO, GREEN, 0x0F);
	sendData();
	_delay_cycles(16000000);
	setGlobalBrightness(LAMP_TWO, GREEN, 0x03);
	sendData();
	_delay_cycles(16000000);
	blank(LAMP_ONE, ON);
	blank(LAMP_TWO, ON);
	sendData();
	_delay_cycles(16000000);
}
}

void sendData() {
char l = 4;
do {
	l--;
	char b = 0;
	while (b < 4) {
		write(cd[l][b]);
		b++;
	}
	do {
		write(lamps[l][bLUE_OR_GREEN]);
		write(lamps[l][bLUE_OR_GREEN]);
		write(lamps[l][GREEN_OR_BLUE]);
		write(lamps[l][GREEN_OR_BLUE]);
		write(lamps[l][RED]);
		write(lamps[l][RED]);
		b--;
	} while (b > 0);
} while (l > 0);
_delay_cycles(0x1FF);
}

void blank(char lamp, char status) {
if (status) {
	cd[lamp][1] |= BLANK;
} else {
	cd[lamp][1] &= ~BLANK;
}
}
void setGlobalBrightness(char lamp, char color, char value) {
if (color == RED) {
	cd[lamp][3] &= 0x80;
	cd[lamp][3] |= (0x7F & value);
} else if (color == GREEN_OR_BLUE) {
	(value & BIT0) ? (cd[lamp][3] |= BIT7) : (cd[lamp][3] &= ~BIT7);
	cd[lamp][2] &= 0xC0;
	cd[lamp][2] |= (0x3F & (value >> 1));
} else {
	(value & BIT0) ? (cd[lamp][2] |= BIT6) : (cd[lamp][2] &= ~BIT6);
	(value & BIT1) ? (cd[lamp][2] |= BIT7) : (cd[lamp][2] &= ~BIT7);
	cd[lamp][1] &= 0xE0;
	cd[lamp][1] |= (0x1F & (value >> 2));
}
}
void setBrightness(char lamp, char color, char value) {
lamps[lamp][color] = value;
}
char getBrightness(char lamp, char color) {
return lamps[lamp][color];
}

void setColor(char lamp, char red, char green, char blue) {
lamps[lamp][RED] = red;
lamps[lamp][GREEN] = green;
lamps[lamp][bLUE] = blue;
}

void write(char data) {
while (!(IFG2 & UCB0TXIFG))
	;
UCB0TXBUF = data;
}

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...