Main Site Documentation

Soft power switch


I want to implement a soft power switch on a Panda - like how you switch on a cellphone (hold it down for 3 seconds)…

So usually there is a pushbutton and a MOSFET. The button activates the MOSFET, powers up the Panda and then the Panda “holds” the MOSFET through an IO pin. Simple enough.

The problem I have however is that I want this power button to be one of many on a matrix keypad. The button is not dedicated to the on/off function and it shares a row and column in the matrix with other buttons - so I can’t tie one side of the contact high or low permanently - and it will fluctuate as the matrix is scanned.

Any ideas how to do this?

Is there a way to put the Panda in very deep sleep (drawing micro-amps) and wake it up by keypad?

Is there an IO pin that can sink a current when the processor is not powered at all?


Yes there is hibernate mode on our devices


What kind of battery are you using?

I use Lipo monitor chips that can disconnect the battery from the rest of the circuit. It has a “power switch” input that will reconnect the power to the system, and a write to its internal register allows the CPU to power off the circuit at will.

You get ones that interface via I2C and via onewire. They also then gives you full battery fuel gauge functionality… :slight_smile:


@ Errol, that sounds handy for my project. Can you provide a link to the one you use?


Previously I used this:
It is I2C and not too bad. You have to tell the chip what the current cell capacity is.

Now i’m looking at this:
It’s onewire and it auto learns the cell characteristics. Plus it contains an SHA engine where you can store a secret in the chip and do hardware validation of the secret. Hardware design is more or less identical to the first chip.

BTW, both are for single cell use.


You had till the last line… :frowning: I’ll dig around and see if there are some 3-cell compatible ones. Thanks!


I shy away from multi cell lipo packs. The require cell balancing, individual cell measurement for cell under/over voltage, and charging is a pain.

I find that it is easier to buck/boost the 3V-4.2V to the required 3.3V, 5V or 12V.

You could look at:
But I don’t know what the eval kit costs, which you need for the programmer, as it is a complete battery management CPU.