Building a car battery monitor. How to determine the wattage for voltage divider - Page 1
Forum section: electronics / beginners

author: MarkS
author_rank: Unknown
timestamp: February 15, 2023, 03:08:18 pm
content: 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?

author: themadhippy
author_rank: Super Contributor
timestamp: February 15, 2023, 03:22:36 pm
content: 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

author: MarkS
author_rank: Unknown
timestamp: February 15, 2023, 03:28:10 pm
content: Quote from: themadhippy onTodayat 09:22:36The 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.

author: TomKatt
author_rank: Frequent Contributor
timestamp: February 15, 2023, 03:28:50 pm
content: I always try to avoid reinventing the wheel whenever possiblehttps://github.com/kmcallister/rpi-battery-monitor

author: MarkS
author_rank: Unknown
timestamp: February 15, 2023, 03:29:26 pm
content: Quote from: TomKatt onTodayat 09:28:50No 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.

author: TomKatt
author_rank: Frequent Contributor
timestamp: February 15, 2023, 03:31:41 pm
content: Quote from: MarkS on February 15, 2023, 03:29:26 pmWell, it explains the voltage divider and how the calculations work...I always learn something when basing a project on something similar

author: wasedadoc
author_rank: Super Contributor
timestamp: February 15, 2023, 03:33:23 pm
content: Quote from: MarkS on February 15, 2023, 03:08:18 pmIf you know Ohms Law it is a small step to Power = Voltage multiplied by Current.

author: MarkS
author_rank: Unknown
timestamp: February 15, 2023, 03:35:32 pm
content: Quote from: TomKatt on February 15, 2023, 03:31:41 pmActually, I see that now. I need to calculate the wattage based on what the divider will consume....

author: MarkS
author_rank: Unknown
timestamp: February 15, 2023, 03:38:35 pm
content: Quote from: wasedadoc on February 15, 2023, 03:33:23 pmAnd there in lies the issue. How much current?

author: TomKatt
author_rank: Frequent Contributor
timestamp: February 15, 2023, 03:44:15 pm
content: Quote from: MarkS on February 15, 2023, 03:35:32 pmP=IVI=V/RAssume 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 wattsCommon 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...

author: MarkS
author_rank: Unknown
timestamp: February 15, 2023, 03:45:57 pm
content: Quote from: TomKatt onTodayat 09:44:15QuoteTHIS is the step I was missing! Thank you!

author: TomKatt
author_rank: Frequent Contributor
timestamp: February 15, 2023, 03:49:29 pm
content: 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.

author: MarkS
author_rank: Unknown
timestamp: February 15, 2023, 03:51:45 pm
content: Quote from: TomKatt on February 15, 2023, 03:49:29 pmI 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.

author: wasedadoc
author_rank: Super Contributor
timestamp: February 15, 2023, 04:03:45 pm
content: Quote from: MarkS on February 15, 2023, 03:38:35 pmSo when you wrote " I understand Ohms law" you were being economical with the truth.

author: TomKatt
author_rank: Frequent Contributor
timestamp: February 15, 2023, 04:08:16 pm
content: In fairness, knowing an equation and knowing how to apply it to real world examples to solve problems are not always the same thing...

author: MarkS
author_rank: Unknown
timestamp: February 15, 2023, 04:13:39 pm
content: Quote from: wasedadoc on February 15, 2023, 04:03:45 pmNot at all. Power = V*I. My issue was calculating I.

author: shapirus
author_rank: Super Contributor
timestamp: February 15, 2023, 04:14:19 pm
content: Quote from: MarkS on February 15, 2023, 03:08:18 pmThis 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.

author: wasedadoc
author_rank: Super Contributor
timestamp: February 15, 2023, 04:20:58 pm
content: Quote from: MarkS on February 15, 2023, 04:13:39 pmWhichever one of the ways of writing Ohm's Law you know, the other two are easily obtained by schoolboy algebra.V=IRR=V/II=V/RSo why did you have an issue calculating I?

author: IanB
author_rank: Super Contributor
timestamp: February 15, 2023, 04:24:10 pm
content: Quote from: MarkS on February 15, 2023, 04:13:39 pmOhm'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.

author: MarkS
author_rank: Unknown
timestamp: February 15, 2023, 04:27:54 pm
content: Quote from: IanB on February 15, 2023, 04:24:10 pmIt was a brain fart. Sorry for the smell!

author: BeBuLamar
author_rank: Super Contributor
timestamp: February 15, 2023, 05:08:03 pm
content: With the divider using a 100K and 10K resistors from 12-14V you wouldn't need anything more than 1/4W.

author: MarkS
author_rank: Unknown
timestamp: February 20, 2023, 02:26:57 am
content: Quote from: shapirus on February 15, 2023, 04:14:19 pmWow, 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.