Author Topic: Building a car battery monitor. How to determine the wattage for voltage divider  (Read 3145 times)

0 Members and 1 Guest are viewing this topic.

Offline MarkSTopic starter

  • Supporter
  • ****
  • Posts: 878
  • Country: us
As the title says. I'm going to use a Raspberry Pi Pico with a 10:1 voltage divider. I understand Ohms law, but I'm having a heck of a time figuring out the amperage to calculate the resistor wattages. From what little I know about this, I know I should plan for worst case spikes up to 100v, as this will monitor the battery from engine start, so I'm using a 100K:10K divider with a 3.3v Zener to clamp the voltage. Right now, I'm thinking I should use panel mount resistors and have two in my Digi-Key cart at 50 watts each, but that's just an uneducated guess. Is that too low? Too high? Just right? No idea!


How do I go about this?
 

Offline themadhippy

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
what sort of voltage is being dropped across the resistors and what sort of current does the pi input need? 50w sounds about 100 times to much
 

Offline MarkSTopic starter

  • Supporter
  • ****
  • Posts: 878
  • Country: us


Quote from: themadhippy on Today at 09:22:36
what sort of voltage is being dropped across the resistors and what sort of current does the pi input need? 50w sounds about 10 times to much



The pi's ADC is 3.3v. The voltage being dropped across the resistors will vary, depending if the engine is running or not. I would safely estimate the drop to be between 8 and 11 volts, not accounting for spikes at engine start. Anything above 36v at the input to the divider will be clamped by the Zener to 3.3v.
 

Offline TomKatt

  • Frequent Contributor
  • **
  • Posts: 609
  • Country: us
  • Electro-BOOMER
I always try to avoid reinventing the wheel whenever possible  ;)

https://github.com/kmcallister/rpi-battery-monitor

Several Species of Small Furry Animals Gathered Together in a Cave and Grooving with a PICt
 

Offline MarkSTopic starter

  • Supporter
  • ****
  • Posts: 878
  • Country: us


Quote from: TomKatt on Today at 09:28:50
I always try to avoid reinventing the wheel whenever possible  ;)

>https://github.com/kmcallister/rpi-battery-monitor





No fun there and I don't learn from it. ;)  Also, the voltages across the battery can vary wildly when connected in circuit. The alternator and starter can cause voltage spikes and I've read to allow for up to 100v. That project assumes 15-ish volts. This will be installed in the car.
« Last Edit: February 15, 2023, 03:33:11 pm by MarkS »
 

Offline TomKatt

  • Frequent Contributor
  • **
  • Posts: 609
  • Country: us
  • Electro-BOOMER
I always try to avoid reinventing the wheel whenever possible  ;)

https://github.com/kmcallister/rpi-battery-monitor



No fun there and I don't learn from it. ;)
Well, it explains the voltage divider and how the calculations work...

I always learn something when basing a project on something similar  :D
Several Species of Small Furry Animals Gathered Together in a Cave and Grooving with a PICt
 
The following users thanked this post: MarkS

Offline wasedadoc

  • Super Contributor
  • ***
  • Posts: 1730
  • Country: gb
As the title says. I'm going to use a Raspberry Pi Pico with a 10:1 voltage divider. I understand Ohms law, but I'm having a heck of a time figuring out the amperage to calculate the resistor wattages. From what little I know about this, I know I should plan for worst case spikes up to 100v, as this will monitor the battery from engine start, so I'm using a 100K:10K divider with a 3.3v Zener to clamp the voltage. Right now, I'm thinking I should use panel mount resistors and have two in my Digi-Key cart at 50 watts each, but that's just an uneducated guess. Is that too low? Too high? Just right? No idea!


How do I go about this?
If you know Ohms Law it is a small step to Power = Voltage multiplied by Current.
 
The following users thanked this post: MarkS

Offline MarkSTopic starter

  • Supporter
  • ****
  • Posts: 878
  • Country: us
I always try to avoid reinventing the wheel whenever possible  ;)

https://github.com/kmcallister/rpi-battery-monitor



No fun there and I don't learn from it. ;)
Well, it explains the voltage divider and how the calculations work...

I always learn something when basing a project on something similar  :D

Actually, I see that now. I need to calculate the wattage based on what the divider will consume....
 

Offline MarkSTopic starter

  • Supporter
  • ****
  • Posts: 878
  • Country: us
As the title says. I'm going to use a Raspberry Pi Pico with a 10:1 voltage divider. I understand Ohms law, but I'm having a heck of a time figuring out the amperage to calculate the resistor wattages. From what little I know about this, I know I should plan for worst case spikes up to 100v, as this will monitor the battery from engine start, so I'm using a 100K:10K divider with a 3.3v Zener to clamp the voltage. Right now, I'm thinking I should use panel mount resistors and have two in my Digi-Key cart at 50 watts each, but that's just an uneducated guess. Is that too low? Too high? Just right? No idea!


How do I go about this?
If you know Ohms Law it is a small step to Power = Voltage multiplied by Current.

And there in lies the issue. How much current?
 

Offline TomKatt

  • Frequent Contributor
  • **
  • Posts: 609
  • Country: us
  • Electro-BOOMER
Actually, I see that now. I need to calculate the wattage based on what the divider will consume....
P=IV

I=V/R

Assume 13.8 volts lead acid battery (current will increase with voltage with a fixed resistance circuit)
 I=13.8/565,000=0.0000244=24ua (from the 447K + 118K example in the article).

P=0.0000244 X 13.8=0.000337 watts

Common 1/4 watt resistors will suffice.  The last thing you want is to have your voltage divider consume any significant current, which will just heat things up and rapidly deplete the battery you're trying to monitor...
« Last Edit: February 15, 2023, 03:46:37 pm by TomKatt »
Several Species of Small Furry Animals Gathered Together in a Cave and Grooving with a PICt
 
The following users thanked this post: MarkS

Offline MarkSTopic starter

  • Supporter
  • ****
  • Posts: 878
  • Country: us


Quote from: TomKatt on Today at 09:44:15
Quote
I=13.8/565,000=0.0000244=24ua (from the 447K + 118K example in the article).

:palm: THIS is the step I was missing! Thank you!
 

Offline TomKatt

  • Frequent Contributor
  • **
  • Posts: 609
  • Country: us
  • Electro-BOOMER
I will say the example I offered is very basic and doesn't include any input protection (ie zener).  While there will be some spikes at the battery terminals, I think 13.8v is a good baseline to work with.
Several Species of Small Furry Animals Gathered Together in a Cave and Grooving with a PICt
 
The following users thanked this post: MarkS

Offline MarkSTopic starter

  • Supporter
  • ****
  • Posts: 878
  • Country: us
I will say the example I offered is very basic and doesn't include any input protection (ie zener).  While there will be some spikes at the battery terminals, I think 13.8v is a good baseline to work with.

I agree. I was just missing a step in the calculations. I'm going with 1watt, just to be totally safe, but that's really overkill. Thanks again.
 

Offline wasedadoc

  • Super Contributor
  • ***
  • Posts: 1730
  • Country: gb
As the title says. I'm going to use a Raspberry Pi Pico with a 10:1 voltage divider. I understand Ohms law, but I'm having a heck of a time figuring out the amperage to calculate the resistor wattages. From what little I know about this, I know I should plan for worst case spikes up to 100v, as this will monitor the battery from engine start, so I'm using a 100K:10K divider with a 3.3v Zener to clamp the voltage. Right now, I'm thinking I should use panel mount resistors and have two in my Digi-Key cart at 50 watts each, but that's just an uneducated guess. Is that too low? Too high? Just right? No idea!


How do I go about this?
If you know Ohms Law it is a small step to Power = Voltage multiplied by Current.

And there in lies the issue. How much current?
So when you wrote " I understand Ohms law" you were being economical with the truth.
 

Offline TomKatt

  • Frequent Contributor
  • **
  • Posts: 609
  • Country: us
  • Electro-BOOMER
In fairness, knowing an equation and knowing how to apply it to real world examples to solve problems are not always the same thing...
Several Species of Small Furry Animals Gathered Together in a Cave and Grooving with a PICt
 
The following users thanked this post: MarkS

Offline MarkSTopic starter

  • Supporter
  • ****
  • Posts: 878
  • Country: us
As the title says. I'm going to use a Raspberry Pi Pico with a 10:1 voltage divider. I understand Ohms law, but I'm having a heck of a time figuring out the amperage to calculate the resistor wattages. From what little I know about this, I know I should plan for worst case spikes up to 100v, as this will monitor the battery from engine start, so I'm using a 100K:10K divider with a 3.3v Zener to clamp the voltage. Right now, I'm thinking I should use panel mount resistors and have two in my Digi-Key cart at 50 watts each, but that's just an uneducated guess. Is that too low? Too high? Just right? No idea!


How do I go about this?
If you know Ohms Law it is a small step to Power = Voltage multiplied by Current.

And there in lies the issue. How much current?
So when you wrote " I understand Ohms law" you were being economical with the truth.

Not at all. Power = V*I. My issue was calculating I.
 

Offline shapirus

  • Super Contributor
  • ***
  • Posts: 1994
  • Country: ua
3.3v Zener to clamp the voltage.
This guy will destroy the accuracy of your readings when the voltage reaches about ~2.7-3.0 V, depending on the value of the divider resistors. The higher their value, the more the zener will spoil the fun. Unfortunately, zener diodes, especially in the lower values range, have a very smooth knee of the V-A characteristic curve where they begin to conduct. There's no sharp transition from the non-conducting to conducting state at the rated voltage.

Limiting input voltage is not a trivial task, unless measurement accuracy is not a requirement.

You could use a buffer op amp after the divider that has a resistor in series with the input pin whose value is selected so that max current when the input voltage reaches over Vcc+0.6V (and up to the max voltage you expect) doesn't exceed the maximum allowed value specified in the datasheet. Yes, it (ideally) requires that the opamp's datasheet actually specifies this and allows to exceed the voltage if you take measures to limit the current. Usually it's of the order of a few milliamps -- the input protection diodes are tiny. Then power the op amp with a voltage selected so that the possible output voltage swing does not exceed what is allowed for your ADC/microcontroller inputs. Once you do this, you realize that you now need to make sure that your Vcc rail does not go too high when it begins to sink current from the input divider coming via the opamp's input protection diode. This however is where a simple zener will do the job.

p.s. have you actually measured (with a scope or a DMM that can capture spikes) what happens when the engine is started? I am pretty certain that you won't see anything over 14 V there, first of all because the low internal resistance of the battery is going to shunt any such spike.
« Last Edit: February 15, 2023, 04:16:23 pm by shapirus »
 
The following users thanked this post: MarkS

Offline wasedadoc

  • Super Contributor
  • ***
  • Posts: 1730
  • Country: gb
As the title says. I'm going to use a Raspberry Pi Pico with a 10:1 voltage divider. I understand Ohms law, but I'm having a heck of a time figuring out the amperage to calculate the resistor wattages. From what little I know about this, I know I should plan for worst case spikes up to 100v, as this will monitor the battery from engine start, so I'm using a 100K:10K divider with a 3.3v Zener to clamp the voltage. Right now, I'm thinking I should use panel mount resistors and have two in my Digi-Key cart at 50 watts each, but that's just an uneducated guess. Is that too low? Too high? Just right? No idea!


How do I go about this?
If you know Ohms Law it is a small step to Power = Voltage multiplied by Current.

And there in lies the issue. How much current?
So when you wrote " I understand Ohms law" you were being economical with the truth.

Not at all. Power = V*I. My issue was calculating I.
Whichever one of the ways of writing Ohm's Law you know, the other two are easily obtained by schoolboy algebra.
V=IR
R=V/I
I=V/R
So why did you have an issue calculating I?
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 12800
  • Country: us
Not at all. Power = V*I. My issue was calculating I.

Ohm's law says I = V / R. You have V at a nominal 12 V and R at a nominal 100 000 ohms. So your current is about 12 / 100 000 which is about 0.0001 A or 0.1 mA.

For power calculations you only need a rough estimate and then add a safety margin.
 
The following users thanked this post: MarkS

Offline MarkSTopic starter

  • Supporter
  • ****
  • Posts: 878
  • Country: us
Not at all. Power = V*I. My issue was calculating I.

Ohm's law says I = V / R. You have V at a nominal 12 V and R at a nominal 100 000 ohms. So your current is about 12 / 100 000 which is about 0.0001 A or 0.1 mA.

For power calculations you only need a rough estimate and then add a safety margin.

It was a brain fart. Sorry for the smell! :)
 

Offline BeBuLamar

  • Super Contributor
  • ***
  • Posts: 1813
  • Country: us
With the divider using a 100K and 10K resistors from 12-14V you wouldn't need anything more than 1/4W.
 
The following users thanked this post: MarkS

Offline MarkSTopic starter

  • Supporter
  • ****
  • Posts: 878
  • Country: us
...snip...

Wow, were you ever correct! I breadboarded the circuit. I thought by "destroying accuracy", I'd lose a fraction of a volt at worst. NOPE! The higher the voltage, the worse the accuracy. At 12 volts I was reading around 10. I think I'm overthinking things. I'll just skip the zener.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf