Auto-off Switch - High Side Switching vs. Low Side Switching.

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm working on a battery powered project, and I'm trying to implement an 'auto-off switch' (not sure if there's a more suitable term, if so by all means let me know) with the idea that a momentary button press switches power on from my battery to the rest of the circuit, and straight away the micro will hold a signal connected to the switching circuit in the desired state. Then if the micro detects no activity for some period of time it can set the signal to Hi-Z the signal and everything turns off.

I'm pretty sure I've got a very simple and straight-forward way of achieving this (though I'm open to suggestions) my only query now is whether to switch high or low...

 

So the circuits are as follows, this is the high sided switching version:

R1 is simply to keep the circuit off when the switch isn't pressed or uC Sig is Hi-Z. When the button is pressed it will pull the gate of Q1 low and thus current will flow - great. Then the micro that uC Sig is connected to will drive uC Sig low to keep the power on after the button is released. When I want to switch off I simply set uC Sig back to Hi-Z.

 

 

And now the low-sided switching version:

So this is basically an exact replica of the high sided version only G2 is an n channel MOSFET, the gates pulled low by default to ensure it's off, and the button and uC Sig will pull and drive high respectively.

 

Essentially what I'd like to know are the general pros and cons between high-sided and low sided switching, as well as any general advice on the matter and which way you guys would go if it were up to you.

My gut instinct is telling me that the high-sided switching method would be better since it actually removes power from the load rather than ground, and also as the Rds on of the FET will cause the two grounds either side to be slightly different from one another in the low sided version. (Of course the same applies to the actual voltage for the high sided version, but the Vcc being slightly less seems like less of an issue than the ground levels being different).

 

Also, the battery is a Li-Po unit that will range from +3.0V to +4.2V if that's of any significance...

 

This topic has a solution.
Last Edited: Tue. Mar 28, 2017 - 08:20 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think either circuit will work. I think r2/3 are swapped with the switch.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Note that it's "High/Low-Side" - not "sided" - because the switch goes in the high or low side of the supply.

 

http://www.lmgtfy.com?q=high+vs+low+side+switch+pros+cons

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
I don't think either circuit will work. I think r2/3 are swapped with the switch.
 

I'm not sure what you mean exactly by swapped?

 

But I've tested this in proteus in simulation and it works as I expected. I have R1 as a 10k and R2 as a 1K. When the button is not being pressed R1 keeps Q1's gate at Vin, and when the button is pressed it brings R2 into play which forms a divider, which brings the gate voltage down to just above 0 (with Vin = 4V, the 'just above 0' is 0.363669V to be precise ;) ) and thus the voltage at the drain goes from 0 to Vin (which in reality will of course be ever so slightly less than Vin).

 

 

awneil wrote:

Note that it's "High/Low-Side" - not "sided

 

Noted. And I've already already googled, hence 

Howard_Smith wrote:
... the Rds on of the FET will cause the two grounds either side to be slightly different from one another in the low sided version....

which was actually taken from the top hit of your lmgtfy. I was looking for maybe a little more detail than that though, but perhaps that's all there really is too it? I might well be over-thinking this but I was hoping for some advice (and maybe even opinion) with respect to not just high side v low side, but implementing an auto-off switch, as I said in the OP - what would you do if it were up to you, and not just between the two, if there is a better way then I'm all for it!  

But if I am over-thinking then sure, I'll go with my gut and go high-side.

Last Edited: Mon. Mar 27, 2017 - 12:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Howard,

 

R2 should be placed where you have the switch. and the switch should be where you have R2 is what Russell is suggesting, but I think the switch should go from the fet's gate down to ground instead of from the uC signal output. In other words, put the switch on the gate side of R2. If the switch is across the uC output you could accidently short it and destroy the chip

 

Cheers,

 

Ross

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah I see now, so Russel was suggesting:

 

 

And you're suggesting:

 

with the idea being that R2 gives the output from my micro a bit of protection I presume? In truth I'm using an Xmega so I'll be configuring the particular pin to be either driven low or Hi-Z so I can't see any issues there? But a good idea none the less so I shall indeed do that!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Correct!

 

A one cent protective resistor can save you dollars of anger management therapy. cheeky

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:
A one cent protective resistor can save you dollars of anger management therapy. cheeky

 

Indeed!

 

Moving forward something I hadn't accounted for was the fact that I'll also be charging my battery. Because of this I need current to flow in both directions, so my immediate thought was that I would have to switch the low side, however after giving it some more thought I'm now thinking that neither high nor low side switching will work in this case given that I need to draw power from, and feed power into the battery to charge it. Am I right in saying that or will low-side switching still work? (I'm using a BQ24075 to charge the battery if that's of any significance, and a BQ27441-G1 to monitor it)

 

EDIT: If anyone reads the BQ24075s datasheet they'll probably see and then suggest I use it's SYSOFF signal to achieve this, however that still leaves both the charging IC and the battery fuel gauge still drawing power, albeit little power, but power none the less, so I'm looking for a way to do this that means that no power is drawn at all when the system is off (if that's possible of course!)

Last Edited: Mon. Mar 27, 2017 - 01:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to quantify how much power is an issue. The batteries themselves self-discharge, so drawing some current may be insignificant.
A recent project of mine used a 150mAh lipo and a LDO reg with shutdown. It has leakage current. The battery still has good voltage after three months. What is the leakage current? Low I expect! I've estimated nor measured it yet.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
You need to quantify how much power is an issue.

 

Up until now I hadn't thought about any actual figures, simply set myself the task of implementing a momentary on/off (or auto-off switch as I referred to it in my OP) in a way that draws zero power when off, however as you said 

Kartman wrote:
The batteries themselves self-discharge, so drawing some current may be insignificant.

Looking at the datasheets of the two TI power management chips I'm using, the fuel guage can be set to hibernate in which case it only draws 9uA. I'm not sure about the charging ICs current draw when deactivating it via the SYSOFF signal, but the best I can tell from the datasheet is that it's 6.5uA.  So a total of 15.5uA from the circuitry.

 

The battery is a 1200mAh unit from Adafruit and so far I haven't found anything with regards to it's leakage current, but I did a quick google which gives a general value of 5% (per month) for Li-Po batteries, so going off that amount to 60uA of leakage from the battery, which would stack up the systems power draw when off to 75.5uA, and for a little contingency I'll round that up to 100uA, which would mean my battery would last for 1200/0.1 = 12,000 hours = 500... I can probably live with that haha! So it looks like I'll be using the SYSOFF signal after all blush

 

Thanks for the responses, I feel that this thread has been somewhat pointless with regards to the OP given that the end result/ answer (at least for me) was neither high side or low side switching (though if it weren't for the added complication of charging I'd say that high-side switching would've been the way to go) but you never know who might stumble across it and find it of use, and I got an answer to my own query too, that's a win in my book cheeky

 

Edit: typo and clarification

Last Edited: Tue. Mar 28, 2017 - 08:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you additionally wire the switch terminal (through say 1k for protection) to an adc pin you can detect if the switch is pressed during "on", in case you want to shut off right away (rather than wait).  Also, if in the future, Vin is more than the micro can tolerate (say 12V), then you should instead run the micro output into a small grounded fet (rated for the input voltage) to pull down the high fet gate (though a divider if you want to detect buttons during "on").  Otherwise during off, the micro pin will be over driven to Vin.  But it might clamp to the micro's internal clamp, which would cause the high fet to turn on.   

 

With the added fet when the micro output is low (or high z), the lower fet is off allowing the high gate to pull to its off level.

When the mentioned added fet is on, it pulls to gnd through a divider, turning on the high gate (if Vin is really high, say 40v) the divider also protect the high fet gate (Vgs max usually rated to 10  to 20 volts).

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Tue. Mar 28, 2017 - 10:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's a nice idea, I was originally going to have a touch button to turn the system off right away since the project already has a touchscreen anyway, but that might be another way to go. Thanks for the suggestion!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi there,

 

Howard, does your circuit work this way? Did you measure how much it actually leaks?

 

I was looking for something similar, i.e. a push button to turn on the AVR and some LEDs, sensors, etc. (building a toy for my son...). I was considering the same (NMOS) variant, however I was afraid to leak some current through the two Resistors and protection Diodes of the I/O pin of the AVR.

 

For the PMOS variant the Diodes create a path from supply voltage through resistors to the VCC of the AVR (and other components connected to that part of the circuit). The same effect can be seen for the NMOS variant: You have a small current flowing through the resistors and clamp diodes to the AVR's GND. This may not drive the AVR directly, but drive current into the part of the circuit that's supposed to be off. With that, you may charge a capacitor up to a threshold where you turn on the AVR until it discharges the cap below threshold, and so on... ultimately you drain the batteries or eventually (worst case) end up in some state where the AVR "thinks" it's been turned on by the switch an keeps itself awake for a while...

Even if the worst case scenario doesn't happen, you still have some current flowing. With R1+R2 = 20k and neglecting the dropout voltage through the diodes, I expect 0.25mA maximum leakage current. This isn't much, but for a battery application still a considerable amount.

 

Looking for something more efficient, I've created this circuit. When the switch is pushed, AVR's GND is connected to GND via D0, depending on the type of diode you use, this is 0.2..0.7V above GND. The AVR then pulls the pin connected to power_ctrl to low, enabling Q2 and Q1. The Diode is there to make the switch "readable" even if AVR_GND is at (or near) GND level. Once the machine is running, it enables the pullup at the switch_status pin to be able to detect when it's pulled to GND.

 

 

auto off circuit

 

I haven't yet verified if this works, but I assume it does :)