MagicMirror Module to control a led strip attached to a Raspberry Pi
This module is specifically meant for the Raspberry Pi system, using SPI and a LPD8806 or WS2801 LED strip. It may be compatible with other LED strips, but this has not been tested.
Buy the LPD8806 LED Strip here and learn how to connect it here
If using Raspbian, you will need to enable SPI:
sudo raspi-config
then navigate to Advanced
options and enable SPI
Clone the module and npm install:
cd ~/MagicMirror/modules
git clone https://github.com/jc21/MMM-PiLights.git
cd MMM-PiLights
npm install
Add the module config to ~/MagicMirror/config/config.js
modules: [
{
module: 'MMM-PiLights',
config: {
ledCount: 64,
type: 'ws2801', // 'ws2801' or 'lpd8806'
bus: 0,
device: 0,
brightness: 1.0 // between 0.0 and 1.0
}
}
]
Option | Type | Default | Description |
---|---|---|---|
ledCount |
Integer | 64 |
Number LEDs on your strip |
type |
String | ws2801 |
The LED strip type, either 'ws2801' or 'lpd8806' |
bus |
Integer | 0 |
The SPI bus number for your LED strip |
device |
Integer | 0 |
The SPI device number for your LED strip |
brightness |
Float | 0.0 |
The LED strip brightness (between 0.0 and 1.0) |
If you're developing a module and want to trigger a light sequence, here's an example of what you'd use in your module:
this.sendNotification('PILIGHTS_SEQUENCE', 'blue_pulse');
My other MagicMirror module is able to trigger light sequences with notifications: MMM-IFTTT
The GET endpoint is pretty simple:
https://yourmagicmirror/PiLights?sequence=blue_pulse
From the command line:
curl -X GET "https://yourmagicmirror/PiLights?sequence=blue_pulse"
- white_pulse
- blue_pulse
- lightblue_pulse
- red_pulse
- green_pulse
- orange_pulse
- pink_pulse
More to come later.