• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

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

Scheduled Pinned Locked Moved Utilities
17 Posts 7 Posters 13.9k Views 9 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    jc21
    last edited by Sep 21, 2016, 1:10 AM

    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

    1 Reply Last reply Reply Quote 0
    • K Offline
      KirAsh4 Moderator
      last edited by Sep 21, 2016, 2:05 AM

      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 … :)

      A Life? Cool! Where can I download one of those from?

      1 Reply Last reply Reply Quote 1
      • J Offline
        jc21
        last edited by Sep 21, 2016, 3:27 AM

        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.

        1 Reply Last reply Reply Quote 1
        • K Offline
          KirAsh4 Moderator
          last edited by Sep 21, 2016, 4:44 AM

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

          A Life? Cool! Where can I download one of those from?

          1 Reply Last reply Reply Quote 0
          • K Offline
            KirAsh4 Moderator
            last edited by Sep 21, 2016, 4:54 AM

            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.

            A Life? Cool! Where can I download one of those from?

            1 Reply Last reply Reply Quote 0
            • J Offline
              jc21
              last edited by Sep 22, 2016, 4:14 AM

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

              1 Reply Last reply Reply Quote 0
              • S Offline
                schmo90
                last edited by Jan 19, 2017, 7:45 AM

                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

                A 1 Reply Last reply Jan 22, 2017, 10:04 AM Reply Quote 0
                • J Offline
                  jc21
                  last edited by Jan 19, 2017, 10:28 PM

                  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?

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    schmo90
                    last edited by Jan 20, 2017, 9:22 AM

                    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^^

                    J 1 Reply Last reply Jan 22, 2017, 9:11 AM Reply Quote 0
                    • J Offline
                      jc21 @schmo90
                      last edited by Jan 22, 2017, 9:11 AM

                      @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.

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy