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.

    LED Backlight for mirror - PIR to control them

    Scheduled Pinned Locked Moved General Discussion
    17 Posts 6 Posters 12.9k Views 6 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.
    • pjkoelemanP Offline
      pjkoeleman
      last edited by pjkoeleman

      @Mirrorolentia said in LED Backlight for mirror - PIR to control them:

      Please do let me know if you too have started on something.

      I’am working on a Pi-hat (plug on to the GPIO connector) witch can control an RGB-LED strip.
      For the software I want to use a PIR and the clock for switching On/Off. With PWM (Puls Wide Modulation) regulating the brightness. Color changing will be random, but there will be a fixed color in a white color, around 3000 K (warm-white).

      It will take some time to build/write the software, because I’am not a software guru.

      1 Reply Last reply Reply Quote 0
      • M Offline
        Mirrorolentia
        last edited by

        So finally have been able to integrate the led lights :) Got the code working just now. However, will need sometime to make a proper module out of it. Tried out with johnnyfive and node-pixel with some luck…but it was hyperion/boblight that did the magic for me.
        Of course, the trigger comes from Alexa/Echo rather than a PIR sensor.

        1 Reply Last reply Reply Quote 0
        • O Offline
          orayoflighto Project Sponsor
          last edited by

          I did this.

          alt text

          I used the MMM-PIR-Sensor module and changed the following in node_helper.js:

          From:

                  if (data.indexOf("0x120002") !== -1)
                    exec("/opt/vc/bin/tvservice --preferred && chvt 6 && chvt 7", null);
          

          To:

                  if (data.indexOf("0x120002") !== -1){
                    exec("/opt/vc/bin/tvservice --preferred && chvt 6 && chvt 7", null);
                    exec("python /home/pi/py-spidev/RPi-LPD8806/LED.py");
                 }
          

          and

          From:

                exec("/opt/vc/bin/tvservice -o", null);
          

          To:

                exec("/opt/vc/bin/tvservice -o", null);
                exec("python /home/pi/py-spidev/RPi-LPD8806/off.py");
                 }
          

          Note that in the first from - to there is a “)” missing in the original code that you will need to fix. Also note that as soon as the module gets updated if you hack the code like I did above it will be wiped out when you update.

          cowboysdudeC 1 Reply Last reply Reply Quote 3
          • cowboysdudeC Offline
            cowboysdude Module Developer @orayoflighto
            last edited by cowboysdude

            @orayoflighto NICE!!! What light strips did you use?

            O 1 Reply Last reply Reply Quote 0
            • O Offline
              orayoflighto Project Sponsor @cowboysdude
              last edited by

              @cowboysdude

              I used these only because they were incredibly cheap and I originally started out looking at MMM-PiLights which uses the same LPD8806 type:

              https://www.amazon.com/gp/product/B01COEJST8/ref=oh_aui_detailpage_o09_s00?ie=UTF8&psc=1

              I used this python code:
              https://github.com/longjos/RPi-LPD8806

              cowboysdudeC 1 Reply Last reply Reply Quote 2
              • cowboysdudeC Offline
                cowboysdude Module Developer @orayoflighto
                last edited by cowboysdude

                @orayoflighto VERY nice, Thank you!!!

                You outta do a write up with instructions! MANY people would love this!

                1 Reply Last reply Reply Quote 0
                • SnilleS Offline
                  Snille Module Developer
                  last edited by

                  Just to add some depth to this… If you really want to go “crazy” with animations, I’m recommending Bibliopixel and PixelWeb. Then you can “animate” lot’s and trigger them with a curl “command”. Plus you get a nice Web-interface to test the animations in. :)

                  If you cant find it, make it and share it!
                  Modules: MMM-homeassistant-sensors, MMM-Modulebar, MMM-Profilepicture, MMM-Videoplayer

                  1 Reply Last reply Reply Quote 1
                  • KimzerK Offline
                    Kimzer
                    last edited by

                    Oh lawd! This looks insanely good. Thanks alot for the guide. Out to go buy some strips today! :D

                    KimzerK 1 Reply Last reply Reply Quote 0
                    • KimzerK Offline
                      Kimzer @Kimzer
                      last edited by

                      @Kimzer said in LED Backlight for mirror - PIR to control them:

                      Oh lawd! This looks insanely good. Thanks alot for the guide. Out to go buy some strips today! :D

                      To quote myself…

                      Can i use any sorts of led strips? Im looking to buy something from a store and not order online if possible.
                      Im in norway so if anyone knows something i could buy please let me know!

                      1 Reply Last reply Reply Quote 0
                      • O Offline
                        orayoflighto Project Sponsor
                        last edited by

                        Different strips have different ways they need to be programmed. Some have faster refresh rates than others.

                        Most people will suggest ADA102 for beginners. The strips I linked to are LPD8806. As I mentioned previously the only reason I bought those ones is that MMM-PiLights was programmed to use them.

                        1 Reply Last reply Reply Quote 1
                        • 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