I’ve been in love with the idea of NeoPixels since I first saw them up on AdaFruit’s website many years ago, but until recently I have not been able to find a good use for them in my home.
With our recent theater build, a car project that will involve several hundred WS2812b LEDs and Christmas right around the corner, I decided to delve into this project and get my “proof of concept” working.
I recently discovered the WS2812fx Arduino library, which currently offers numerous features such as 53 discreet effects, no delay, a built in web server when running on an ESP8266 and a URL based API of a sort… The last two parts are what made this possible, though I know it’s a barebones setup for the time being and requires a lot of configuration overhead for now.
Any ESP8266 based microprocessor will work, but I particularly like the Adafruit Feather Huzzah as it has a built in 5v to 3.3v regulator as well as a USB to Serial interface for programming.
A power supply to run both the NeoPixel strips as well as the ESP8266. I chose a 60 amp 5v power supply to ensure I had plenty of power for the planned four+ strips of lights I intend to run in the basement theater. The fan on the unit I chose runs whenever any load is detected on the system and increases or decreases in speed the heavier/lighter the load, respectively.
WS2812b Addressable LED Strips. I chose the 30 LEDs per meter strips, and went with IP67 rated as I originally planned to mount these outdoors for Christmas, but with the sudden onset of snow and cold weather Minnesota experienced this past week, I decided I was too much of a coward to climb the ladder and spend the weekend wiring these up in the frigid weather. As they are mounted inside the window frame, I was able to install them while wearing shorts and a T-Shirt, and I have no regrets…
A 1000uF 25v or higher capacitor to go between the positive/negative power feeds for the start of the LED string. This is to absorb any power shock when the LEDs go from low to full brightness. I installed this right at the power supply feed across the positive and negative terminals. When installing, you MUST be aware of the polarity of your capacitor. Explodey things happen if you do not.
Nothing spectacular to see here with regards to mounting the LEDs… Just some sticky zip-tie mounts, some zip-ties, and voila! The strips are mounted.
I connected the three strips in the windows in parallel with each other for both the power and the data connections. WS2812b strips are directional. There is a dedicated “IN” for data, and the other end is out. Hooking them up in reverse = no bueno… All three strips are connected to the same output pin on the ESP8266.
Installing the library and all of the necessary prerequisites was about a thirty minute process, and then a quick edit of the example sketch to set my wireless SSID and password as well as some base level parameters, and I was up and running.
Tying it into SmartThings
The embedded web server in the ESP8266 allows you to call specific functions directly by URL.
To set the Mode (Pattern), you would type http://ipaddress/set?m=##, where the ## is the pattern you want. The default page of the server lists all patterns in order from lowest numerical value to highest, though you do not see the value of the pattern, only the name. The first pattern in the list is numerical value 0.
Other functions are adjusting the brightness, speed, or calling a color value directly by its hexadecimal value using /set?b=(character here), /set?s=(character here), and /set?c=(hex value here) respectively.
Toss in the URI Device Handler, set the On URL to a pattern, and the Off URL to the color 000000 to turn all lights off and you now have the ability to directly control individual patterns using a dedicated on/off switch.
You’d have to create a new switch for every pattern you’d like to control, but until a good RESTful API is created within the library and an appropriate device handler is created that utilizes said API, this is the best you can do…
I’ll upload other pictures for this project as I take them, but for now, check out the following two, taken from inside the living room while the Rainbow Cycle pattern is running.