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!
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.
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.
call("sudo shutdown -h now", shell=True)
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.
The shutdown time of the Raspberry Pi is +-20 seconds, to be sure of a proper shutdown 33 seconds is used.
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.