Blinks lots of LEDs
This project uses a Raspberry Pi SPI port to drive a bunch of DotStar LEDs. The trick is that the LEDs are arranged in a specific geometry, which makes all of the shows work.
The shows attempt to avoid using any stateful information/counters, instead all of the LED states are calculated from the current time/millisecond value.
It's not important that your Raspi know the current/real-time, instead, it's only important that the clock is consistent.
If you're using a fresh installation of Raspbian Jessie, here are a few things you may need to do/configure using sudo raspi-config:
- If you're in the United states, you probably want the US keyboard layout
- Enable the SSH server
- Enable the SPI port
- I personally prefer to have my RasPi boot to a command prompt (rather than a graphical desktop)
- Change the "pi" user's password
After rebooting the RasPi, you may need to do the following:
- Setup the WiFi Internet connection
- Install a newer version of NodeJS (v4 or v7)
- Use git to clone this repo
- run
npm installto download the necessary modules
At this point, it's time to make some physical connections. There are four pins/wires that are needed to connect the RasPi with the Dotstar LEDs. The tricky part is that the RasPi uses 3.3v binary communications, whereas the Dotstar LEDs use 5v binary - thus a converter is needed in between.
The simplest approach is to connect up a 74AHCT125, and connect it up like this. Here are some photos that show the connections IRL.
The entry point is cnc.js. Before starting that, you'll want to set an environment variable, which tells your RasPi which "secret key" to use when fetching commands from the CnC server at https://store.zapier.com
For example:
$ export SECRET_KEY=this_is_cool
$ node cnc.jsThen use Postman, or curl to POST settings the CnC server key that you specified.
$ curl -X POST -H "Content-Type: application/json" --data '{ "fgshow": "alternate", "bgcolor": { "r": 200, "g": 20, "b": 20 }, "bgshow": "solid", "fgcolor": { "r": 200, "g": 200, "b": 200 } }' https://store.zapier.com/api/records?secret=this_is_coolThe valid names for the "shows" are listed within the shows subdirectory. If you develop a new show, please submit a Pull Request and share it with us!
There's a barely functional simulator available in the simulator sub-dir. Go into that dir and run npm start, which starts the simulator.
Open http://localhost:3000 to view it in the browser.