A very basic app to control WS2812 LED strips with a raspberry pi.
This consists of a Node app which serves a simple HTML page to manage the strip and includes libraries to control the strip.
You can use it for WS2812 (Neopixel) christmas lights, or other simple DIY applications.
- Rainbow
- Cycle through all colors and pulse through strip.
- Fade 2 Colors
- Choose 2 colors and fade the strip between them.
- Christmas Mode 1
- Randomly cycle R / G / B / W through the strip.
- Christmas Mode 2
- Iterate a segment of R / G / B / W LEDs through the strip from top to bottom and bottom to top
I found this NPM package : https://www.npmjs.com/package/rpi-ws281x-native Read this page.
It led me to follow the instructions here at Adafruit: https://learn.adafruit.com/neopixels-on-raspberry-pi.
Connect your raspi according to those instructions. I have been using my Pi's with a diode instead of the level converter, and they work well.
- WS2812 (Neopixel) LED Light Strip or LEDs
- Raspberry Pi 3 Model B, Raspberry Pi Zero, or Raspberry Pi Model B (other Raspberry Pis should work fine but are untested)
- 5V 2A Power Supply
- 1N4001 Diode (or equivalent) or a level converter. See https://learn.adafruit.com/neopixels-on-raspberry-pi/wiring
- Connect DATA IN of your WS2812 LED strip to physical pin 12 of the Raspberry Pi. (GPIO 18).
- Connect GND (Physical pin 6) to the GND lead of your power supply.
- Refer to this image for a layout of the raspi pins: https://www.element14.com/community/servlet/JiveServlet/previewBody/73950-102-11-339300/pi3_gpio.png
I currently have included the node modules directory in the repo. IMORTANT This will only work on a Raspberry Pi.
In future versions I will remove the node_modules folder and properly script the (3) packagaes.
Tested working on:
- Raspberry Pi 3 Model B
- Raspberry Pi Zero W (some slowness can occur)
- Raspberry Pi Model B (some slowness can occur)
-
Install NodeJS.
-
Copy this repo to some location on your pi.
-
Modify NUM_LEDS in strip.js to match the number of LEDs you have connected.
var NUM_LEDS = <YOUR_LEDS_HERE>;
-
Modify HTTP_PORT in app.js to match the port you want to use to access your Pi.
var HTTP_PORT = <YOUR_PORT_HERE>;
-
Run app.js as root user or with sudo privileges.
node /path/to/me/app.js
-
Access app.html to control the LED strip from the IP Address of your raspi.
http://<YOUR_IP_ADDRESS_HERE>:<YOUR_PORT_HERE>/
Contact me @ austin@brogencreations.com