When I integrated the TrinketPro into the bag movement alarm prototype project, the power circuit did not work. So I needed to redesign the power circuit.
Jan 15, 2020 P-Channel MOSFET: Unlike the N-channel, the drain and the source are doped with p+ impurity while the substrate is in n-type The current flows through the P-channel MOSFET When a negative voltage is appleid on the gate, the electrons underneath the sulfur oxide respond to the flow of current and get pushed downwards into the substrate. The PWM signal from pin D9 of the arduino is integrated or filtered by the combination of R1 and C1. The values shown work well an operating frequency of 1.95KHz or 13 bit operation with 8192 steps (2 to the power 13 = 8192). If you decide to use a different number of steps then you may need to change the R1 and C1 values. How to Check P-Channel Mosfets. For P-channel the testing steps will be as per 1,2,3,4 and 5, but the polarities of the meter will change. Here's how to do it. 1) Set the DMM to the diode range. 2) Fix the mosfet on a dry wooden table on its metal tab, with the printed side facing you and leads pointed towards you. The IRLI520NPBF is a better choice over the IRF540N but the IRL540 is better yet with an Rds of 0.077 ohms that's 1/3 of the IRLI520NPBF Rds. Plus the IRL540 can handle a bit more amps. Also the NDP6020P is a true logic level P-channel MOSFET, the IRF5210 is not.
I had posted a question about this in the Arduino.cc forum, where forum user dlloyd had helpfully pointed me to an excellent explanation of using MOSFETs as power switches. I found a very useful circuit diagram:
Cached
It uses two MOSFETs: a P-channel MOSFET up top, and then an N-channel MOSFET at the bottom. The EN is the pin by which you control the bottom MOSFET: when it is high, you allow the N-channel MOSFET to open and pull the gate pin on the P-channel MOSFET to ground (it is normally pulled high to the VIN+ through resister R1), opening the P-channel MOSFET to connect the Load to the VIN+.
P Channel Mosfet Arduino Programming
I set this up on another small breadboard, without a button, to test it out. It worked, and was super stable (unlike before, where I had to adjust the pot periodically). I used a 10k resistor for R1.
The new power circuit in all its glory:
New MOSFET power circuit