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.
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 !
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.
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.
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.
@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.
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?
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.
@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 ?
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
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.
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.
When you archieve a project, it will put the libraries that you have been using in a sub-directory under your workspace.
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.
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.
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.
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.
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.
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:
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.
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!
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 !
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.
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)
When running the following code:
StripLights_ledArray  = 0x0000000F;
StripLights_ledArray  = 0x000000F0;
StripLights_ledArray  = 0x00000F00;
StripLights_ledArray  = 0x0000F000;
StripLights_ledArray  = 0x000F0000;
StripLights_ledArray  = 0x00F00000;
StripLights_ledArray  = 0x0F000000;
StripLights_ledArray  = 0xF0000000;
StripLights_ledArray  = 0x00000000;
StripLights_ledArray  = 0x00000000;
StripLights_ledArray  = 0x00000000;
StripLights_ledArray  = 0x00000000;
while( StripLights_Ready() == 0);
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?
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.
I have also attached the configuration for the component.
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?
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.
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
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.
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.:
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?
Compiling without errors now!!! I 'assumed' that update would update all components , including library. Lesson learnt , fun to begin.
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:
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.
Example Projects: FunWithLEDs.zip
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.