<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi]]></title><description><![CDATA[<p dir="auto">Specifically for MagicMirrors on a Raspberry Pi with a <a href="https://www.adafruit.com/products/306" target="_blank" rel="noopener noreferrer nofollow ugc">LPD8806</a> led strip, this module allows other modules to trigger light sequences or trigger from a http endpoint.</p>
<p dir="auto"><a href="https://github.com/jc21/MMM-PiLights" target="_blank" rel="noopener noreferrer nofollow ugc">github/jc21/MMM-PiLights</a></p>
]]></description><link>https://forum.magicmirror.builders/topic/674/mmm-pilights-control-a-lpd8806-led-strip-on-a-raspberry-pi</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 18:35:28 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/674.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 21 Sep 2016 01:10:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Sun, 16 Jul 2017 11:19:02 GMT]]></title><description><![CDATA[<p dir="auto">I ordered these:<br />
<a href="https://www.amazon.com/gp/product/B01COEJST8/ref=oh_aui_detailpage_o09_s00?ie=UTF8&amp;psc=1" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.amazon.com/gp/product/B01COEJST8/ref=oh_aui_detailpage_o09_s00?ie=UTF8&amp;psc=1</a></p>
<p dir="auto">FYI - for those that are reading this in the future, make sure that your power supply ground is grounded to the RPi ground. That tripped me up.</p>
]]></description><link>https://forum.magicmirror.builders/post/25388</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/25388</guid><dc:creator><![CDATA[orayoflighto]]></dc:creator><pubDate>Sun, 16 Jul 2017 11:19:02 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Wed, 05 Jul 2017 11:42:49 GMT]]></title><description><![CDATA[<p dir="auto">Does anyone know if APA102 (or DOTSTAR) can be used without modification of the code?</p>
]]></description><link>https://forum.magicmirror.builders/post/24864</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/24864</guid><dc:creator><![CDATA[orayoflighto]]></dc:creator><pubDate>Wed, 05 Jul 2017 11:42:49 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Thu, 15 Jun 2017 18:46:56 GMT]]></title><description><![CDATA[<p dir="auto">yes, and you need to check the dependencies in your package.json file.<br />
The WS2801 library uses lightly other function-names, you probably need to check that out</p>
<p dir="auto"><a href="https://www.npmjs.com/package/rpi-ws2801" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.npmjs.com/package/rpi-ws2801</a> vs.<br />
<a href="https://www.npmjs.com/package/lpd8806-async" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.npmjs.com/package/lpd8806-async</a></p>
<p dir="auto">I work on an own repository for this one but unfortunaly do not have much time at the moment, you can check that out as well. I thought of an option which sais that you are using ws2801 or lpd8806 and the module handles it … but a lot stuff to do.</p>
<p dir="auto"><a href="https://github.com/Ashidian/MMM-PiLights" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/Ashidian/MMM-PiLights</a></p>
]]></description><link>https://forum.magicmirror.builders/post/23337</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/23337</guid><dc:creator><![CDATA[Ashidian]]></dc:creator><pubDate>Thu, 15 Jun 2017 18:46:56 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Tue, 13 Jun 2017 14:17:07 GMT]]></title><description><![CDATA[<p dir="auto">Hello :), I buyed a WS2801  LED-Chain and now I try to get the module running. I Installed the library via. “npm install rpi-ws2801” but I dont know what I Need to Change to get it work.<br />
var leds = require(“rpi-ws2801”);<br />
Putting this in my js.File I only get an error message in my developer console?<br />
Can somebody help me please?</p>
]]></description><link>https://forum.magicmirror.builders/post/22699</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/22699</guid><dc:creator><![CDATA[fabrang]]></dc:creator><pubDate>Tue, 13 Jun 2017 14:17:07 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Mon, 13 Feb 2017 03:53:29 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
Has anyone tried using one of the voice control modules to change color or control the light strip? I am new to this and would be interested in some ideas on how to point the correct modules.</p>
]]></description><link>https://forum.magicmirror.builders/post/14413</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/14413</guid><dc:creator><![CDATA[aspartame]]></dc:creator><pubDate>Mon, 13 Feb 2017 03:53:29 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Sun, 22 Jan 2017 11:40:03 GMT]]></title><description><![CDATA[<p dir="auto">hy i found out that  node.js will not allow to call some functions.</p>
<p dir="auto">it jumped everytime into the try catch.</p>
<p dir="auto">but now it is working fine…<br />
and you need to install the ws2801 npm packages from<br />
<a href="https://www.npmjs.com/package/rpi-ws2801" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.npmjs.com/package/rpi-ws2801</a></p>
<p dir="auto">here is the file:<br />
(but i dont know if the uplaod worked…)<br />
[0_1485084948629_node_helper.js](Uploading 100%)</p>
<pre><code>/* global require */

const _ = require('lodash');
const Color = require('color');
const NodeHelper = require('node_helper');
const bodyParser = require('body-parser');
const LPD8806 = require('lpd8806-async');
//const WS2801	 = require('rpi-ws2801');
const async = require('async');

var ajv = require('ajv')({
    allErrors: true,
    format: 'full',
    coerceTypes: true
});

module.exports = NodeHelper.create({

    config: {},
    animationRunning: false,
    stopAnimationRequest: false,
    defaultSpeed: 100,

    /**
     * node_helper start method
     */
    start: function () {
        console.log('[PiLights] Starting node_helper');

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

        this.expressApp.get('/PiLights', (req, res) =&gt; {
            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'
                    });
            }
        });
    },

    /**
     *
     * @param {String} notification
     * @param {*}      payload
     */
    socketNotificationReceived: function (notification, payload) {
        if (notification === 'START') {
            this.config = payload;

            try {
                console.info('Trying to load leds');

                // Internal reference to rpi-ws2801
                this.leds = require("rpi-ws2801");
                this.leds.connect(this.config.ledCount, this.config.device);
                // Initialize off
                this.leds.fill(0x00, 0x00, 0x00);
                //this.leds.setMasterBrightness(this.config.brightness);

                console.log('[PiLights] Leds connected ok');

            } catch (err) {
                console.error('[PiLights] Unable to open SPI (' + this.config.device + '), not supported?', err.message);
                this.leds = null;
            }

        } else if (notification === 'SEQUENCE') {
            Promise.resolve(this.runSequence(payload)
                .catch(function (err) {
                    console.log('[PiLights] Sequence error: ' + err.message);
                }));
        }
    },

    /**
     * Runs a light sequence
     *
     * @param   {String}  sequence
     * @param   {Integer} [iterations]
     * @returns {Promise}
     */
    runSequence: function (sequence, iterations) {
        var self = this;
        iterations = iterations || 20;

        return new Promise(function (resolve, reject) {
            var colors = [0, 0, 0];

            switch (sequence) {
                case 'blue_pulse':
                    colors = [0, 0, 255];
                    break;
                case 'white_pulse':
                    colors = [255, 255, 255];
                    break;
                case 'lightblue_pulse':
                    colors = [0, 255, 255];
                    break;
                case 'red_pulse':
                    colors = [255, 0, 0];
                    break;
                case 'green_pulse':
                    colors = [0, 255, 0];
                    break;
                case 'orange_pulse':
                    colors = [255, 170, 0];
                    break;
                case 'pink_pulse':
                    colors = [255, 0, 255];
                    break;
                case 'off':
                    colors = [0, 0, 0];
                    iterations = 1;
                    break;
                default:
                    reject(new Error('Unknown sequence: ' + sequence));
                    return;
                    break;
            }
            resolve(self.pulse(colors[0], colors[1], colors[2], iterations, 20));

        });
    },

    /**
     * @param {Function} cb
     * @returns {*}
     */
    switchAnimation: function (cb) {
        if (!this.animationRunning) {
            return this.startAnimation(cb);
        }

        this.stopAnimationRequest = true;

        if (this.animationRunning) {
            //console.log('animation was running, delaying new animation');

            var self = this;
            setTimeout(function () {
                self.switchAnimation(cb);
            }, 100);
        } else {
            this.startAnimation(cb);
        }
    },

    /**
     *
     * @param {Function} cb
     * @returns {Function}
     */
    startAnimation: function (cb) {
        //console.log('[PiLights] Starting animation..');
        this.stopAnimationRequest = false;
        this.animationRunning = true;
        return cb();
    },

    /**
     *
     */
    stopAnimation: function () {
        //console.log('[PiLights] Animation stopped.');
        this.animationRunning = false;
    },

    /**
     *
     */
    update: function () {
        //        if (this.leds) {
        //            this.leds.update();
        //        }
    },

    /**
     *
     * @param {Integer} red
     * @param {Integer} green
     * @param {Integer} blue
     * @param {Integer} [iterations]
     * @param {Integer} [speed]
     */
    pulse: function (red, green, blue, iterations, speed) {
        if (this.leds) {
            this.switchAnimation(() =&gt; {
                console.log('[PiLights] Pulse (' + red + ',' + green + ', ' + blue + ') Iterations: ' + iterations + ', Speed: ' + speed);
                this.flashEffect(red, green, blue, iterations, speed);
            });
        }
    },

    /**
     *
     * @param r
     * @param g
     * @param b
     */
    fillRGB: function (r, g, b) {
        if (this.leds) {
            this.switchAnimation(() =&gt; {
                //console.log('[PiLights] Filling leds with', r, g, b);
                this.leds.fill(r, g, b);
                this.stopAnimation();
            });
        }
    },

    /**
     *
     */
    off: function () {
        if (this.leds) {
            //console.log('[PiLights] Setting Leds Off');
            this.leds.fill(0x00, 0x00, 0x00);
            this.stopAnimation();
        }
    },

    /**
     *
     * @param {Integer} r
     * @param {Integer} g
     * @param {Integer} b
     * @param {Integer} [iterations]
     * @param {Integer} [speed]
     */
    flashEffect: function (r, g, b, iterations, speed) {
        var self = this;
        var step = 0.05;
        var total_iterations = 0;

        speed = speed || 10; // ms
        iterations = iterations || 99999;

        var level = 0.00;
        var dir = step;

        function performStep() {
            if (level &lt;= 0.0) {
                level = 0.0;
                dir = step;
                total_iterations++;
            } else if (level &gt;= 1.0) {
                level = 1.0;
                dir = -step;
            }

            level += dir;

            if (level &lt; 0.0) {
                level = 0.0;
            } else if (level &gt; 1.0) {
                level = 1.0;
            }

            if (self.stopAnimationRequest || total_iterations &gt; iterations) {
                self.stopAnimation();
                return;
            }

            self.leds.fill(r * level, b * level, g * level);


            setTimeout(performStep, speed);
        }

        if (this.leds) {
            performStep();
        }
    }

});

</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/12007</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/12007</guid><dc:creator><![CDATA[schmo90]]></dc:creator><pubDate>Sun, 22 Jan 2017 11:40:03 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Sun, 22 Jan 2017 10:04:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/schmo90" aria-label="Profile: schmo90">@<bdi>schmo90</bdi></a> I bought a WS2801 LED strip as well. What did you changed to use this module with your strip?</p>
<p dir="auto">I think it would be great for this module to implement both possibilities of LED strips so one can set the type in the properties, wouldn’t it?</p>
]]></description><link>https://forum.magicmirror.builders/post/11985</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/11985</guid><dc:creator><![CDATA[Ashidian]]></dc:creator><pubDate>Sun, 22 Jan 2017 10:04:58 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Sun, 22 Jan 2017 09:11:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/schmo90" aria-label="Profile: schmo90">@<bdi>schmo90</bdi></a> It should work fine, there is no logic prior to that switch that filters possible values.</p>
<p dir="auto">What does the server console log report after the text <code>[PiLights] Incoming:</code> ?</p>
<p dir="auto"><code>req.query.sequence</code> should contain the string name of the sequence you’re requesting.</p>
]]></description><link>https://forum.magicmirror.builders/post/11976</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/11976</guid><dc:creator><![CDATA[jc21]]></dc:creator><pubDate>Sun, 22 Jan 2017 09:11:51 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Fri, 20 Jan 2017 09:22:25 GMT]]></title><description><![CDATA[<p dir="auto">Hy</p>
<p dir="auto">yeah i made a infinite mirror behind the magic mirror :-)</p>
<p dir="auto">your animations are working fine with my change of your led strip class to my w2801 class.<br />
But if i add some squences in the switch case, for example ‘off’ then i get the request error.</p>
<p dir="auto">is there some hidn node.js thing where you define the possible sequences?</p>
<p dir="auto">I have to say i am a C# developer and it is the first time with node.js…<br />
No debugging and intellisense with nano is realy painfull^^</p>
]]></description><link>https://forum.magicmirror.builders/post/11720</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/11720</guid><dc:creator><![CDATA[schmo90]]></dc:creator><pubDate>Fri, 20 Jan 2017 09:22:25 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Thu, 19 Jan 2017 22:28:59 GMT]]></title><description><![CDATA[<p dir="auto">Hi schmo90, good to see you’re contributing :)</p>
<p dir="auto">Assuming your tests with <code>curl -X GET "http://yourmagicmirror/PiLights?sequence=blue_pulse"</code> 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?</p>
]]></description><link>https://forum.magicmirror.builders/post/11706</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/11706</guid><dc:creator><![CDATA[jc21]]></dc:creator><pubDate>Thu, 19 Jan 2017 22:28:59 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Thu, 19 Jan 2017 07:45:20 GMT]]></title><description><![CDATA[<p dir="auto">Hy</p>
<p dir="auto">i changed your module to work with the common W2801 Led Strips.</p>
<p dir="auto">Now i wanted to add some new sequences.<br />
I modified the switch case but everytime i will go to this sequence with the http request i get the answer, squence not found.</p>
<p dir="auto">this.expressApp.use(bodyParser.urlencoded({extended: true}));</p>
<pre><code>    this.expressApp.get('/PiLights', (req, res) =&gt; {
        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'
                 });
        }
</code></pre>
<p dir="auto">So if i send a new sequence then i will get the answer 400 sequence not specified.<br />
Where do you specify the available sequences?</p>
<p dir="auto">With Best regards<br />
Schmo</p>
]]></description><link>https://forum.magicmirror.builders/post/11608</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/11608</guid><dc:creator><![CDATA[schmo90]]></dc:creator><pubDate>Thu, 19 Jan 2017 07:45:20 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Thu, 22 Sep 2016 04:14:35 GMT]]></title><description><![CDATA[<p dir="auto">Ahh you are correct that is how I have it connected, I just had a dyslexic moment and named the opposing pins by accident :/</p>
]]></description><link>https://forum.magicmirror.builders/post/5178</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/5178</guid><dc:creator><![CDATA[jc21]]></dc:creator><pubDate>Thu, 22 Sep 2016 04:14:35 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Wed, 21 Sep 2016 04:54:10 GMT]]></title><description><![CDATA[<p dir="auto">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:</p>
<pre><code class="language-javascript">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
</code></pre>
<p dir="auto">For DATA_IN, you should use the <code>MOSI</code> (19) pin, and for CLOCK_IN, the <code>SCLK</code> (23) pin. Pins 24 and 26 are <code>chip select</code> pins if you happen to have several SPI slave devices and needed to select which one you’re addressing.</p>
]]></description><link>https://forum.magicmirror.builders/post/5113</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/5113</guid><dc:creator><![CDATA[KirAsh4]]></dc:creator><pubDate>Wed, 21 Sep 2016 04:54:10 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Wed, 21 Sep 2016 04:44:14 GMT]]></title><description><![CDATA[<p dir="auto">I’m referring to adding it to the repository <a href="http://README.md" target="_blank" rel="noopener noreferrer nofollow ugc">README.md</a> file.</p>
]]></description><link>https://forum.magicmirror.builders/post/5112</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/5112</guid><dc:creator><![CDATA[KirAsh4]]></dc:creator><pubDate>Wed, 21 Sep 2016 04:44:14 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Wed, 21 Sep 2016 03:27:25 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://learn.adafruit.com/light-painting-with-raspberry-pi/hardware" target="_blank" rel="noopener noreferrer nofollow ugc">This guide should cover it</a>. Although that is for older raspberry pi models but still worth a read.</p>
<p dir="auto">For raspberry pi 3 I’ve connected the pins [DI to 20] and [CI to 24] as labelled in <a href="https://ms-iot.github.io/content/images/PinMappings/RP2_Pinout.png" target="_blank" rel="noopener noreferrer nofollow ugc">this image</a>.</p>
]]></description><link>https://forum.magicmirror.builders/post/5109</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/5109</guid><dc:creator><![CDATA[jc21]]></dc:creator><pubDate>Wed, 21 Sep 2016 03:27:25 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-PiLights - Control a LPD8806 Led Strip on a Raspberry Pi on Wed, 21 Sep 2016 02:05:47 GMT]]></title><description><![CDATA[<p dir="auto">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 … :)</p>
]]></description><link>https://forum.magicmirror.builders/post/5104</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/5104</guid><dc:creator><![CDATA[KirAsh4]]></dc:creator><pubDate>Wed, 21 Sep 2016 02:05:47 GMT</pubDate></item></channel></rss>