I have seen low voltage dropout regulators where they allow or disallow current from passing through based on the voltage supplied. Is there a way to achieve similar functionality but based on mAh. I want to power an arduino using a mosfet connected to a button (the enable), a battery (input) and finally pointed to the arduino. After the arduino is on, I could simply have a gpio pin pull the mosfet high and have it keep itself powered (even after the user released the button). I would like to have a "Low Current Dropout" regulator instead of using the gpio, so when I put the device into deep sleep and the current drops, the device will power off.
In this image, the button powers the mosfet and the arduino, the arduino should be pulling 60mAh once started after a few hundred millis. The low current dropout would drop out if it fell below a few mAh.
Does such a part exist? Can someone send me some links or give a name for this? I am really new to pcb design and thought I could save a gpio pin this way.
Maybe. If you change your FET to a P-Channel device with low Vgs (2.7V or less) you can connect the arduino pin directly to the gate. You may want to add a pull up resistor to the gate. Why bother putting it into deep sleep if you are going to power it down, simply turn it off by setting your port pin High.
What do you mean by port pin high in this situation? I'm confused on how the device would power itself down without taking up one of the few gpio pins it has. The idea of putting it into deep sleep is that it would draw less mAh and thus the low mAh dropout would drop the mosfet to low and the arduino would lose power and stop consuming battery.
What happens is when you push the button the Arduino powers up, it then your software drives the port pin connected to the gate of the MOSFET low turning the MOSFET on. That will power the Arduino until there is no power. After that opening the pushbutton will have no effect. When it is time to shutdown the Arduino drives the pin connected to the gate of the MOSFET high, this turns it off allowing the power on the arduino to go low (off). This is a lot easier then sensing current. Using the N-Channel MOSFET as you have will not allow the Arduino to turn off, the Substrate diode will conduct power. The P-Channel MOSFET the substrate diode is reversed but the gate also works in reverse, it needs to be negative to the source to turn on.
I know it would be easier, but I have a limited number of IO pins (4) and I cannot waste one for this purpose. How would one even go about this, where should I look for more info? I am sorry about my diagram, a P-Channel mosfet would be correct for the layout above.
You stated: "I could simply have a gpio pin pull the mosfet high and have it keep itself powered " That is what you answer does except it has High and Low inverted. Or you not going to use that pin for what you stated? Schematics always help resolve these questions rapidly. Remember I cannot see your project nor to I know your resources or skill set.
I said this in the next sentence, I had the idea of using a gpio in general. This specific project will not allow that though. I need a circuit that cuts off the mosfet when the mAh draw is too low. I have a general idea of what's needed, I'm just not too a very high level when it comes to skills ( I didn't know about the mosfet being a N-channel). I am willing to get what resources are required from LCSC preferrably.
To my knowledge there is no such thing as a low current dropout regulator. What is your supply voltage. per your drawing it is 3.3V Is there more available? Is there a regulator in the circuit? As far as a shopping trip to LCSC that is your job. What other components do you have in the circuit. To measure current inexpensively you will either have to use a hall device or resistor.
This is not my CAD machine so I loaded KiCad to get you this drawing. Here is a circuit that will do what you want. The transistor is a Germanium. If you want to use silicon you need to place 2 diodes in series for D1 unless you can get a sensitive PNP transistor. Your button goes from V input to the regulator Vin. When you push the button the regulator will output 3.3V for the Arduino. It starts and draws current. This will cause a voltage drop across R1, turning Q1 on. This in turn will turn Q2 on which will drive the gate of the P-MOSFET negative in respect to the source turning it on. It will stay in that state until the current goes below the level determined by R1. R3 assures the MOSFET will turn off and R2 limits the current into Q2. None of the values are critical. I used generic parts as I do not have the time to go through LCSC database and look up what you need. Note I placed both bulk and hi frequency bypass caps on both sides of the regulator. 25 uF on the output would be OK maybe 100uF on the input. Use maybe 100nF on the bypass but check the regulator data sheet. You need to pick the appropriate regulator for your design, I just grabbed something for the CAD program.