This week I decided to move onto the flashy part of my project (excuse the pun), which was to start playing with my NeoPixels or addressable RGB LED’s that use a WS2812 driver.
The purpose of the neopixels for my project is to provide a visual indication from afar of any customer requests and/or status change notifications.
So, as I’ve never used neopixels before, I thought to document some of my findings and my progress as I work through the process of getting them to work with my PSoC 6 BLE Pioneer board.
What are neopixels
Well, after a brief search online I found this instructables.com post, which to me made the most sense: http://www.instructables.com/id/Introduction-to-Neopixels/
Part 7 of this “instructable” provided me with a great link that gave me a concise rundown of the technical aspects: https://wp.josh.com/2014/05/13/ws2812-neopixels-are-not-so-finicky-once-you-get-to-know-them/
Finally, I came across this article, which I rather liked: https://www.embedded.com/print/4439133
Avoiding being dazzled by NeoPixels
Looking directly at illuminated NeoPixels is rather dazzling and certainly would not work in a bar or restaurant environment. As such I had to come up with a solution.
So, as part of my “goodies box” I had ordered two standard LED light bulbs, which cost no more than $1.50 each, in the hope that at least one of them would do the job of a NeoPixel light bulb holder if I hack out the existing LED and replace it with a NeoPixel or a pair of NeoPixels.
{gallery:autoplay=false} Light Bulbs |
---|
7W Dimmable GU10 LED Lamp, 530lm, 2700K (image source: 1031 - UNBRANDED - 7W Dimmable GU10 LED Lamp, 530lm, 2700K | CPC Ireland ) |
9W LED GLS Lamp, E27, 800lm, 3000K (image source: 2017 - UNBRANDED - 9W LED GLS Lamp, E27, 800lm | CPC Ireland ) |
Removing the connectors and wiring |
In the end the G10 light bulb fitting proved to be the easiest to open up and replace the existing LED. It also helped that the lens cap also could be readily removed and that a pair of NeoPixels fitted quite well, as shown.
I then used some Sugru (which is also available via CPC Farnell) to ensure that my NeoPixels remained in place and that the lens cap could also be secured. I then used a coffee cup as my light bulb holder (maybe this could be an option for disposable coffee cup reuse).
I was pretty pleased with the end result:
{gallery:autoplay=false} My New NeoPixel light bulb holder |
---|
Getting NeoPixels firmware to work
I was now onto developing my NeoPixel firmware for the PSoC 6, but before I jumped right in and got bogged down and confused, experience told me to apply a multi-phase approach.
So, phase 1 of my design approach, when working with any new untested sensor, is to start from a position of most familiarity. As there was an Adafruit NeoPixel library available for Arduino and I was most familiar with Arduino, I started here. And thank goodness I did, as one of the LED’s on my first pair of NeoPixels either got damaged when soldering or was already defective. This would have cost me time had I not checked.
This at least demonstrated that the G10 light bulb inside the cup holder provided the lighting effect I wanted. Here is a demo using the “strandtest.ino” example.
Then, for Phase 2, I moved to something more akin to the PSoC 6 as I could not find anything, by way of code examples or demos, online that could readily be used with a PSoC 6. I quickly found two projects for the PSoC 4 which I thought to try. These examples used a custom UDB component to handle the RGB LED’s and required adding in a custom library dependency.
http://www.cypress.com/blog/problem-solver/psoc-neopixel-tree-lights
This took a little longer to get it working, as I had to work out what to do but thankfully the documentation and online explanations were easy to understand, and once the application was generated and components updated in all the library and application files, it all came together pretty smoothly. So smooth in fact I upgraded it a little and added in a BLE component to change the lighting patterns. For this, I used the PSoC 4 BLE Find Me example and converted it to suit my need.
Here is the result. Basically, the program has a couple of different blinking patterns, which you can change by pressing the SW2 button on the board. For the BLE demo, when either a mid or high immediate alert is received it mimics the button press to get the same result. Sorry, the video contains no dialogue so hopefully it all makes sense.
I've included the PSoC 4 application code archive as an attachment.
Next step will complete phase 3
I’m now rather pleased with the progress I’ve made in getting to understand how to incorporate NeoPixels into my proof of concept design. The final phase, which will be done over the next two weeks or so, will be to port the PSoC 4 application to PSoC 6.
Top Comments