Results 1 to 3 of 3

Thread: Arduino Shift RGB LED Strips tip120

  1. #1
    Join Date
    Sep 2013
    Posts
    10
    Post Thanks / Like

    Default Arduino Shift RGB LED Strips tip120

    Just wanted to share my project for anyone else trying to so the same.. I wasn't able to find Arduino Sketch online, So I tweaked the ShiftPWM to fit my needs.

    My goal is to run 8 LED Strips (24 Channels) using 74HC595 Shift Registers, and tip120 Transistors to power the RGB LED Strips, and to read serial output from vixen. (I'm using Vixen 2), an Arduino Uno, and a PC modified PC Power Supply. Note: I currently only have 2 74HC595's, so I've only tested with that.. this code only has 16 channels defined.

    Since this uses the ShiftPWM Library you can adjust the brightness on each channel.

    I'm new to Arduino and programming, so any improvements are welcomed.

    here's the board layout
    https://docs.google.com/file/d/0Byhk...it?usp=sharing

    and here's the code. you'll need the ShiftpWM Library (www.elcojacobs.com/shiftpwm)

    int incomingByte[16];
    // You can choose the latch pin yourself.
    const int ShiftPWM_latchPin=8;
    / Clock and data pins are pins from the hardware SPI, you cannot choose them yourself.
    // Data pin is MOSI (Uno and earlier: 11, Leonardo: ICSP 4, Mega: 51, Teensy 2.0: 2, Teensy 2.0++: 22)
    // Clock pin is SCK (Uno and earlier: 13, Leonardo: ICSP 3, Mega: 52, Teensy 2.0: 1, Teensy 2.0++: 21)


    // If your LED's turn on if the pin is low, set this to true, otherwise set it to false.
    const bool ShiftPWM_invertOutputs = false;

    // You can enable the option below to shift the PWM phase of each shift register by 8 compared to the previous.
    // This will slightly increase the interrupt load, but will prevent all PWM signals from becoming high at the same time.
    // This will be a bit easier on your power supply, because the current peaks are distributed.
    const bool ShiftPWM_balanceLoad = true;

    #include <ShiftPWM.h> // include ShiftPWM.h after setting the pins!

    // Here you set the number of brightness levels, the update frequency and the number of shift registers.
    unsigned char maxBrightness = 255;
    unsigned char pwmFrequency = 75;
    unsigned int numRegisters = 2;
    unsigned int numOutputs = numRegisters*8;
    unsigned int numRGBLeds = numRegisters*8/3;

    void setup(){

    Serial.begin(57600);

    // Sets the number of 8-bit registers that are used.
    ShiftPWM.SetAmountOfRegisters(numRegisters);
    ShiftPWM.Start(pwmFrequency,maxBrightness);

    ShiftPWM.SetAll(0);
    }

    void loop(){

    if (Serial.available() >= 16) {
    // read the oldest byte in the serial buffer:
    for (int i=0; i<16; i++) {
    // read each byte
    incomingByte[i] = Serial.read();
    }

    ShiftPWM.SetOne(0, incomingByte[0]);
    ShiftPWM.SetOne(1, incomingByte[1]);
    ShiftPWM.SetOne(2, incomingByte[2]);
    ShiftPWM.SetOne(3, incomingByte[3]);
    ShiftPWM.SetOne(4, incomingByte[4]);
    ShiftPWM.SetOne(5, incomingByte[5]);
    ShiftPWM.SetOne(6, incomingByte[6]);
    ShiftPWM.SetOne(7, incomingByte[7]);
    ShiftPWM.SetOne(8, incomingByte[8]);
    ShiftPWM.SetOne(9, incomingByte[9]);
    ShiftPWM.SetOne(10, incomingByte[10]);
    ShiftPWM.SetOne(11, incomingByte[11]);
    ShiftPWM.SetOne(12, incomingByte[12]);
    ShiftPWM.SetOne(13, incomingByte[13]);
    ShiftPWM.SetOne(14, incomingByte[14]);
    ShiftPWM.SetOne(15, incomingByte[15]);
    }
    }
    Last edited by jtruax773; 10-05-2013 at 05:40 PM.

  2. #2
    Join Date
    Sep 2013
    Posts
    10
    Post Thanks / Like

    Default Re: Arduino Shift RGB LED Strips tip120

    So it's not the prettiest thing i've ever made, but it works great.. 24 channels (8 RGB), soldered on header pins to plug in an Arduino nano… same layout and code as above, just a permanent solution.. I've got a couple of sequences done, just need to hang the lights… this has bee a fun little project… very rewarding to see something you MADE yourself work.. Also got it working with Vixen 3


    WP_20131105_003.jpg
    Last edited by jtruax773; 11-14-2013 at 12:36 PM.

  3. Thanks thierryhl, macke thanked for this post
  4. #3
    Join Date
    Nov 2012
    Posts
    5
    Post Thanks / Like

    Default Re: Arduino Shift RGB LED Strips tip120

    I've been trying to come up with something very similar to this for a while and I just found what I think I need to get stuff working. Unfortunately, I dont really understand the shiftPWM library. So I think I will try and tailor this code for me! I have 8 595s and 6 TIP120s right now so I'll get something going. Thanks for sharing this I very much appreciate this!!
    2012: 8 Channel Arduino Setup.
    2013: A couple mini-shows.
    -6 Channel LED Show
    -8 Channel Mega-Style Mini Tree.
    2014: 72 Channels of Renard SS24s

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •