LED Strips


Closed Thread
Results 1 to 9 of 9

Thread: LED Strips

  1. #1
    Join Date
    Sep 2005
    Posts
    53

    Unhappy LED Strips

    Hi All,

    Has anyone tried to make a Controller for LED Strips?, the crazy part is most of the Controlling Chip Datasheets are all in Chinese and not easy to make out any useful information. So Far I can gather they use +5V/0V/DATA/CLK, so I assume you can control them via the Shift Out Command. I have tried some code but to none avail I can't seem to get the strip running or flash, can anyone give me some suggestions?, I have out some code below

    define OSC 32
    Define LOADER_USED 1
    Define LCD_DREG PORTB ' Define LCD connections
    Define LCD_DBIT 0
    Define LCD_RSREG PORTB
    Define LCD_RSBIT 4
    Define LCD_EREG PORTB
    Define LCD_EBIT 5
    DEFINE LCD_BITS 4 'LCD bus size 4 or 8
    DEFINE LCD_LINES 2 'Number lines on LCD
    DEFINE LCD_COMMANDUS 2000 'Command delay time in us
    DEFINE LCD_DATAUS 50 'Data delay time in us



    led1 var portc.0
    led2 var portc.1

    B0 VAR BYTE
    B1 VAR BYTE
    B2 VAR byte
    B3 VAR byte
    B4 VAR byte
    B5 VAR byte
    B6 VAR byte
    B7 VAR BYTE
    B8 VAR BYTE
    B9 VAR BYTE
    B10 VAR byte
    B11 VAR BYTE
    B12 VAR byte
    B13 VAR byte
    B14 VAR byte
    B15 VAR byte
    B16 VAR byte
    B17 VAR BYTE
    B18 VAR BYTE
    B19 VAR BYTE
    B20 VAR byte

    ADCON1 = 15 ' PORTA and E digital

    pause 100
    Lcdout $fe, 1,"DMX "
    Lcdout $fe,$C0,"CONTROLLER "

    goto startup

    STARTUP:

    Lcdout $fe, 1,"SHIFTOUT "
    Lcdout $fe,$C0,"ROUTINE "

    for b0 = 1 to 64
    shiftout led1, led2, 0, [%00000000/8]
    pause 500
    shiftout led1, led2, 0, [%10000000/8]
    pause 500

    shiftout led1, led2, 0, [%11000000/8]
    pause 500

    shiftout led1, led2, 0, [%11100000/8]
    pause 500

    shiftout led1, led2, 0, [%11110000/8]
    pause 500

    shiftout led1, led2, 0, [%11111000/8]
    pause 500

    shiftout led1, led2, 0, [%11111100/8]
    pause 500

    shiftout led1, led2, 0, [%11111110/8]
    pause 500

    shiftout led1, led2, 0, [%11111111/8]
    pause 500

    shiftout led1, led2, 0, [%11111111/8]
    pause 500
    Next

    goto startup


    END

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: LED Strips

    What LED part number? PBP version? PIC model? CONFIGS?

    Robert


    Edit: is port C digital?

    (Search AllDigital)
    Last edited by Demon; - 5th September 2014 at 01:00.

  3. #3
    Join Date
    Sep 2005
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: LED Strips

    I am using 18F8722,

    I have also tried PORT E as well,

    Please see attached details of the LED and the DMX Chip
    Attached Images Attached Images

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: LED Strips

    Can you blink a normal LED on the ports?

    Robert

  5. #5
    Join Date
    Sep 2005
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: LED Strips

    Hi Robert,

    Good question I will try that...and advise,

    -Gavo

  6. #6
    Join Date
    Sep 2005
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: LED Strips

    Hi Rob,

    Yes it does, I had to change the code a little, please see below:

    Include "MODEDEFS.BAS" ' Include Shiftin/out modes

    define OSC 32
    Define LOADER_USED 1
    Define LCD_DREG PORTB ' Define LCD connections
    Define LCD_DBIT 0
    Define LCD_RSREG PORTB
    Define LCD_RSBIT 4
    Define LCD_EREG PORTB
    Define LCD_EBIT 5
    DEFINE LCD_BITS 4 'LCD bus size 4 or 8
    DEFINE LCD_LINES 2 'Number lines on LCD
    DEFINE LCD_COMMANDUS 2000 'Command delay time in us
    DEFINE LCD_DATAUS 50 'Data delay time in us



    led1 var porte.0
    led2 var porte.1

    B0 VAR BYTE
    B1 VAR BYTE
    B2 VAR byte
    B3 VAR byte
    B4 VAR byte
    B5 VAR byte
    B6 VAR byte
    B7 VAR BYTE
    B8 VAR BYTE
    B9 VAR BYTE
    B10 VAR byte
    B11 VAR BYTE
    B12 VAR byte
    B13 VAR byte
    B14 VAR byte
    B15 VAR byte
    B16 VAR byte
    B17 VAR BYTE
    B18 VAR BYTE
    B19 VAR BYTE
    B20 VAR byte

    ADCON1 = 15 ' PORTA and E digital

    pause 100
    Lcdout $fe, 1,"DMX "
    Lcdout $fe,$C0,"CONTROLLER "
    pause 2500
    goto startup

    STARTUP:

    Lcdout $fe, 1,"SHIFTOUT "
    Lcdout $fe,$C0,"ROUTINE "

    for b0 = 1 to 64
    shiftout led1, led2, 0, [%00000000]
    pause 500

    ;shiftout led1, led2, 0, [%11111111]
    ;pause 500

    Next B0

    goto startup


    END

  7. #7
    Join Date
    Sep 2006
    Location
    Indiana, USA
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: LED Strips

    I have a bunch of experience with the WS2801 based strips, which you can run using shiftout pretty easy. You basically shift in your bits on the data line with each pulse of the clock line if i remember correctly something like this for the WS2801 Strips (my favorite):

    Code:
    noLEDs           CON   32         ' Change this number to number of LEDs in your strip
    
    shftMode        CON   1           ' Shift data out highest bit first. Clock idles low
    
    LEDsDAT         VAR PORTE.0   ' Shift out data port, change as needed
    
    LEDsCLK          VAR PORTE.1   ' Shift out clock port, change as needed 
    
    i                    VAR    Byte     ' Loop variable
    
    Main:
    
    FOR i TO noLEDs                   ' We have to either shift allllllllll the data bits out at once to all LEDs in one SHIFTOUT or for one RGB LED at a time in a loop, much easier this way!, lots of ways to do this.
    
    SHIFTOUT LEDsDAT, LEDsCLK, shftMode, [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] 'Shift out 24 bits to one RGB LED at a time - should be all LEDS ON (can be varibles too)
    
    NEXT i                               ' Loop till all LEDs loaded
    
    i = 0                                 ' Please be kind, rewind.
    
    PAUSE 1000                      ' For human eyes to be able to see that them LEDs are ON
    
    FOR i TO noLEDs                ' Rinse, Repeat - but turn them all off this time
     
    SHIFTOUT LEDsDAT, LEDsCLK, shftMode, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] 'Shift out 24 bits - should be all LEDS OFF (can be varibles too) 
    
    
    NEXT i                           ' A little loopy                             
    
    PAUSE 1000                    ' For human eyes to be able to see that them LEDs are OFF (ever wonder if the fridge light is still on when you close the door?)
                   
    GOTO Main                     ' Do it till the cows come home!
    
    END                              ' My only friend, The end... (fridge door, The Doors, whatever)
    The problem is a lot of newer strips use weirder data protocols which are very timing sensitive. You can make them work, but your PIC is probably going to be dedicated to that, with another pic telling it what to do without a lot of work with interrupts and assembly. Thats why I try to stick to WS2801s

    ALSO! if you are driving a bunch of LEDs on your strips, like 32/M in my example, you have to have enough current to drive your strips!!! you also may need to buffer the data and clock lines to be able to drive a bunch of LED controller chips too!!!

    -Ryan
    Last edited by Ryan7777; - 9th September 2014 at 19:49.

  8. #8
    Join Date
    Sep 2005
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: LED Strips

    Hi Ryan,

    Thanks for the reply, I am sure I have one of those obscure ones, the crazy part is it flashes no problems without the 5V PSU Connected to it, the only problem is there is not enough current so it is really dim. The Minute we connect the 5V the strips stays on very bright, for the exception of 1 led with flashes on/off

    See the connection below,

    Regards,

    Gavin
    Attached Images Attached Images

  9. #9
    Join Date
    Sep 2006
    Location
    Indiana, USA
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: LED Strips

    After reading what I could of the datasheet, this looks like a variant of the WS2801 to me.

    Also looking closer at your code, you may need to set your TRIS to output and input on the proper pins. Something I neglect to do all the time, and sometimes stuff will work without it. But most of the time it's the one thing biting me when my code doesn't work.

    I don't know about the pic you're using and don't have the time at the moment to look, but if it has capture and compare modules, those may need switched off too. And again, sometimes simple things like flashing an LED on a pin works great, but try to do anything more demanding and the CCPs and whatever else, ADCs etc. trip me up. So just because you got an LED to blink doesn't always mean everything else is working. Believe me, I know! If there is some unthought of register that needs set, I'll probably forget it and be scratching my head for hours as a result

    I have cooked one strip of WS2801 LEDs before by getting some wires crossed. But they are really fairly robust. It's probably only one chip that failed too, so it may just need cut off the string, finding it is another matter. And getting wires crossed is pretty easy as blue is +V and Red is like data or clock, I forget. Black is Vss I'm pretty sure.

    At this point I'd get your LCD going and maybe take every pin and set it up as an input and display something like PortB.3 = 1 when you connect an input. For each pin. And do the opposite as well, hookup an LED to every available pin and have them run back in forth like the whole nightrider thing. In other words, make sure your PIC is working first!!!

    -Ryan

Similar Threads

  1. Addressable RGB LED's & LED strips
    By spcw1234 in forum General
    Replies: 24
    Last Post: - 17th December 2017, 09:56
  2. Free LED lights and LED strips
    By mistrip in forum Adverts
    Replies: 0
    Last Post: - 18th May 2012, 04:44
  3. LED Bargraph chip (guitar LED bling-age) ..do with a PIC?
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 12th July 2009, 23:15
  4. Replies: 3
    Last Post: - 5th December 2008, 15:00
  5. Led + resistor ?
    By ruijc in forum General
    Replies: 7
    Last Post: - 10th March 2008, 20:33

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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