New High-Speed SPI Library for LPD8806 LED Strips
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 18
- Joined: Fri Sep 30, 2011 4:57 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
This looks awesome! What exactly has been edited here? 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!
- cjbaar
- Posts: 73
- Joined: Fri Aug 26, 2011 5:58 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
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
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
-
- Posts: 18
- Joined: Fri Sep 30, 2011 4:57 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
Thanks for your quick reply! I've got it up and running now! So much faster!
-
- Posts: 3
- Joined: Tue Jul 19, 2011 11:18 am
Re: New High-Speed SPI Library for LPD8806 LED Strips
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??
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??
-
- Posts: 28
- Joined: Fri Apr 27, 2007 9:30 am
SPI pins
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.
- cjbaar
- Posts: 73
- Joined: Fri Aug 26, 2011 5:58 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
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.
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.
-
- Posts: 3
- Joined: Tue Jul 19, 2011 11:18 am
Re: New High-Speed SPI Library for LPD8806 LED Strips
hehe Awesome! Thanks!
-
- Posts: 3
- Joined: Fri Oct 14, 2011 4:27 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
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?
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?
-
- Posts: 10
- Joined: Mon Oct 17, 2011 4:42 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
Hey, great work!
Can anyone tell me if the original library needs to be installed first? Thanks,
-Tyler-
Can anyone tell me if the original library needs to be installed first? Thanks,
-Tyler-
- cjbaar
- Posts: 73
- Joined: Fri Aug 26, 2011 5:58 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
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.
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
- Posts: 73
- Joined: Fri Aug 26, 2011 5:58 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
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.
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.
-
- Posts: 3
- Joined: Fri Oct 14, 2011 4:27 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
cjbaar,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.
Thanks for your helpful reply. Indeed, I'll use the direct port manipulation advantage.
- cjbaar
- Posts: 73
- Joined: Fri Aug 26, 2011 5:58 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
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.
-
- Posts: 1
- Joined: Thu Oct 20, 2011 1:07 am
Re: New High-Speed SPI Library for LPD8806 LED Strips
which pins do I need to be using for this?
- cjbaar
- Posts: 73
- Joined: Fri Aug 26, 2011 5:58 pm
Re: New High-Speed SPI Library for LPD8806 LED Strips
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.
Please be positive and constructive with your questions and comments.