5 Replies Latest reply on Oct 17, 2016 4:28 AM by lucie tozer

    Raspberry Pi Power Status LED Indicator

    b8a

      Hey guys, I have recently gotten my new Pi 3.

      I am loving it and am thinking of making myself a custom case for it.

      However I have searched and searched and cannot for the life of me find out how I can wire up 2 LEDs in order to show the power status.

       

      In other words, I want to find out how I can create a circuit that will have a red LED on when the Pi is off and a Blue LED on when the pi is on.

       

      Thanks in advance.

       

      PS: I am still quite new to the electrical  spectrum.

        • Re: Raspberry Pi Power Status LED Indicator
          royleith

          It depends what you mean by 'on' and 'off'. The Raspi does not have the traditional circuitry of a desktop computer that powers down the power supply when the operating system closes down. That is what a desktop uses to turn the power light on and off.

           

          The GPIO 5V pin is at 5V as long as the external PSU is delivering power. If your case had a power switch, it would be easy to arrange a simple circuit powered from the PSU side of the switch that lit a blue light when there was 5V at the Raspi and a red light when there was not, but that does not indicate when it is safe to turn the power off because it does not show if Rasbian is running or not.

           

          The only useful indication is the red LED on the Raspi that shows when the PSU is supplying power and the green LED that flashes four times and then goes off when Rasbian closes down. I don't know if that works for other Raspi OSs.

           

          I don't know of any way that those LED indications can be extended to external circuitry. If that were possible, then a logic circuit could be devised to convert Green 'On' and Red 'On to the lighting of a blue LED and Green 'Off' and Red 'On' to a Red LED 'On' (an AND logic gate - Output '0' lights red and '1' lights blue).

           

          Many commercial cases make the on-board LEDs visible by using light pipes or a transparent case or lid. However, each new Raspi seems to have the LEDs in different positions which makes the light pipe method of limited use.

            • Re: Raspberry Pi Power Status LED Indicator
              b8a

              Hey Roy,

               

              Thanks for the quick reply.

              I am adding a momentary push switch and a python script that monitors for the button press and performs a safe shutdown and a boot.

               

              So therefore it is safe to assume that when the button is pressed and the pi turns on the Blue LED would turn on. As soon as the switch is pressed again the pi will perform a safe shutdown and the Red LED can be turned on while the blue one goes off.

               

              Thanks in advance

            • Re: Raspberry Pi Power Status LED Indicator
              clem57

              I would try to get code that sets gpio pins for OS initialized and OS shutdown. See raspberry pi - Run code in python script on shutdown signal - Stack Overflow that will help. I leave for you how to turn on or off the actually lights. Nice idea BTW.

              Clem

                • Re: Raspberry Pi Power Status LED Indicator
                  b8a

                  I was thinking that as well.

                   

                  But I just do not know how to go about that.

                   

                  Would I be able to use the Pi's GPIO pins to select the LED by the high or low state of the GPIO?

                  Is there a pin that is low when the pi is off and high when it is on?

                   

                  Thanks in advance

                    • Re: Raspberry Pi Power Status LED Indicator
                      lucie tozer

                      That's a great idea for the push switch to safely turn the device off, something the raspberry pi would really benefit from! Once you export a gpio pin you can set the direction of the pin to be an output pin. Setting it's value to 1 will make it go high 3.3v and setting it to 0 will make it go low 0v. I haven't checked for certain but I would assume that the pins are always low when the raspberry pi is powered down so it should be simple enough to work a solution with indicator led's

                      1 of 1 people found this helpful