Hi there,
New to the forums and new to the arduino environment. Just started using it for a wearable technology paper at university.
I am designing a necklace and wanting to put 8 rgb leds in a line similar to this: - YouTube
I am using these SMD LEDs http://ledstuff.co.nz/datasheets/LED-PLCC6RGB.pdf and just wanting to check with you all that I am going to be hooking it up right.
If I have 3 shift registers chained together. All the Red inputs going to one, the green to another, blue to the last. And all the negatives are going to ground will this work?
I am then hooking the latch, data, and clock pins to three PWM pins on the lilypad?
I'm pretty sure this is the correct way to do it after dissecting through old posts of what others have done. The coding will be the next part to work out.
If anyone can help and let me know I'm heading on the right track that would be appreciated.
If your Lilypad is just driving the LED, take the ShiftOut tutorial and add two 74hc595 instead of one. The only PWM you're going to need is to dim all LED at the same time if you want that.
If you want individual PWM for each LED, consider getting a TLC5940 or similar.
Korman
Would I not need 3 Shift Registers? One for each colour, red green blue?
Yes, you will need in total 3 shift registers, but you can chain them together into one 24-bit register. It's up to you if you assign them one for each colour or you attach groups of 3 bits to to each diode. Both approaches are valid and depend mostly on what's feels more comfortable to program or layout.
If you use the PWM led driver chip, it will provide all the necessary pins and has the additional option to set a different colour to each pin, thus allowing you to have individual colours for each led.
Korman
Thanks for that. I managed to hook up two leds with two shift registers and that worked so time to go buy a 3rd.
My next problem is power source. I am just running a single led using the blink code in arduino and it isn't blinking when I hook it up to external power source. I have tried a AAA battery through the lilypad power supply and i get a very dimly lit led but no blinking.
I then tried hooking to a 3v cell battery but no luck there either.
What do I need to do to power these 8 rgb leds. I believe they run off 5v each (according to the specs i provided in my first post) but how do I go about a 5v external power source and would this be enough for 8 RGB's.
Thanks again
Sorry for double post but need an answer desperately. Have hand in on Friday.
I have my matrix all hooked up and working
but can't get it to run off battery power.
I am using the lilypad power source but it won't run anything.
If i use a voltage regulator like this http://jaycar.co.nz/productView.asp?ID=KC5446 will this power the arduino and the leds?
Or can i run the lilypad on a 3v cell battery and then run the shift registers and leds on a seperate battery? If this is the case what voltage battery would I need. I am trying to keep the size of the project down so want to use cell batteries if possible.
Also I am using this code http://drafts.thatcompdude.com/arduino/RGB_led_pwmViaShift2_ver5/RGB_led_pwmViaShift2_ver5.pde and am trying to set it up so it will turn on and off using a light sensor.
This is what I had set up but it doesn't seem to work. Any ideas?
void setup() {
// initialize the shift reg control pins as outputs:
pinMode(__dataPin, OUTPUT);
pinMode(__clockPin, OUTPUT);
pinMode(__latchPin, OUTPUT);int sensorPin = A0;
int sensorValue = 0;Serial.begin(14400);
//Serial.pringln("In setup");
setupTimer();
}ISR(TIMER2_OVF_vect)
{
/* Reload the timer */
TCNT2 = __RELOAD_VAL;
//Shifts out pins: 1 is on first 3 pins of shift reg//sensor
sensorValue = analogRead(sensorPin);
Serial.print("the sensor value is: " );
Serial.println(sensorValue);
if (sensorValue > 250)
{__LATCHPIN_SET_LOW; //Latchpin low!
for(int isr_ledNumber=__numLedsInArray; isr_ledNumber >= 0; isr_ledNumber--)
{
for(int isr_loopCount=0; isr_loopCount < 3; isr_loopCount++)
{
if(ledStates[isr_ledNumber][isr_loopCount] <= isrCount)
{
__DATAPIN_SET_HIGH; //Set dataPin to high.
}
else
{
__DATAPIN_SET_LOW; //Set dataPin to low.
}
__CLOCKPIN_SET_HIGH; //Clock pin high
__CLOCKPIN_SET_LOW; //Clear clock pin to low
}
}else {
__LATCHPIN_SET_HIGH; // Set latchpin HIGH!
isrCount++;
if(isrCount >= __maxBrightness)
{
isrCount=0;
}
}
delay(100);
}
I appreciate any help.
Thanks