Auto turn off
Auto turn off. No switch, just a button to turn it on
The only mechanical stuff at this design is the turn on button (well, apart from the connectors, and maybe the piezo if you are purist). This button is an SPNO type (Single-Pole Normally Open). What happens when the button is pressed is that it turns on a PMOS transistor, and this PMOS lets the step-up converter to start working, supplying the 3.3V to the microcontroller's regulator, and so, turning on the microcontroller. Connected in parallel to this turn on button, there is an NMOS transistor, which is then enabled by the microcontroller. In this situation, it is like if the button was always pressed, even if you release it, since the PMOS transistor will remain in the ON state until the NMOS transistor is disabled. Can you see the feedback? So, that is why it can be auto turned off: the microcontroller decides when to turn off just turning OFF the NMOS transistor.
But... why not to use a mechanical switch? Which is the main difference? Well, the microcontroller may decide to turn the device off if some period of inactivity has been detected. If a 2 position switch was used, you could forget to turn the device off and the battery would be fully discharged, which by the way, is not a good practice in Li-Ion batteries (it makes its life shorter, mainly when the voltage drop below approx 2.8V).
This design also offers a trade-off. When you use a MOSFET as a solid state switch, you want it to have a low RDS(on), because otherwise, the resistive component of the MOSFET would act as a normal resistor, and some voltage would appear because of the device current (simple Ohm's law). It is wasted power, and would decrease the input voltage of the regulator, as well as increase the input impedance of the voltage regulator (a bad thing, mainly at DC/DC switching ones...). But on the other hand, a really low RDS(on) transistor offers a higher leakage current when it is blocking the voltage (that is, Vgs=0V). What does it mean? That the self-discharge rate of the battery will increase.
Here I will show the method I used to consider which is a good range for all the sum of leakage currents I can afford in my circuit. I will just take a look at the self-discharge rate of Li-Ion batteries. All batteries are self-discharged even if nothing is connected to its terminals, and in fact, Li-Ion batteries are the best at this, since they have the lowest self-discharge rate (together with the Li-Poly batteries).
Here there is some data, taken from Wikipedia:
Self-discharge rate (per month):
- 8% at 21 °C
- 15% at 40 °C
- 31% at 60 °C
Let's suppose an 8% (the worst case for us). I'm using a 750mAh battery. The 8% of 750mAh (a measure of energy, that is, Power times Time) is 60mAh/month. Changing the units, we find out that 60mAh/month are 83µAh/hour, which in fact are 83µA. That is, the equivalent circuit or model of the self-discharge feature could be simplified by an ideal 750mAh charged battery with a current source of 83µA. It gives an idea about the leakage current we may have. Currents much lower than this value will have no influence over the self-discharge rate, since the 83µA will predominate.
The leakage current he have is not only because of the PMOS MOSFET, but also from the Li-Ion battery charger. It must be directly connected to the battery to reduce any source of DC resistance, since we already saw that the 4.2V limit must be really accurate (0.75% in my design), and the charging current itself could add some error if this DC resistance is not kept low. That is because the voltage is measured after the cables (at the charger IC), not just after the battery connectors. In high current chargers, if the DC resistance can not be kept low for some reason, it is a good idea to sense the battery voltage using a 4-wire measurement system (like the principle used in Kelvin resistance measurement). That is why I can't connect the charger AFTER the PMOS transistor.
Anyway, the Li-Ion battery charger have a worst case of 2µA when the input voltage is lower than 3.2V (situation when the device is turned off - data taken from its datasheet).
Another source of leakage current is the NMOS transistor connected in parallel to the button which turns on the PMOS one. This NMOS transistor is not a problem at all. The reason is the trade-off between low RDS(on) and leakage current. Since the function of the NMOS transistor is just drive the gate of the PMOS one, it can have a high RDS(on), and so, really low leakage currents. A cheap and typical BSS123 fits perfectly to perform this job.
And finally, the last element. It can be considered as leakage current because of its really low supply current, although not being one: the real time clock. It uses a really special LDO regulator which only consumes 500nA typ, and the microcontroller just consumes about 3µA to keep the low frequency crystall oscillator running and few more simple features.
So, it seems clear we can stay below 83µA quite easily, and thus we can say the self-discharge rate is only due to the battery itself, like it should be.
Schematic:
English
