Particle Photon/Spark Core RGB WS2812B

The title says it all. I have created a device type to interact with the Particle Photon/Core. I have also created a Photon/Core firmware that will interact with this and use the Neopixel.h library.

Firmware and device type can be found here:

This creates an extremely cheap set of RGB lights that can interact with Smartthings.
What you will need:
Photon/Core $20


WS2812B rgb light strip
These worked great for me http://www.amazon.com/Addressable-Strip-WS2812B-meters-meter/dp/B00JSJSBZK/ref=lp_9219252011_1_1?srs=9219252011&ie=UTF8&qid=1443029994&sr=8-1
Bread board or soldering iron

Notes:
The WS2812B is a great rgb for dev boards as it runs at 5v and in the case of the photon can run directly off of vin if you are supplying usb power or you can split an outside power supply to support both the strip and photon.

To setup wiring

  1. Run ground wire on strip to ground on photon
  2. Run data line on strip to D2 on photon
  3. Run +5v on strip to VIN on Photon

It is good to note that depending on your wall wart or power supply you will need to do some caclulations based on the amperage of your ps. Typically the WS2812B 30 led/m strips use around .6 amp per meter. So if you have a 2amp wall wart you should be able to comfortably run about 3 meters off of the VIN without an additional power supply. 9 feet of light is a good amount in my opinion and puts out a lot of light, so I feel this is very acceptable.

I have setup ā€œONā€ to display a color wash and then set to a slightly off white (Feel free to change the firmware code as you see fit) Additionaly there are pick colors that you can modify to your hearts content.

This is a first version of this code I would actually like to make this a little more variable with an RGB color wheel, but my home theater desperately needs some accent lighting and it told me I needed to have something up and running. I am always welcome to changes so feel free to pull and request merges based on improvement to code. (Iā€™m not the best coder out there and I know it! :wink:

Credits:
I have taken tidbits of code from @dome, @juano2310 and Phil Burgess for the neopixel.h and neopixel.cpp.

Oh and I am really excited about this. As I can now do interactive under cabinet lighting and home theater lighting for under $30 per strip.

Please let me know any feedback or thoughts. I am always open to that. (now that my basement(home theater) is done I should have some more free-time (oh wait we are having a baby in 3 weeks so maybe a little free-time).

14 Likes

Those strips are EXPENSIVE! Hell I think even Adafruitā€™s strips are cheaper but yes otherwise this is awesome!

Itā€™s 5 meters of strip. 15 feet of light. That is about the cheapest you will find for WS2812B. And adafruit while I do try to support them have only 1m strips for around $16 I believe.

Luckily for me that is enough to supply about 4 -5 photon/core setups. Which when you break it down is about $30 per setup. Which is way less than even the z-wave or fibaro RGB controllers which are still way less in price than Phillips Hue.

Yep theyā€™re about $17/m but that being said with the Fibaro/Dresden setup you can get strips with twice the density of LEDs for a lot cheaper, i.e. 60leds/m and 5M for about $15

That being said if I was shopping for WS2812B or APA102 strips itā€™s the one time Iā€™d shop on Ebay or more likely AliExpress. If you shop smart you can get 5m WS2812B/APA102 strips for MUCH less.

1 Like

Updated some code. I cleaned up the spark firmware as well as I believe the while statements were causing a memory leak that was causing an error on Spark.

I am really happy with this solution. It works extremely well and I have tied the on/off function to a z-wave wall switch. I will put up some video later tonight (hopefully).

My next steps are to incorporate the kodi/xbmc callbacks scripts to send commands to dim these lights on play/resume and to set them to full brightness on pause/stop. The home theater is getting a fun automated upgrade with this.

Here is video. I set the lower to have a chase sequence and the uppers to just turn on.

2 Likes

@jjhtpc, nice work! Looks great. At some point I might play with addressable strips. Right now my priorities are elsewhere (like finishing my basement remodel). :smile: That, and trying to get a Photon working with incoming events.

I have updated the code for this and added the enerwave 7 button scene controller with a modified smart app to control the Particle Photon.

Here is a video of a terrible cinematographer capturing the button presses, basement kitchen waiting for countertops and the under-cabinet lighting powered by the photon:

3 Likes

@jjhtpc - Have you been successful with receiving data from the Photon? Using your code as an example, Iā€™m now comfortable with sending commands from ST to the Photon. However, Iā€™m not able to receive variable data that from devices the Photon is controlling like a sensor. It might be useful to report on something like a confirmation status letting me know if a pin is HIGH or LOW. Anyway, Iā€™m interested to hear if youā€™ve made progress in this area. Oh, and the lighting looks great! Thanks again!

I have not worked on it mostly because from a use perspective I have used the particle rgb as home theater accent lighting. In these cases my usage calls for commands to be run and I am present and see the result. Also I call these commands through KODI cinemaexperience and I am not using the smartthings app to interact. I do see a usefulness in the status if you are using the app or using a dashing display to interact with them, but for my purposes thus far I have been only command driven. I am planning on adding three sets of these as undercabinet lighting in my main kitchen and while the basement kitchen has the enerwave 7 button to control it(again very command driven) but I could see using a combination of the echo and a dashing display to interact with the upstairs kitchen lights. So this may be something I take on in the next month or so.

HI

I am at a lost to try this for my Photon.
Where do I start and what files do I flash?

Thanks

Did I not include the github for this?

Hi Justin

No, you have. But I am getting compile errors trying to compile the code. There are many files in this Github.
Which ones should I use to compile with and to get all the LEDS to light up?
I do not care so much about the different colors (yes, thatā€™ll be a bonus), but I just want white leds under my kitchen counters.
Sorry to bother you with this stupid question, but I really am lost.
Thanks for your help.
Bert

Sure let me see if I can help.

Fit the photon you will need the kitchen rgb firmware:

The neopixel.h:
https://github.com/jjhtpc/Photon-RGB/blob/master/photon%20neopixel.h

And the neopixel.cpp:

Those three files make up the photon firmware.
It is good to note you will need to change the number of pixels in the kitchen photon firmware to represent the number of pixels you are using.

Then the only other thing you need is the device type code for ST.

Justin

This is GREAT ! Thank you - I REALLY appreciate your help with this.
I am currently in the office, but will try this out as soon as I get home this afternoon and report back.
One last question. you mention ā€˜ā€¦the device type code for STā€™ - what is ST? The Strip?

No ST is SmartThings. The device type you setup as a device handler in the SmartThings ide.

AH-ha, 'cause. (I knew that but was just a little overloaded with info). After I get the Photon flashed, Iā€™ll define the ā€˜device typeā€™ in ST from the device type file also in your github.
Iā€™ll try later today and let you know. Thanks for your time

OK.
I compiled the code and it compiled fine.
I flashed the code, the LED flashed a few times and then just went deadā€¦no led - is that he proper behavior?
Even after I reset / power down , the led goes blank and stay off. it first flashed a few times green, then a couple of magenta flashed and then just dies.

I even unassigned the device and re-flash Tinker againā€¦it works fine. I can access it from my phone, but when I flash your code again (sometimes it times out when its in flashing-yellow mode)

When I flash the code while its blinking blue, it flashes, but after it re-cycles, the led is dead againā€¦

What am I missing here?

Thanks

Yes the LED on the front should turn off, I coded that so you didnā€™t have a cyan light blinking.

OK. Thanks!!
So there is no other way for me to ā€˜testā€™ it accept through ST?

OK - so i get it setup as a device in STā€¦but how do I find it on my ST app?
I tried to put the device again into blinking blue led state and scan for it in my ST app - but it does not pick it up.
Did I miss anything in the defition?
Should I have enable OATH (or whatever thatā€™s called - I know I did not do that.

Ideas?