Introduction: Raspberry Pi Shutdown Indicator
It’s very simple circuit for showing operational status of raspberry pi (Hereinafter as RPI).
Maybe it’s useful when you running RPI as headless (without monitor).
Sometimes I’m concerned when is right time for completely power-off after shutdown RPI.
Therefore, this circuit is made to notify the right time for power-off.
Also it can show you the headless running RPI doing something.. at least make bi-color LED blinking.
This circuit is made base on very common LED multi-vibrator so called as LED blinker.
Based on the LED blinker I’m adding the following feature to make RPI shutdown indicator (Hereinafter as INDICATOR).
- Using opto-coupler to interface with RPI (Because I want to isolate this circuit completely with RPI in term of power supply. Actually I have bad experience burning RPI with hardwiring)
- USB Type-B power adaptor is used for this circuit is connecting with common hand-phone charger which is highly available and supply 5V exactly
I’m supposing external power source usage can minimize problems (e.g. grounding with RPI, mistakenly connecting high voltage to GPIO) and less burdening RPI.
Although this circuit is quite simple, I’m planning to develop more complex ones later which are drawing quite significant current from GPIO.
Step 1: Schematics
This is schematics of INDICATOR circuit.
You may notice very popular and basic LED blinker circuit is included to INDICATOR schematics.
To make INDICATOR properly operating, the following configuration should be included to “/boot/config.txt”.
This RPI OS configuration make GPIO pin 24 goes to the high level when RPI is boot-up and then go low when shutdown has completed.
Therefore, you can safely power-off RPI when blinking of bi-color LED is stopped and turn off.
The picture above shows bi-color LED
blinking with boot-up of RPI.
Up to now, I’m explaining overview of INDICATOR circuit and purpose of usage.
Let’s start to make this.
Step 2: Preparing Parts
As I have quite many PNP transistors in my inventory, mainly PNP transistors are used to make INDICATOR.
- PNP transistors: 2N3906 x 2, BD140 x 1
- Opto-coupler: PC817 (Panasonic)
- Capacitors: 22uF 20V x 2
- Resistors: 220ohm x 3 (current limiting), 2.2K (switching control of BD140) x 1, 100K (defining LED blinking rate), 4.7K (Inverting RPI signal input)
- Bi-color LED x 1 (common cathode type is required)
- Universal board 25(W) by 15(H) holes size (You can cut any size of universal board to fit INDICATOR circuit)
- Tin wire (I’ll example detail in “Part 2: making PCB drawing” for usage of this part)
- USB type-B micro break-out
- Cable (red and blue common single wire cable)
- Any hand-phone charger 220V input and 5V output (USB type B connector)
- Pin head (5 pins)
No exotic components are used for INDICATOR and maybe all parts can be easily purchased from any internet e-stores except tin wire.
I had purchased this one from Farnell quit long time ago (maybe more than 10 years)
I’m not sure is it still available for ordering.
But don’t worry, you can use any 24 SWG size wire which conducting current as substitution.
Or simply you can use common single wire without using tin wire.
USB type-B micro break-out is used for connecting hand-phone charger as power source.
Before to start making INDICATOR, I’ll explain interface scheme between RPI and INDICATOR via opto-coupler.
When RPI is boot-up, output of GPIO 24 becomes HIGH by config.txt setting.
Due to the signal inverting circuit configuration with opto-coupler’s output terminal and 4.7K resistor, input signal of INDICATOR becomes LOW.
As input signal is LOW (input voltage becomes near to 0V), BD140 PNP transistor is conducting (turned on).
As PNP transistor turned on, LED blinker circuit (which is load for the transistor) start operating.
Step 3: Making PCB Drawing
As operating scheme of INDICATOR is explained, let’s start to make the circuit.
Before soldering something on universal board, preparing the following kind of PCB drawing is helpful to minimize mistake.
I’m using power-point to locate each part on the universal board and making wiring patterns among parts with tin wire as shown in the PCB drawing above.
The tin wire mentioned above is utilized for making PCB wire patterns depicted as pink, blue and red lines in the drawing.
But as I mentioned, you can use only common single wire cable to connect all components as shown in the picture below.
But as you can see, it seems a little bit ugly and careful to wire each component to prevent any mistakes. (Using pin head instead of USB type-B micro break-out)
I’m recommend to use tin wire to make output have a little bit refined look and easy to correct errors while soldering.
OK! Everything is ready and let’s start making.
Step 4: Soldering
I’ll explain only important steps among all soldering steps.
Please refer other postings in Instructable web pages regarding soldering basics.
USB type-B micro break-out can be mounted on universal board by using 5 pin-head.
Each part shall be inserted on the universal board at the location as depicted in PCB drawing.
Please careful about pin layout of PC817 while soldering opto-coupler.
For wiring each component, sometimes utilizing tin wire is required to interconnect two parts located at a long distance each other on the PCB.
When you look carefully wiring pattern between collector of BD140 and emitter of 2N3906 transistor at the bottom side of PCB, orange line connected with pink line.
Also orange line crossed by pink line which connecting between 2.2K resistor and base of BD140.
Actually “U” shape small tine wire segment is orange colored line as shown in the picture below.
And long pink line pattern between transistors is connected by using straight shaped tin wire.
As the “U” shape tin wire inserted on the PCB, it does not touch pink line from 2.2K to the base of BD140 transistor.
Other long pink lines are connected with straight tine wire.
Likewise, all other components can be inter-connected with each other.
The soldering completed PCB is shown in the picture below.
As a last stage, bi-color LED should be connected to the completed PCB.
For the top side of LED facing toward front side, small PCB fragment is used as shown in the picture below.
Small PCB fragment attaching bi-color LED is soldered as perpendicular (90 degree) with main PCB.
Step 5: INDICATOR Interfacing With RPI
When soldering is completed, INDICATOR circuit should be connected with RPI.
Also RPI OS configuration should be added in the” /boot/config.txt” file.
GPIO 24 (18) and Ground (20) pins are connected with RPI as shown in the picture below.
As only opto-coupler interface is connected, two power supply units are necessary.
The white power supply adaptor shown in the picture above is common hand-phone charger supplying 5V.
The black one shown in the right side is 5V / 3A RPI power supply.
To configure GPIO 24 for activating INDICATOR, the following setup should be included to /boot/config.txt as shown in the picture below.
Step 6: Operating INDICATOR
When wiring is finished and configuration is completed, simply reboot RPI with “sudo reboot now” command.
Then INDICATOR is starting to blink during boot-up.
I’m supposing maybe GPIO 24 is activating at run-level 1 as putty session still doesn’t showing login prompt while blinking is just started.
When everything is OK, you can see bi-color LED blinking while RPI is running.
Of course blinking will be stop when you start shutdown such as using “sudo shutdown –h 0” command.
When blinking stop, you can safely turn off power of RPI.