I've got an accelerometer with a couple interrupt pins and I've figured out how to get it to fire its interrupts on any change in acceleration or lack thereof for a given duration.

What I want to do is have it switch a 3.7v battery power supply on and off based on the interrupts - if no change in acceleration for a couple of minutes, have the interrupt latch the power off to the rest of the device. And conversely, if the device is already in the powered off state, have it latch the power back on the instant you pick it up. Obviously for this to work the accelerometer always needs to be powered and can't latch power off to itself.

How can this be accomplished? Don't cringe but is there such a thing as a "toggle" transistor?


What you want is a high-side PMOS switch. That is a P-channel, enhancement-mode MOSFET between the 3.7v battery and the load. Many of these exist today for precisely this purpose, capable of passing up to 50A or so. To keep it "off", tie the gate to 3.7v with a 100kΩ resistor. This will keep the gate at 3.7v normally. To turn it on, pull the gate to ground. If you suspect lots of electrical noise near this circuit and/or want faster turn-off, decrease that resistance value. There is a lot more to this, but that is the basics.

If the interrupt pin is an open-collector type, and is active-low, then tying that to the gate directly should do it. Low = on, open = 3.7v. Verify with the device datasheet that the pin can handle 3.7v.

If it is not open-collector, and the digital logic voltage is less than 3.7v (such as 3.3v or 1.8v), then that is an issue. Most pins have clamping diodes on them internally, and raising a pin above Vdd always has bad consequences. In that case, just use an NPN transistor to sink the gate current. That "isolates" the 3.7v from the pin, which now behaves as High = on and Low = off.

LTspice PMOS Switch Simulation

Note that the IRF7406 is a 3A device. If you need more current than this, then a different MOSFET will be required. Likewise, if you only need 100mA, then a physically much smaller one can be used instead. Also note that MOSFETs are very sensitive to ESD. Safe handling precautions are required.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.