MagicMirror² v2.5.0 is available! For more information about this release, check out this topic.

MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi



  • Specifically for MagicMirrors on a Raspberry Pi with a LPD8806 led strip, this module allows other modules to trigger light sequences or trigger from a http endpoint.

    github/jc21/MMM-PiLights


  • Moderator

    May I suggest you add a section on how to actually connect the LED strips to the pi, which pins, etc.? Not everyone is as technical as some of us … 🙂



  • This guide should cover it. Although that is for older raspberry pi models but still worth a read.

    For raspberry pi 3 I’ve connected the pins [DI to 20] and [CI to 24] as labelled in this image.


  • Moderator

    I’m referring to adding it to the repository README.md file.


  • Moderator

    And technically speaking, the LPD8806 chipset requires 4 wires for input: VCC, GND, DATA_IN (DI), and CLOCK_IN (CI). On a Raspberry Pi 3, the SPI port is on pins:

    MOSI    P1-19  (Master Out Slave In)
    MISO    P1-21  (Master In Slave Out)
    SCLK    P1-23
    GND     P1-25
    CE0     P1-24
    CE1     P1-26
    

    For DATA_IN, you should use the MOSI (19) pin, and for CLOCK_IN, the SCLK (23) pin. Pins 24 and 26 are chip select pins if you happen to have several SPI slave devices and needed to select which one you’re addressing.



  • Ahh you are correct that is how I have it connected, I just had a dyslexic moment and named the opposing pins by accident 😕



  • Hy

    i changed your module to work with the common W2801 Led Strips.

    Now i wanted to add some new sequences.
    I modified the switch case but everytime i will go to this sequence with the http request i get the answer, squence not found.

    this.expressApp.use(bodyParser.urlencoded({extended: true}));

        this.expressApp.get('/PiLights', (req, res) => {
            console.error('[PiLights] Incoming:', req.query);
    
            if (typeof req.query.sequence !== 'undefined') {
                // Sequence
    
                this.runSequence(req.query.sequence)
                    .then(function () {
                        res.status(200)
                            .send({
                                status: 200
                            });
                    })
                    .catch(function (err) {
                        res.status(400)
                            .send({
                                status: 400,
                                error: err.message
                            });
                    });
    
            } else {
                res.status(400)
                    .send({
                        status: 400,
                        error: 'Sequence not specified'
                     });
            }
    

    So if i send a new sequence then i will get the answer 400 sequence not specified.
    Where do you specify the available sequences?

    With Best regards
    Schmo



  • Hi schmo90, good to see you’re contributing 🙂

    Assuming your tests with curl -X GET "http://yourmagicmirror/PiLights?sequence=blue_pulse" still don’t work, I think I’d need to see all of your changes. If you’ve forked my repo on github can you please link it?



  • Hy

    yeah i made a infinite mirror behind the magic mirror 🙂

    your animations are working fine with my change of your led strip class to my w2801 class.
    But if i add some squences in the switch case, for example ‘off’ then i get the request error.

    is there some hidn node.js thing where you define the possible sequences?

    I have to say i am a C# developer and it is the first time with node.js…
    No debugging and intellisense with nano is realy painfull^^



  • @schmo90 It should work fine, there is no logic prior to that switch that filters possible values.

    What does the server console log report after the text [PiLights] Incoming: ?

    req.query.sequence should contain the string name of the sequence you’re requesting.