Kill switch

# Kill Switch

The Raspberry Pi needs a proper shutdown before the power goes off, otherwise your SD card can be corrupted. To shut down the Raspberry Pi the command sudo shutdown -h now must be executed.
If the Raspberry Pi isn't shut down properly, you can corrupt the SD card!

# Circuit

### When SWITCH => ON

The 5V from the DC regulator will go through D1 and will power the Gate of Q1. While putting Q1 High C1 will start charging. And BCM_20 of the Raspberry Pi will go up.
Shutdown circuit

### When SWITCH => OFF

The remaining voltage before D1 will drain through R1 to the ground. So BCM_20 will become LOW, and the following code will run.
1
if not GPIO.input(20):
2
print('SYSTEM SHUTDOWN')
3
call("sudo shutdown -h now", shell=True)
Copied!
C1 will Load off his voltage to the Raspberry Pi, so that the Raspberry Pi has enough time to execute the command and shut down properly.

## RC Time Constant

Time constant curve
Time constant is a measurement of the time needed to charge or discharge a capacitor by ~63.2% of the difference between the old and new value after an impulse that induces when a change has been applied.
$t(s)=R(π) * C(F) = 10 000* 3,3=33 seconds$
The shutdown time of the Raspberry Pi is +-20 seconds, to be sure of a proper shutdown 33 seconds is used.

# IRFZ44N

IRFZ44N belongs to the family of N-channel Power MOSFETs, covered in plastic body and uses “Trench” technology. Its features include very low on state resistance, high speed processing technology, completely avalanche rated etc. Push pull systems and full bridge are a few of its real life applications.
IRF-Z44N has a few major features. For this project the IRFZ44N is used for his Fast switching capability and ultra low charge on the gate.
IRFZ44N

# Datasheet

irfz44npbf-1227773.pdf
227KB
PDF

# References

Electronic Components- Syed Zain Nasir(9/10/17)[SOURCE]