Tuesday, 3 March 2015

How to massively overcomplicate things

All this nonsense is an on/off switch.

What started out as a conversation about making something hard to accidentally switch off, without making the on switch fiddly, has turned into me thinking about how to incorporate a software controlled power switch.

A bit of googling suggested this isn't something tons of people are interested in but also a lot of messing around with discrete components to make bistable latching switches.

I'm going to be short on space in the project I want this for, so resolved to try something super simple. Also despite having actually studied electronics back in the 1980s I remember about as much of it as I do my French.

Here I've an N-channel MOSFET in line with the ground supply to an Arduino Nano. Pushing the switch brings the MOSFET gate high, which completes the path to ground and the Arduino starts. As soon as the sketch runs it uses one of the pins to keep the MOSFET gate high.

It seems to work just fine. So am I missing something, is there anything more to it than this?


The solidly lit LED is the Arduino power and the flashing one is controlled by the Nano. After 10s it automatically shuts down, but now that's controlled by software the conditions for this can be pretty much whatever I want. The MOSFET's going to leak <1uA when the gate's low but that pretty much counts as off as far as I'm concerned.

Going back to the reason for this, I'm making something small-ish which includes a mix of 5V and 3.3V tolerant components, all powered by an unprotected LiPo. Which might be nominally 3.7V but is going to have a floating voltage of about 4.2 freshly charged. Which will kill the SRF radio. So it needs a 3.3V regulator which will suck power. Also, flattening the LiPo by forgetting to switch it off will kill the LiPo. So I want a way for it to shut itself down if the voltage gets low. Being able to make it only shut down when you want or shut it down by sending commands over the radio becomes a bit of a bonus.

So this is another little piece of the puzzle worked out.

No comments:

Post a Comment