Introducing WS2803Due library

Hello everyone! This is my first post here on the forum, but I have am an avid reader of these and other similar forums. This is also my first open source library, any input is greatly appreciated.

My last big project involved an Mega 2560, additional RAM chip, Bluetooth, 72 RGB LEDs, and 12 WS2803 LED drivers.

I had a need for fast LED switching, so I started digging and looking at available libraries. At first I made a few modifications to some library I found, but that was not fast enough. The more and more I used the library I found many short comings and slowly modified it for speed. When the Arduino Due was released I quickly snapped one up and started porting code. This is strictly a hardware SPI library, there is no option for softSPI.

The biggest thing that I realized with the other libraries available for this chip is that they use a 1 milisecond delay for latching the data, which is way too long for my needs and the requirements of the chips. I made it so that the user can define external latching to reduce that 1 milisecond delay down to 400 microseconds, or better yet, use proto-threading to get more accomplished rather than have a delay.

All of the necessary information to get started is located in the README file, and there are a few examples locate in the.... examples folder!

Hope someone can get some use out of this!

rbqaa,

Thanks for sharing your project code! Looks to be a really nice library you got there. What kind of applications are you using it for with sub 1ms speed? I can imagine a few but just curious of how your using the library and what application, knowing more could get more people on board and using it and adopted further.

Thanks for the great documentation too, so many projects are just a pile of code with no instructions on how to use it, it's great that you took the time to really polish up the documentation!

You are very welcome. I am glad to hear that the documentation was readable and appreciated. The reason that I spent time on the documentation is because it makes such a difference for others who want to use it. I have used many libraries where there is little to no documentation and it generally makes for a steep learning curve, which in my mind is the opposite of what an open source library should be. I believe in putting in the extra time to document something well so that others can use it with minimal effort and learning curve. Thank you so much for your feedback.

I will be making a post soon about the project once I get it clearly documented. The project is an RGB POV display that was originally based off the Mega 2560, but the RAM and Flash limitations made it very difficult to do what was needed. I was getting spectacular results but outgrew the Mega pretty much before I even finished the project. Right now the proof of concept with the Mega turned out phenomenal, and it is in the awkward between stage of being transferred over to the ARM architecture.

If you are interested in looking at flashy bright lights, here is a link to the project that inspired the library.

http://arduino.cc/forum/index.php/topic,152260.0.html

Just ran some time comparisons on the library. Here are the results using external versus internal latching. As expected the results were great!

Parameters:

  • 36 RGB pixels, which makes a total of 108 individual LED filaments.
  • Brightness from 0 to 255 of each individual LED
  • 27,540 updates per test ( strip.show() )

Latching comparison test:
External Latching at 400uS: 15809 milliseconds
Internal Latching at 1 millisecond: 27540 milliseconds

If you have need for fast updates, use the external latching option. Here is a youtube video of the test being performed.

The first run through is the external latching, and then the second run is the internal latching.