Go Down

Topic: Multiplexing RGB strip lighting - seasonal outdoor lighting (Read 3309 times) previous topic - next topic

dpdigital

Jan 26, 2014, 01:32 am Last Edit: Jan 26, 2014, 04:42 am by dpdigital Reason: 1
Ok, first the goals of my project..

Year round seasonal outdoor (Christmas) lights that can be changed in their color combination for each specific holiday.
Trying to have a lower installed cost than the addressable led strip lighting.
Trying to have a similar look and feel to traditional Christmas lights by spacing them farther apart than continuous strip lighting.
Trying to have three separate channels of lights. Each with the option to select a pre set color from a button or pot, or a custom color mix using input pots.  Channels will alternate down the line of lights (red, white, blue, red, white, blue,....)
Intent is to program the arduino code onto a ATTiny84 chip to be the processor.

Ok, so far I have a pretty good start on my project with driver circuits designed using MOSFETS driven from the ATTiny84 and a hefty power supply.  I can get the project working using a variation of the "color chooser" sketch using three trimmer pots for the color mixing option and an additional pot to manually select the pre defined colors.  My current design has three diver boards (one for each channel), but it will require three separate cables down each run of lights, or at least 10 wires (3 sets of RGB and one power wire).

Now the challenge that I have run into.  To save on wiring, I would like to multiplex the channels along with the PWM signals for the individual colors.  Preferably, to do this from one processor chip.  I have set up some prototypes on my workbench, but have not been successful in multiplexing the PWM signals.  As I see it, it is basically a 3x3 multiplexed array.  Three channels (columns), each with the RGB values (rows).  I should be able to do this with 6 wires down the run of lights, right? One for the common supply of each channel and one for each color (RGB).

I will try to post my sketch code here for both scenarios, and schematics if I can work it.

Any thoughts or input on the multiplexing?

matelot

I am saving wiring by using  hct4021 and 74ls595 shift registers

dpdigital

Would the shift register approach require the addressable type led strips? or are you converting standard led strips?

I did a search on the two IC's you listed and am having trouble locating a good source for those that are not in China.  Do you have a recommendation for a good place to purchase those chips?  Also, any info you could reference about the shift register approach or any model code you have would be helpful.  I am still a rookie and not up to speed yet with the shift register idea.

Thanks

matelot


I don't know what addressable type led strips are.
The following programme  includes all the wiring requirements, counts up the variable 'myinput' and sends the result to a 74LS595 .
If a standard led strip has eight or less inputs you could build your requirements into 'myinput and send it all using three lines (+5v and 0v) to the shift register, this would then distribute it out of eight lines to your led strip. If you needed more than eight lines you can 'daisy chain' the shift registers eight outputs at a time still only needing 3 wires.
Code: [Select]

/* set up 74ls595 with
pin1 - LED 2      pin16 - vcc
pin2 - LED 3      pin15 - LED 1     
pin3 - LED 4      pin14 - datapin  (from arduino pin 8)
pin4 - LED 5      pin13 - 0v
pin5 - LED 6      pin12 - latchpin (from arduino pin 9)
pin6 - LED 7      pin11 - clockpin (from arduino pin 10)
pin7 - LED 8      pin10 - vcc
pin8 - 0v         pin9  - n/c
put each output via a resistor to 0v,
put a number in the monitor and watch the lights.
*/
const int dataPinout  =  8;   //595 pin 14
const int latchPinout =  9;  //595 pin 12
const int clockPinout = 10; //595 pin 11
int myinput;
int a;
int b;
void setup(){
  Serial.begin(9600);
  pinMode(dataPinout,  OUTPUT);
  pinMode(latchPinout, OUTPUT);
  pinMode(clockPinout, OUTPUT);
}
void loop() {
    b++;
    if (b>255){
      b = 1;}
    myinput = b;
    for (a=0;a<8;a++){
      Serial.print (bitRead (myinput,(7-a)));
      //bit read the contents of myinput so that
      //it maintains leading '0's for the screen
    }
    Serial.println();
    delay (500);
  digitalWrite (latchPinout, LOW);
  //set output shift registers to receive serial data 
  shiftOut (dataPinout, clockPinout, LSBFIRST, myinput);
  //Send data
  digitalWrite (latchPinout, HIGH);
  //set output shift registers to drive leds
}

I use paypal and chips from China have never failed to get to me in good order (except atmega chips, in both cases there was no bootloader even though the advert said 'with bootloader') so I wouldn't worry about supply. I think you can find a few suppliers in the UK but they are more expensive.
I am still toying with a 74LS299 - see my post on this forum.
Bob.

dpdigital

#4
Jan 27, 2014, 06:27 pm Last Edit: Jan 27, 2014, 11:04 pm by dpdigital Reason: 1
Thank you Bob for that information.  It looks like great info, but not.quite the direction that I am going on this project.  Let me see if I can do a better job of explaining my project:

Addressable led strips come in varying lengths and are divided into segments of individually controllable RGB LEDs. Each segment has 3 full color LEDs and an ic chip that will allow you to send a signal to that individual segment telling it to turn on and off but also what color to display.  These strips are incredibly functional, but also very expensive for a home use project like mine.

The strips that I am planning to use come in varying lengths as well.  Mine are 300 LEDs over a 16.5 ft long waterproof strip.  100 segments of 3 LEDs each, but each segment can be separated.  The whole strip is powered by 12vdc with common anodes to the full color LEDs and a wire for each color (RGB), so the whole strip is actually 4 wires (12v, red, green, blue).  Applying varying PWM signals to each of the color wires allows you to light up the whole strip with any color from the spectrum.

For the purposes of my project however, it can be simplified into three individual RGB lights (channels).  Each light has three separate color values (PWM), red, green and blue.  I want to be able to choose an individual separate color for each light (blue, pink, orange, yellow, red, green etc.).

Instead of controlling these three lights with 9 individual PWM outputs, I would like to narrow it down to 6 (3 outputs for the annodes and 3 PWM outputs).  Is this even possible?  I have been reading on other forums about the difficulty of multiplexing PWM values and that it comes down to a timing issue of how much time the anode is active for while sending the PWM pulse value.

I don't know if this makes any more sense.  Anybody have any thoughts or input on the matter?

Go Up