New High-Speed SPI Library for LPD8806 LED Strips

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
ceido
 
Posts: 18
Joined: Fri Sep 30, 2011 4:57 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by ceido »

This looks awesome! What exactly has been edited here? :oops: I have an Uno and a set of WS2801 12mm RGB LED Pixels. I'd like to get them running a bit faster. Could I use what's been applied here to get them to work in the same way? Thanks for any help in advance!

User avatar
cjbaar
 
Posts: 73
Joined: Fri Aug 26, 2011 5:58 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by cjbaar »

ceido--
I'm not sure how the data gets written to the WS2801 strips, compared to these... but someone has already written a library for those strips that use the SPI bus. This is actually what I based my work on for these strips. Check out: http://forums.adafruit.com/viewtopic.php?f=47&t=22858

ceido
 
Posts: 18
Joined: Fri Sep 30, 2011 4:57 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by ceido »

Thanks for your quick reply! I've got it up and running now! So much faster! :D

Phoenix
 
Posts: 3
Joined: Tue Jul 19, 2011 11:18 am

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by Phoenix »

Hey guys,

I've installed the Arduino 0022 software... and I have LPD8806 strips connected as per adafruit guide to my UNO.
I can verify and upload the standard LPD8806 script without problems plus it runs fine albit slow as expected.
Moving forward I replaced the standard LPD8806 script with cjbaar's SPI script. Verify and upload worked fine.. however nothing starts on the LED strips.
I don't know what to do next? I'm sure my Arduino software installed fine. :( any ideas??

DoctorDidj
 
Posts: 28
Joined: Fri Apr 27, 2007 9:30 am

SPI pins

Post by DoctorDidj »

Are you sure you've got the strip connected to the SPI pins (digital pin 11 data, digital pin 13 clock)? The SPI library will work only using those pins.

User avatar
cjbaar
 
Posts: 73
Joined: Fri Aug 26, 2011 5:58 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by cjbaar »

Phoenix--
The first thing that comes to my mind if you are switching from one library to the other is that they use different pins by default. If you used the defaults from the original library, you probably have your strip plugged into pins 2 and 3. The SPI library uses pins 11 and 13, so you would need to move the connection wires. (Because the library takes advantage of the SPI bus built in to the ATmega hardware, you do not get to choose the pins it uses.)

If you are already using pin 11 for data and pin 13 for clock, then please post some additional info about your environment.

Phoenix
 
Posts: 3
Joined: Tue Jul 19, 2011 11:18 am

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by Phoenix »

hehe Awesome! Thanks! :D

IceDog
 
Posts: 3
Joined: Fri Oct 14, 2011 4:27 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by IceDog »

I have a question about using this awesome high-speed SPI library with multiple strips.

I've seen that it's best to use multiple strips by demuxing the output; however, is it possible to demultiplex the SPI output. To do that, I would need another output (digital) to select the channel, but that digital out is too slow for SPI, correct?

mkomkom
 
Posts: 10
Joined: Mon Oct 17, 2011 4:42 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by mkomkom »

Hey, great work!

Can anyone tell me if the original library needs to be installed first? Thanks,

-Tyler-

User avatar
cjbaar
 
Posts: 73
Joined: Fri Aug 26, 2011 5:58 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by cjbaar »

IceDog--
I am not sure if I completely understand how you're setting that up, since I haven't personally played with multiplexing. To have multiple strips on the SPI bus, you need something that keeps the data line (at the very least) low for the strips you don't want to be talking to at the moment. So, yes, you would use one or more digital outputs for that... which would be slower than the SPI bus. Someone else here mentioned that they used AND gates -- in conjunction with a dedicated select pin for each strip -- to accomplish this.

The loss of speed would depend on how long the strips are, but I wouldn't it expect to be huge. The shorter the strips are, the more often you have to make the slower strip select call. If you have 32 LEDs on each strip, then you are making probably 2 digitalWrite() calls for every 832 SPI clock cycles (32x24 bits + 64 bits of "flushing")... which is relatively insignificant. You could, of course, replace the digitalWrite() calls with direct port manipulation to make them even faster (but the code becomes less portable).

Hope that makes sense. :)

User avatar
cjbaar
 
Posts: 73
Joined: Fri Aug 26, 2011 5:58 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by cjbaar »

mkomkom--
No; this is a replacement for the original library, so the original doesn't need to be installed first. In fact, since this was done as a fork from the original repository, it has exactly the same name... so you would overwrite the files anyway.

IceDog
 
Posts: 3
Joined: Fri Oct 14, 2011 4:27 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by IceDog »

cjbaar wrote:IceDog--
I am not sure if I completely understand how you're setting that up, since I haven't personally played with multiplexing. To have multiple strips on the SPI bus, you need something that keeps the data line (at the very least) low for the strips you don't want to be talking to at the moment. So, yes, you would use one or more digital outputs for that... which would be slower than the SPI bus. Someone else here mentioned that they used AND gates -- in conjunction with a dedicated select pin for each strip -- to accomplish this.

The loss of speed would depend on how long the strips are, but I wouldn't it expect to be huge. The shorter the strips are, the more often you have to make the slower strip select call. If you have 32 LEDs on each strip, then you are making probably 2 digitalWrite() calls for every 832 SPI clock cycles (32x24 bits + 64 bits of "flushing")... which is relatively insignificant. You could, of course, replace the digitalWrite() calls with direct port manipulation to make them even faster (but the code becomes less portable).

Hope that makes sense. :)
cjbaar,

Thanks for your helpful reply. Indeed, I'll use the direct port manipulation advantage.

User avatar
cjbaar
 
Posts: 73
Joined: Fri Aug 26, 2011 5:58 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by cjbaar »

Actually, after re-evaluating the math, I think the impact is even less. Since every SPI bit is replacing three digitalWrite() calls (set data, clock on, clock off), you're technically only adding two calls for every 2,496 SPI actions. Even without direct port manipulation on the select lines, I can't imagine this would be particularly noticeable.

physwm2501
 
Posts: 1
Joined: Thu Oct 20, 2011 1:07 am

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by physwm2501 »

which pins do I need to be using for this?

User avatar
cjbaar
 
Posts: 73
Joined: Fri Aug 26, 2011 5:58 pm

Re: New High-Speed SPI Library for LPD8806 LED Strips

Post by cjbaar »

The readme file contains more info, but generally it uses the MOSI line for data, and the SCLK line for the clock. On an Arduino Uno, this would be pins 11 and 13. The +5V and ground stay the same as in the original tutorial.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”