Connecting an RGB LED Strip, Spark Core, and Node.js Webpage!
- Node.js webpage
- Talks to Spark Cloud to query for specific users, their devices, and interact with them.
- spark-rgb.ino for custom additions (currently set up for 4-pin JST SM connection)
- defines the functions that have endpoints exposed.
- firmware.bin that was compiled from the spark-rgb.ino
- Digital RGB LED Strip because they are individually addressable LEDs (I used this one with a 4-pin JST SM since I had it laying around.)
- Wire or JST SM to hook up the RGB LED Strip
- Spark Core
- Hook up your RGB LED Strip to your Spark Core. (Depending on how many LEDs your strip has, you might need to provide an external power supply. I suggest looking up the specs to your specific LED Strip for more information as it varies.)
- If you are using the one I chose, you can connect your pins following the instructions here
- I was able to drive mine from the Spark Core directly without the use of an external power supply, so if you hook:
- +5V on the strip to 3.3V output from the Spark Core
- GRD on the strip to GRD on the Spark Core
- DI on the strip to D2 on the Spark Core
- CI on the strip to D3 on the Spark Core
- Flash your Spark Core with the firmware! You have two options here:
- Open up spark.io/build and copy and paste the code from the spark-rgb.ino into a new app, then compile and flash it onto your Spark device (as long as it has a WiFi connection).
- Download the firmware.bin and install it yourself through a USB connection to your Spark device.
- The elegance of the Node.js solution is how easy it is for anyone to use it! If you go to http://sparkrgb.azurewebsites.net you can login with your Spark Credentials and interact with your own Spark Core!
- The code for this site is in this repository too, it uses SparkJS to allow you to login to your own Spark account and interact with your own spark devices.
- Better documentation on the code for the webpage, how to push to Azure, and Spark Code.
- I am planning on continuing this to build a light box with LED's on 5 or 6 sides that can all be individually toggled. (Thus the Bottom, Right, Left, etc. brightness settings)
Original RGB LED Strip code was from an ms-iot example project.