Safely measure 12v boat battery voltage with AVR

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

I'd like to monitor a 12V boat battery. I don't want to risk damage to the ADC input, what with pumps and things kicking in and out.

Would a 50k resistor from the bat+ and a 10k to ground, with a 0.1uF cap across it be relatively safe? Or is there something better I can do?

If it gets too complicated, I won't bother, it would just be a nice extra.

Four legs good, two legs bad, three legs stable.

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

With the AVR at 5V you could do with 47K + 8K2 and then add a 3V9 Zener diode over the 8K2

with 15V there should only be 2,2V over the 8K2 so well below were the zener should be acting up ( else you can even go to a 4V7 zener )

Adding a 100nF capacitor will also keep spikes from getting through. Just make sure you have shielded the connecting wires good enough.

Guess you are going to use the internal 2,56V reference.

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

I guess this is essentially the same as for an "automotive" (ie, car) application ?

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

John_A_Brown wrote:
I'd like to monitor a 12V boat battery

Assuming this is a lead acid battery, in my solar charger I use a 100k/15k .1% resistors with a 100nf cap to the T25 ADC.

it uses the internal 2.56v ADC ref.

 

 

Hope that helps!

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

Note that if the battery is below deck and/or in an enclosed space, be careful what you put in there - explosive gases may be present. There may be specific legal requirements.

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

Thanks.
The person I'm doing this job for (the voltage monitor is a mnor extra), has plenty of experience of boat stuff.
He built a whole bunch of stuff for Ellen MacArthur, when she sailed round the world, that I supplied all the firmware for, for example. But thanks to all for the advice.

Four legs good, two legs bad, three legs stable.

Last Edited: Wed. Jul 15, 2020 - 01:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi.

I make some dynamo regulators for boats and need to measure both battery and output voltage for dynamo.

some info:

it is stupid to use a Zener. Zener will leak some current and it will make some error measure when the voltage is high.

 

if you want to protect input, use a larger resistor from the +Bat like you have written and use some Schottky diode between adc pin and VCC . can use one to gnd too. 

 

if you want a high accuracy, use a voltage reg LM4040 series. work with the highest input voltage to the adc to have the most resolution.

 

V bat undercharging will be  14V4 for optimal lead battery, can be more. if you set 15V max for 12V you will be good. 

 

I use some transistor to disconnect the ADC resistor to not have leak current and some leak voltage on the cpu too.

 

Good luck

Thierry

 

Thierry Pottier

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

Thanks.

I agree about the zener, butwould have thought the internal clamp diodes would suffice with a 47k resistor.

I don't need extreme accuracy, but apparently the digital video recorders being used can seriously screw up if the supply drops below around 10V.

 

Four legs good, two legs bad, three legs stable.

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

Instead of a zener, use a TVS & the reverse current can be extremely small (sub microamp). Trade off, it is not optimized for regulation as well "the regulate", so it's less useful for providing a steady reference voltage.

 

https://www.onsemi.com/pub/Collateral/ESD9X3.3ST5G-D.PDF

 

According to mfg it is not best to rely on "hammering" the internal clamp diode, unless it is a rare occasion.  The cap can soak up most of the overload, assuming it is not steady overvoltage.  Sorta depend's on who's chip & the specific part. With that said, I've done it anyway!

 

https://www.microsemi.com/docume...

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