Skip to content

sdetweil/MMM-PiLights

 
 

Repository files navigation

MMM-PiLights

MagicMirror Module to control a led strip attached to a Raspberry Pi

Requirements

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

Module installation

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
        }
    }
]

Module Configuration Options

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)

Trigger from another module

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

Trigger from a endpoint

The GET endpoint is pretty simple:

http://yourmagicmirror/PiLights?sequence=blue_pulse

From the command line:

curl -X GET "http://yourmagicmirror/PiLights?sequence=blue_pulse"

Available Sequences

  • white_pulse
  • blue_pulse
  • lightblue_pulse
  • red_pulse
  • green_pulse
  • orange_pulse
  • pink_pulse

More to come later.

About

MagicMirror Module to control a led strip attached to a Raspberry Pi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.7%
  • Shell 2.3%