Author Topic: Simple car radio battery automatic cut off  (Read 1206 times)

0 Members and 1 Guest are viewing this topic.

Offline simcop2387Topic starter

  • Contributor
  • Posts: 13
Simple car radio battery automatic cut off
« on: April 24, 2020, 07:12:46 pm »
tl;dr https://github.com/simcop2387/Radio-Power

So before all the lockdowns started I put a new fancy android headunit in my car and it works pretty well (there's some small quirks i'm still working on), but I've now learned that there's a tiny issue with it.  In standby mode it draws enough power that after 1.5-2 weeks of the car not being started, the battery will be drained.  This is apparently somewhat common with android headunits apparently from some searching and the common fix is to rewire the power so that it can't go into standby mode and instead just gets completely de-powered.  This is easy, simple and makes sense to do, but it also means that you have a ~60 boot up time each time you start the car.  This is completely utterly unacceptable and means that the entire car is now useless and unfit for any purpose.

So instead I've started designing a different solution with the following goals:
  • Monitor the battery voltage to decide when to disconnect power
  • Turn off power after some large time period, regardless of the battery

I'm attempting to do this with an attiny85 (I have many lying around), and using a p-channel mosfet (FQP27P06) and some BS170s to drive it.  There's all the kicad files in the repo above and i'm attaching a png to the post too for anyone who doesn't like to leave the forum.  I haven't written the code for the controller yet but it'll basically just sleep for a minute or so while holding the mosfet closed and then check the battery voltage (I'm planning on 11.75V as the threshold) when it wakes up.  It'll also count down each time it wakes up for something like 4 days or so and then just let it all get powered down.

What I'd like is a sanity check that I haven't missed anything critical on the design that's going to bite me.  The only potential issue I see is the voltage dividers for detecting if the car is on (the ACC line) and the battery voltage line.  I haven't included any clamping diodes since I've chosen then to take 16V to 3.8V on the input, and any higher spikes I'm expecting the internal clamping diodes to handle.  I've thought about maybe a small capacitor on them after the divider to just knock anything down even more but I'm not sure that's necessary.

There's also gerber files in the repository but I'm not fully done with them yet.  I need to pick a proper footprint for the input and output terminals and I'm thinking I'll also redo the layout once more when I finish that.
« Last Edit: April 24, 2020, 07:19:17 pm by simcop2387 »
 

Offline viperidae

  • Frequent Contributor
  • **
  • Posts: 306
  • Country: nz
Re: Simple car radio battery automatic cut off
« Reply #1 on: April 24, 2020, 08:12:59 pm »
I would start by putting the voltage divider on the switched side, maybe increase the values of the resistors too, with a capacitor to filter out noise. No point burning 2mA if you don't have to.
You might also find that having power applied to an io pin when the MCU isn't powered can cause problems. Especially unfiltered, unclamped power during engine cranking.
 

Offline DBecker

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Simple car radio battery automatic cut off
« Reply #2 on: April 24, 2020, 08:39:02 pm »
A L7805 isn't the best choice in this application.  The quiescent current is much higher than more modern regulators.

With a sufficiently robust and efficient regulator you can just leave the ATTiny constantly powered in standby/watchdog mode.

Using an automotive high-side switch can simplify the power switch, albeit with a less common component.

The resistor divider is not a significant power draw if you increase the resistor values, but you can use a small MOSFET to switch the current flow on only when needed.

 

Offline simcop2387Topic starter

  • Contributor
  • Posts: 13
Re: Simple car radio battery automatic cut off
« Reply #3 on: April 24, 2020, 08:39:42 pm »
... You might also find that having power applied to an io pin when the MCU isn't powered can cause problems. Especially unfiltered, unclamped power during engine cranking.

This is one bit that I have been a little worried about but I'm honestly not entirely sure what to do about it.  I suppose that's a good argument for the capacitor and maybe my own more aggressive clamping diode.  I know given the right conditions you can power some of these small uC's over the data pins too.  I suppose that using some higher value resistors to limit the current would make that less of an issue too.  As would using the switched side instead.  I'll update it tonight with those changes then (switched side and cap).

 

Offline simcop2387Topic starter

  • Contributor
  • Posts: 13
Re: Simple car radio battery automatic cut off
« Reply #4 on: April 24, 2020, 11:59:40 pm »
A L7805 isn't the best choice in this application.  The quiescent current is much higher than more modern regulators.

With a sufficiently robust and efficient regulator you can just leave the ATTiny constantly powered in standby/watchdog mode.

Any recommendations for something better? I've got some switching stuff but what I do have doesn't really like the 10s of uA range of things really, which is why I decided a cheap linear regulator is probably a better choice.   A good bit of the part choice is just what I have lying around.  Only thing I don't have handy is the p-channel mosfet, since I wanted something that could handle the theoretical full 10A on the circuit.

Using an automotive high-side switch can simplify the power switch, albeit with a less common component.

The resistor divider is not a significant power draw if you increase the resistor values, but you can use a small MOSFET to switch the current flow on only when needed.

What do you mean by automotive high-side switch and how does it differ from a p-channel mosfet like the FQP27P06?
 

Offline simcop2387Topic starter

  • Contributor
  • Posts: 13
Re: Simple car radio battery automatic cut off
« Reply #5 on: April 25, 2020, 03:40:36 pm »
Found the LM2936, which looks like a much nicer product for this application.  Updated the repo above, but here's the updated schematics and a board view.

Still using the mosfets for switching since what I could find on using an automotive high-side switch makes it look like it'd end up much more complicated for control since it looks like they're all digitally controlled (at least browsing TI's catalog).  That would require the uC to stay powered even after the radio is disconnected which I'd rather not do if not necessary. 
 

Offline DBecker

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Simple car radio battery automatic cut off
« Reply #6 on: April 25, 2020, 06:04:03 pm »
Yes, that's a good regulator for this purpose.  Not especially cheap, but readily available at a good qnty-one price.

High side switches are effectively a P-MOSFET, but the features (temperature and current protection, direct logic level input, gate protection) well worth the price when you need robustness or it's a low volume design.

 

Online Someone

  • Super Contributor
  • ***
  • Posts: 5156
  • Country: au
    • send complaints here
Re: Simple car radio battery automatic cut off
« Reply #7 on: April 25, 2020, 11:05:43 pm »
This is easy, simple and makes sense to do, but it also means that you have a ~60 boot up time each time you start the car.  This is completely utterly unacceptable and means that the entire car is now useless and unfit for any purpose.
Any purpose, you know, like driving the car to transport people and/or goods to other places.... completely impossible without a multifunction entertainment system that turns on within seconds?

So over the top/exaggerated it was actually funny.

I would start by putting the voltage divider on the switched side, maybe increase the values of the resistors too, with a capacitor to filter out noise. No point burning 2mA if you don't have to.
You might also find that having power applied to an io pin when the MCU isn't powered can cause problems. Especially unfiltered, unclamped power during engine cranking.
If the sampling is only done on the switched side the only time there might be some current in the protection diodes is when the linear reg turns on, where some "fix is needed" is for reverse transients (or just backward connection) on the power input.

In general this circuit needs to consider the poor quality and transient nature of automotive power, parts with only 20V ratings directly connected, no reverse polarity protection. It wouldn't last long in its current state.
 

Online NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9321
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Simple car radio battery automatic cut off
« Reply #8 on: April 26, 2020, 02:57:40 am »
What about implement a low voltage cutoff the analog way? As in a voltage divider to a comparator with hysteresis.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline simcop2387Topic starter

  • Contributor
  • Posts: 13
Re: Simple car radio battery automatic cut off
« Reply #9 on: April 26, 2020, 03:17:16 am »
What about implement a low voltage cutoff the analog way? As in a voltage divider to a comparator with hysteresis.

I thought about that, but then I'd still need something for a time based cut off anyway.  I figure if I haven't started the car in a few days then it's fine to just go ahead and then cut the power regardless of the battery.  Doing all that with all analog anyway just ends up much larger physical size and not cheaper either.

This is easy, simple and makes sense to do, but it also means that you have a ~60 boot up time each time you start the car.  This is completely utterly unacceptable and means that the entire car is now useless and unfit for any purpose.
Any purpose, you know, like driving the car to transport people and/or goods to other places.... completely impossible without a multifunction entertainment system that turns on within seconds?

So over the top/exaggerated it was actually funny.

That was the intent so I'm glad that came across :) it's as much just scratching an itch to design something as it is to solve a first world problem.

Quote
I would start by putting the voltage divider on the switched side, maybe increase the values of the resistors too, with a capacitor to filter out noise. No point burning 2mA if you don't have to.
You might also find that having power applied to an io pin when the MCU isn't powered can cause problems. Especially unfiltered, unclamped power during engine cranking.
If the sampling is only done on the switched side the only time there might be some current in the protection diodes is when the linear reg turns on, where some "fix is needed" is for reverse transients (or just backward connection) on the power input.

In general this circuit needs to consider the poor quality and transient nature of automotive power, parts with only 20V ratings directly connected, no reverse polarity protection. It wouldn't last long in its current state.

All the parts are rated for 40V (LM2936 and 40V transients on the BS170 gate) or 60V (FQP27P06 and BS170 source drain), which parts are you seeing are rated for 20V?  There's reverse polarity protection through the p-channel mosfet, it'll never turn on in a reverse polarity situation.
 

Offline simcop2387Topic starter

  • Contributor
  • Posts: 13
Re: Simple car radio battery automatic cut off
« Reply #10 on: April 26, 2020, 03:31:05 am »
Yes, that's a good regulator for this purpose.  Not especially cheap, but readily available at a good qnty-one price.

High side switches are effectively a P-MOSFET, but the features (temperature and current protection, direct logic level input, gate protection) well worth the price when you need robustness or it's a low volume design.

I've already got a fuse on there so I'm not worried about the current protection and I'm not terribly worried about temperature either since this'll be internal to the dash (though all the parts are rated for 85C or so in non-use.  I've also rated the mosfet to be able to handle many times as much current as it'll normally see (3A typical, 10A circuit) so I'm not worried about it overheating either, and if needed I can throw a heatsink on it to get the full 20A it's rated for.  That said if I was going to run a more complicated device I'd probably really look at one of those they sound nice.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf