NeoPixel (WS2811/12) component

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
MarkH_61
Employee
Employee
25 likes received 50 replies posted 25 replies posted

A while back I posted some projects using a component I created for the WS2811/12 RGB LED modules.  I have added some updates including supporting both the WS2811 and WS2812.  Attached is a PSoC Creator workspace that include two projects and the StripLights library.                      Project “P4_OneRing” controls a single ring of these LED modules.  The second project “P4_MultiRings”, allows you to string multiple rings together to make your own very cool string of circular lighted ornaments. 

   

We have a special Black Friday sale coming up this Friday to discount the PSoC 4 Pioneer Kit so you can make your own creation and afford to pick up some of these lights.

   


   

Happy Holidays.

   

Mark Hastings

66 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I ordered some led rings to try this out on, thanks for the post.

   

 

   

This would make a nice PRoC application.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hello Dana,

   

I'm currently trying to adapt FunWithLeds project to a PRoc CYBLE module to drive a string of 22 neopixels.

   

I'm encountering problems to do this (striplights not compatible with selected device..).

   

You're the only comment in forums about ws2812 and PRoc module, so I was wondering if you may have some tips to help me.

   

Sorry about bothering you with my problem, but you are the only one talking about this on the web, so  I thought you may have a clue.

   

 

   

Thank you for your time, and have a good day !

   

 

   

Hugo.B

0 Likes
DiBr_284171
Level 2
Level 2
First question asked 10 replies posted 5 replies posted

Mark thanks for the Post! I find the NeoPixel (WS2811/12) component a neat and very useful component. I would like to use the “P4_OneRing” to controls Adafruit neopixels LEDs not necessarily connected in a ring. One requirements is to be able to modify the Strip_Lights component "LEDS_per_Strip" parameter at run time. Any suggestios or guidance on how this coud be done would be appreciated.

   

Regards,

   

James

0 Likes
MarkH_61
Employee
Employee
25 likes received 50 replies posted 25 replies posted

James,

   

You can just make the "LEDs_per_Strip" the maximum that you will use.  This parameter is used to allocate SRAM for the buffer, so changing it on the fly may not work with malloc since the entire SRAM buffer needs to be contiguous. The down side is that you take up more memory, and it will update more LEDs than you actually have, which takes longer.  You can update 1000 LEDs in 30ms so it's not a big problem, plus the ISR only requriees about 12% of the CPU.

   

 

   

Mark

0 Likes
DiBr_284171
Level 2
Level 2
First question asked 10 replies posted 5 replies posted

Mark,

   

Your suggesting will work since I only require a maximun of 25 LED.

   

Thanks,

   

James

0 Likes
Anonymous
Not applicable

 Thanks for this post and the component.

   

 

   

I'm new to soc community component and I not able to find how to install the component you provide (striplightlib.cylib) to be used in my own projet ?

   

 

   

Can you provide me a basic help ?

   

 

   

Thanks a lot.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

This should help -

   

 

   

    

   

          https://www.youtube.com/watch?v=cEAEk-HRib8

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

I tried following that video for importing the component, and it complains that it cant find the componet's

   

so I'm not doing something properly. help!

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

@meh, I tried to import from your archive, no luck. Followed the video

   

on Cypress website.

   

 

   

So then I exported component (your top schematic) into a new archive,

   

that worked. But then I did an import into a new project, compiled, and

   

get mismatching data types on the data line net. Also I noticed the import

   

only brought in part of the funlib, missed two other component versions

   

shown in that lib when I open your original posted archive....?

   

 

   

Additionally after import I wind up with 3 top level schematics in work space,

   

seems a little confusing.

   

 

   

   

 

   

Any possibility this could be cleaned up ? Seems like a highly useful

   

component in todays LED lighting world. A simple import into a users

   

design would be very useful I would think.

   

 

   

Regards, Dana.

   

 

   

0 Likes
Anonymous
Not applicable

I think part of the issue is that this component isnt compatable with 3.2 of creator, 3.1 and it loads at least. havent tried to use it yet.. need a 32khz watch crystal for what I want. will a 12.5 load crystal work with the 22pf caps on the 059 dev board? 

0 Likes
lock attach
Attachments are accessible only for community members.
MarkH_61
Employee
Employee
25 likes received 50 replies posted 25 replies posted

Yes, the Strip Light Controller is compatible with PSoC Creator 3.1 and 3.2.  When you get an error like what is shown, it means that your dependencies are not correct. 

   

 

   

1) Right click on the project name in the Workspace Explorer and select "Dependencies".

   

2) Look under "User Dependencies", if the "StripLightLib" is not shown you need to add it.

   

3) To add a library to the project, click on the folder icon to the right of "User Dependencies".

   

4) Navigate to the location at which you have stored the library and select "StripLightLib.cyprj".  It should be a file inside a folder of named "StripLightLib.cylib".

   

5) Press "OK" and you should be ready to go.

   

I attached the latest released version.

   

Mark

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

@meh, just to confirm, then if I want a single project folder that I point

   

to in Dependancies I extract the project archive to the principal

   

design folder for the overall project ? Then set the dependencies.

   

This way I would avoid having a folder outside workspace that

   

would, if clobbered, moved, etc.. would not hose the design ?

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

This might help, and incorrect cap loading may or may not start up

   

osc, and certainly will result in a freq deviation from spec sheet.

   

 

   

    

   

          http://www.cypress.com/?rID=37884     AN54439 - PSoC® 3 and PSoC 5LP External Crystal Oscillators

   

 

   

Regards, Dana.

0 Likes
MarkH_61
Employee
Employee
25 likes received 50 replies posted 25 replies posted

You can put a library folder almost anywhere.  I have a folder in my Windows computer that I keep all my libraries in so that I can use them with multiple projects.

   

MEH/My LIbs/PSoC_Creator/

   

I keep all my custom Creator libraries there so I don't need to go looking in specific projects for them and I have just one copy of the latest that way.

   

MEH/My LIbs/PSoC_Creator/StripLightLib.cylib

   

When you archieve a project, it will put the libraries that you have been using in a sub-directory under your workspace.

   

 

   

Mark

0 Likes
Anonymous
Not applicable

keep up the good work, waiting on parts to actually try to see if my code works or not. I"m going to build a simple neopixel ring clock, using a 24 and 60 led rings.. using 2 copys of this component and the RTC component, and a uart one to read a gps to get the time set. I dont feel like trying to code my own switches for setting, but I will do that if I can get the gps to give me the time.

0 Likes
Anonymous
Not applicable

Very nice work, I like it.

   

One question: Is it possible to set the dimming for each individual LED? I only found the function which sets the dimming for all Leds.

   

Regards,

   

Amin

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

The ws2811 / 12 have individual LED brightness control, 8 bit.

   

 

   

Can't speak for the component however. If it does not you could always

   

modify the component and create your own.

   

 

   

Regards, Dana.

0 Likes
MarkH_61
Employee
Employee
25 likes received 50 replies posted 25 replies posted

Each individual pixel can be what ever value you want if you don't use the lookup table mode.  The lookup table mode was just so I didn't need 24 (32 bit word) for each pixel when I had a display that took more memory than I had.  When not in the lookup table mode, you can directly control all 24 bits for every LED, therefore dim each one individually.

   

 

   

Mark

0 Likes
Anonymous
Not applicable

This will help, thanks, Amin

0 Likes
Anonymous
Not applicable

thanks for a awesome component, the demo worked the first time on my psoc5lp $10 devboard 🙂 now to wait for the rest of the parts. thanks again.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Dupe post, being handled here -

   

 

   

http://www.cypress.com/forum/psoc-community-components/ws2812-and-5lp-48-mhz#comment-291991

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hi Mark,

   

Thanks for the great component, Ive had a lot of fun playing with it.  Are you still working on the DMA version for 5L  chips ?

   

I'm doing a color organ strip that needs real time updating and it doesn't keep up with the music and misses beats .  I'm working with a 300 light strip. Any ideas on how I can speed it up ?

   

 I tried using the component ready bit to trigger an ISR so the updates would happen as soon as the last transfer finished but haven't got it to work that way.   For now I have a SAR SEQ component running continuously storing to an array.  When the API  StripLights_Ready() indicates ready I process the Data into three channels, write the whole 300 lights to the buffer in one piece and call the StripLights_Trigger()  function.  I tried processing the data ahead of time and waiting for the ready signal to transfer but it ws actually slower.

   

One last question.  I want to add user controls (pots) that would only need to be read on a 100 mS rate.  With the SAR ADCs  would it be more efficient to use a second ADC and just trigger it when needed or just add a few more channels to the existing continuous process.

   

The existing ADC  sampling runs very fast and doesn't seem to be  much load.  

   

Thanks again for sharing your striplight project,  I would always rather use a PSoC and didn't want to have to use an Arduino. 

   

 

   

Have a great day.

   

Jim

0 Likes
Anonymous
Not applicable

If you're still looking, I developed a DMA based neopixel driver component last year before I searched for solutions by others. I've not yet mastered the packaging of components into libraries, so it exists as an example project and not as a library, but you can find it here:

   

https://github.com/PolyVinalDistillate/PSoC_DMA_NeoPixel

   

It was only afterwards that I thought to have a look and see what other people had created. Anyway, my component is complete with a very basic API to start the component and copy, via DMA, a framebuffer onto the neopixel chain.

0 Likes
Anonymous
Not applicable

This is actually the first time I am commenting on an article online.I found this to be very clear, informative and precise. It was an easy read and it definitely helped me to understand how the manifest file works. Great job!

0 Likes
Anonymous
Not applicable

Hello meh !

   

I bought a cypress PRoc eval board (http://www.cypress.com/documentation/development-kitsboards/cyble-012011-eval-ez-ble-proc-evaluation...), and I'm not able to use neopixel component.

   

I've got the following error : "Component 'StripLights_v2_2' is not supported by the selected device."

   

Would you have any idea that could help me make it work?

   

Thanks a lot, and have a good day !

0 Likes
MarkH_61
Employee
Employee
25 likes received 50 replies posted 25 replies posted

Balette-pape Hugo,

   

The problem is that the PRoC parts have limited hardware and no UDBs (Universal Digital Block) which are used for the interface to the WS2811/12 parts.  The PSoC 4 BLE modules such as the CYBLE-014008-00 do have UDBs and should work.  If you are new to BLE or to PSoC BLE, the CY8CKIT-042-BLE kit contains one PSoC and one PROC BLE module plus a built in programmer AND a USB dongle to plug into your PC to debug with.  It is $49 but is worth it for all the hardware you get.

   

 

   

Mark

0 Likes
Anonymous
Not applicable

Mark,

   

Thanks for putting the effort in to this fun side project.  I'm running this on a CY8C4247LQI-BL473.  I had to change the clock type on the "StripLights_v2_2.cysch" to version 2.20. Currently I'm running at 48MHz HFCLK, but I also ran at 40MHz with the same resutls.

   

I've got the strip lights component set to the following: 

   

RGB (24 bit)

   

High speed

   

Interrupt

   

WS2812

   

When running the following code:

   

    StripLights_ledArray[0] [0] = 0x0000000F;
    StripLights_ledArray[0] [1] = 0x000000F0;
    StripLights_ledArray[0] [2] = 0x00000F00;
    StripLights_ledArray[0] [3] = 0x0000F000;
    StripLights_ledArray[0] [4] = 0x000F0000;
    StripLights_ledArray[0] [5] = 0x00F00000;
    StripLights_ledArray[0] [6] = 0x0F000000;
    StripLights_ledArray[0] [7] = 0xF0000000;
    StripLights_ledArray[0] [8] = 0x00000000;
    StripLights_ledArray[0] [9] = 0x00000000;
    StripLights_ledArray[0] [10] = 0x00000000;
    StripLights_ledArray[0] [11] = 0x00000000;

   

       while( StripLights_Ready() == 0);
       StripLights_Trigger(1);

   

 

   

I get this on the LEDs:

   

   

 

   

That is green, red, off, green, red, off, green, red off, green, red, off

   

If I change the "color" value I do get color changes, but I've not been able to make sense of it yet.  I've tried changing component parameters with no success.  Any pointers?

   

Thanks,

   

-Keith

   

 

   

 

   

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I can't get the LED color to make any sense or do anything repeatable.  I have 4 individual LEDs set up as one strip, here is the pseudo code for what I am trying to do to get the first LED in the strip to turn on.  I am not doing anything in an interrupt or anything fancy, just want to be able to change the color of an LED.

   

 StripLights_Start();
 StripLights_Pixel(0,0,0x00FF00FF);
 StripLights_Trigger(1);

   

I have also attached the configuration for the component.

0 Likes
Anonymous
Not applicable

Thank You Mark!

   

Works like a charm!

0 Likes
Anonymous
Not applicable

Thanks for a useful component Mark.

   

I'm using the Striplight Library on CYBE-014008-00 Eval board in CY8CKIT-042-BLE.

   

All good driving WS2812B strips until I add a BLE component to the design. As soon as I run CyBLE_ProcessEvents() the update of the pixel string stops (randomly stops, sometimes immediately, sometimes after many seconds, sometimes half way through a string update). Tried disabling interrupts in critical sections etc but no luck. Can run separately BLE event handling without striplight updates and vice versa with no problem using same code. Just a problem when I try to handle both udpates within main(). I've had CyBLE_ProcessEvents() polled and also interrupt driven off a timer but have same issue. I'm only driving 30 pixels, 24-bit so unlikely to be memory allocation problem.

   

When the crash happens, a connected bluetooth device can still have its message events processed so processor is still running with interrupt handling of CYBLE_EVT_GATTS_WRITE_REQ but I can't seem to be able to drill down into what's causing the library to malfunction during the pixel string udpate. I suspect CyBLE_Gapp_Start_Advertisement may be the trigger of the problem.

   

Any pointers Mark what may be interacting between the striplight library and BLE? 

   

Thanks

   

'Dyenamic'

0 Likes
Anonymous
Not applicable

OK, Think I sorted it. Looks like the striplight component wants a higher priority for its ISR (Striplights_isr). I gave it a priority of 1 rather than default (3) and now have BLE running with Striplight component. BLE event handling is being done by a timer interrupt with priority 3. Also have uart interrupts at level 3.

0 Likes
stco_1575631
Level 2
Level 2
10 replies posted 5 replies posted 5 sign-ins

Hi Guys, Im a newbie to PSOC,  Is this project compatible with creator 4.1? Tried downloading for PSOC4 but compiles with errors, major one being Cannot find CyControlRegv1.7.

   

I REALLY want to use with a PSOC5 059 kit. I also downloaded latest library (from this post) started a new project ( for 059) and set up schematic from lib (I.e. dependancies set OK I think). Then Copying main from original. This caused even more errors including cant find clock, and above.

   

Is it me or 4.1? Any help greatly appreciated

   

 

   

Steve

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, Steve!

   

The update process must be divided into two steps: at first you need to update the striplight component itself to latest. Then you need to update the project which uses the component.

   

When you have got the complete sources you can build a workspace bundle and upload it here. Someone might help you with the update.

   

 

   

Bob

0 Likes

Hi Bob, thanks for your reply, unfortunately I don't fully understand your instructions. I thought I had to open a project BEFORE I can update as here.:

   

 knowledge-base-article/updating-psoc-creator-components

   

This I have done, and updated components. When I try to compile it says CyControlRegv1.70 not found. Maybe I still dont understand update process.

   

Has anybody used this library with Creator4.1 and PSOC5, and any chance of a file?

   

Thanks

   

 

   

Steve

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

1. Download the sources from here.

   

2. Open the library project "StripLightLib..."

   

3. Update components.

   

4. Open example, update components...

   

Have fun

   

 

   

Bob

0 Likes
stco_1575631
Level 2
Level 2
10 replies posted 5 replies posted 5 sign-ins

Thanks Bob,

   

Compiling without errors now!!! I 'assumed' that update would update all components , including library. Lesson learnt , fun to begin.

   

 

   

Steve

0 Likes

Is there some special way to open the library project to be able to update the components in it?  When I double-click on StripLightLib.cyprj, what I get is pretty empty:

pastedImage_0.png

0 Likes
MarkH_61
Employee
Employee
25 likes received 50 replies posted 25 replies posted

Well finally after a couple years I finally got around to updating StripLights (NeoPixel) component, version 3.0.  This new version requires PSoC Creator 4.1 and I have added a couple new features, such as supporting 16x16 panels, SK2812RGBW modules, wrapping a single string around a cylinder with an X-Y coordinates system, and several X-Y coordinate translations to make orientation easier.  The newer versions of Creator make it much easier to have a user friendly customizer.  I have changed the library name to WS281xLib.cylib to make it a bit more descriptive, but everything else should be backwards compatible. Anyway have some fun and if you come up with some cool projects, let me know.  Here are the download links.

Library:  WS281xLib.cylib.zip

Example Projects: FunWithLEDs.zip

Datasheet: StripLights_v3_0.pdf

Mark

Anonymous
Not applicable

Is it possible to switch the LED type on the fly using the software API? I want to be able to switch between controlling rgb and rgbw type LEDs in the application.

0 Likes