I would like to come up with a setup that shuts the rPi down in a safe way and also protects the rPi SSD from sudden powerloss
attached my first try to setup a soft shutdown for a rPi
States:
1. power supply on right is on and +5V goes to rPi 5V in
trickle charge to battery through R3 (220Ohm) ~ 3mA (to be adjusted)
Buck is idle as the diode voltage D3 is < 0.6V = off (5.5 --> 5V when regular power is on), no current flows through diode D3
2. power goes off:
relay on right goes off
buck supplies 5.5V-0.65 = 4.85 V to rPi (must be > 4.75V). The capacitor > 100uF helps to remove any spikes up/down
Pin x goes to low and triggers program on rPi to issue sudo shutdown -h now command
Buck/ battery supplies power until rPi is shut down
Pin-Y --> TXD GPIO pin goes to low after shut down, switches relay on left off. .. power to rPi goes off
all power is off
3. push button Pin-X to ground for >2 seconds starts a sudo shutdown -h now process
pin-Y --> TXD GPIO goes to 0, shuts down Battery relay.
power still on.
4. restart through second switch "RUN-GROUND" pins starts the system after regular shutdown to system halt.
Any comments form interested parties?
Karl
remarks:
the 2 round boxes are the components from a saint smart dual relay switch board.
The right relay has all parts besides the relay and the reverse voltage diode removed.
The opto coupler and transistor etc are all on the SainSmart board.
We need to add few components to a dual saint smart relay board (2 diodes, 3 resistors, 1 capacitor, a BUCK, NiMH batteries, a shutdown and start moment switch+ some cables
Normally the opto-coupler has an open input (lower part). Here we connect it to ground so that it is on as default. The connection between the led and the optocoupler has to be added. Its voltage is max 2.2V and it can draw max 3mA (R1 ~ 1kOhm, R2=510Ohm) If pin-Y goes to 0 the opt-coupler is off and the relay goes off
R3=220Ohm
R4=2KOhm
R5= 3KOhm
battery= 3* 1.2V NiMH AA cells
buck = step up Voltage converter that operates > 3.5 V input and can deliver 1.5Amps & 5-6 V
relay states shown are power off states.
TXD GPIO goes to 0 after regular software issued shutdown. That is a designed feature of the rPi