Jump to content
43oh

[Group Buy-10] [O] RGB SMD LED (with built-in controller)


Recommended Posts

  • Replies 107
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Created one. (Updated 12/12, added package with longer pads)   5050WS2811.lbr

Yes, for the individual led option, 20 cents per led (each is a rgb led with builtin controller).   For the tape/reel version, It is sold by the meter, has 60 leds per meter, so cost breaks down to

Just FYI, parts are here, strips were tested and are OK. I didn't expect them to arrive so quickly, so I am not sure if I will be able to ship tomorrow.     Those are very cool LEDs BTW, one wir

Posted Images

5050/WS2811 code example.
Can be used for any number of LEDs, default is 30 (0.5m strip.)
For faster updates, change data to u_char and send all bytes one by one.

post-73-0-18894600-1352434817_thumb.jpeg

#include <msp430g2553.h>
typedef unsigned char u_char;
typedef unsigned int u_int;
typedef struct {
u_char r;
u_char g;
u_char b;
} RGBLED;
#define DATA_OUT_PIN BIT7
void sendRGB(u_char numberOfLEDs);
RGBLED data[30] = { 0, }; // 0.5m strip
void main(void) {
WDTCTL = WDTPW + WDTHOLD;
BCSCTL1 = CALBC1_16MHZ;
DCOCTL = CALDCO_16MHZ;
// setup USIB
P1SEL |= DATA_OUT_PIN;
P1SEL2 |= DATA_OUT_PIN;
UCB0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
UCB0CTL1 |= UCSSEL_2; // SMCLK
UCB0BR0 |= 0x03; // 1:3 - 16MHz/3 = 0.1875us
UCB0BR1 = 0;
UCB0CTL1 &= ~UCSWRST;
u_char c = 0;
while (c < 30) {
data[c].r = c << 3;
data[c].g = 255 - (c << 3);
c++;
}
sendRGB(30);
}
void sendRGB(u_char numberOfLEDs) {
u_int c = 0;
u_char led = 0;
u_char leds[3];
u_char d;
while (c < numberOfLEDs) {
leds[0] = data[c].g;
leds[1] = data[c].r;
leds[2] = data[c].b;
while (led < 3) {
u_char b = 0;
d = leds[led];
while (b < 8) {
while (!(IFG2 & UCB0TXIFG))
;
(d & 0x80) ? (UCB0TXBUF = 0xF0) : (UCB0TXBUF = 0xC0);
d <<= 1;
b++;
}
led++;
}
led = 0;
c++;
}
_delay_cycles(800); // delay 50us to latch data, may not be necessary
}



The function below is for faster updates

u_int c = 0;
while (c < numOfIndividualLEDs) {
u_char b = 0;
u_char d = data[c];
while (b < 8) {
while (!(IFG2 & UCB0TXIFG))
;
(d & 0x80) ? (UCB0TXBUF = 0xF0) : (UCB0TXBUF = 0xC0);
d <<= 1;
b++;
}
c++;
}
//_delay_cycles(800); // delay 50us to latch data

Link to post
Share on other sites

RobG - Does this use a standard eagle part, or did you create one? A simple BOB would be pretty cool - especially since I only ordered a handful. Something like this.

I need to start on a wearable 430 board sometime - I've thought about it a couple of times. My kids would probably get a big kick out of it.

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...