LED Backlight for mirror - PIR to control them

  • Hey,

    I am planning on buying some led strips to have as backlight on my mirror.
    I do not want them to be on all the time, i was hoping there was a way for me to power them from the raspberry pi and have the pir sensor wich now controlls wether the screen is on or off to also turn on/off the LED’s at the same time.

    Is it doable? Would there be enough power in the PI to make it all work reliably?

    If so, can i use any kind of led strip? Is there a module existing for this already?

  • Hello there,
    I too want to try out this project. I have a WS2812B (60 leds/meter) that I have used for creating a Hyperion configuration. I am planning to use the same. You will probably have to use an external power supply. Seems like a 5 meter strip of 60leds/meter will need ~10-15 Amp current at 5 Volts which obviously Pi cannot sustain. Also I found using an Arduino provides more control than the Pi but that is me. Will try to get something started in a week’s time and update on the progress.
    Please do let me know if you too have started on something.

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

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

  • I did this.

    alt text

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


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


            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");



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


          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.

  • Project Sponsor Module Developer

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

  • @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:


    I used this python code:

  • Project Sponsor Module Developer

    @orayoflighto VERY nice, Thank you!!!

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

  • Module Developer

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

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