I have a setup that takes voltage samples of my car battery periodically, but I'm trying to simplify it.

Right now it's based on a buck converter taking 12v down to 3.7v to run an ATTiny, then a second connection to a voltage divider that's calibrated to scale 0-14v (max battery voltage I want to measure) to the ATTiny's ADC.

The issue is spikes occur on the battery which cause that voltage divider to supply the ADC with more than Vcc + 0.5v (the max the datasheet lists for any pin).

It works but my current setup depends on the internal clamp diodes to handle those voltage spikes on the ADC pin. I chose the resistance values on the voltage divider to limit the current across the diodes to ~1mA, but I understand that driving the pin out of spec as part of my design isn't a good idea (I got the idea after looking at a design from Atmel that seemed to be measuring mains voltage relying on those clamps).

I've found dozens of different circuits designed to clamp the voltage externally, but I was having trouble understanding which ones had the best characteristics for what I'm doing (my main focus is on measuring the 11v-13v range with .1v accuracy). Is there a specific design that'd be ideal for the range and sensitivity I want?

P.s. What'd I'd really like to do is to find a way to scale my 12v battery input to Vcc and use the internal voltage reference to infer the battery charge. That'd remove the need for the second input going to the ADC from my understanding, but I don't know how accurate that would be, and how I can get the battery input clean enough to power the ATTiny without also distorting the value I'd get for battery input

  • \$\begingroup\$ Second ADC? Where are you using that? \$\endgroup\$ Commented Oct 21, 2016 at 19:07
  • \$\begingroup\$ @IgnacioVazquez-Abrams I Ctrl+F'd for second ADC and reworded it to make it clearer if needed, but there's no second ADC, just a second wire from the battery to my ATTiny \$\endgroup\$ Commented Oct 21, 2016 at 19:10
  • \$\begingroup\$ If I understand what you're saying, you want a buck regulator that will quarter the voltage so that you can compare Vcc against the bandgap reference directly. \$\endgroup\$ Commented Oct 21, 2016 at 19:11
  • \$\begingroup\$ @IgnacioVazquez-Abrams I thought the regulator would maintain a set voltage regardless of the change in input voltage (at least that's what the ones I found do). \$\endgroup\$ Commented Oct 21, 2016 at 19:13
  • \$\begingroup\$ Yes, because that's what they're designed to do. It is feasible to design one that has a fixed divider instead though. \$\endgroup\$ Commented Oct 21, 2016 at 19:15

1 Answer 1

  • Keep your voltage source and ground as low impedance power source with twisted pairs to shunt any stray noise better.

  • Then add decoupling caps to lower the impedance more just before your voltage divider and keep all leads short in your data collection to improve immunity from stray spikes and use a good ground braid wire that is low inductance or mounted to frame ground.

These are basic EMI practices. Additional shielding, should not be required unless you are right beside the ignition wires.

  • Alternatively, you can add a small series R e.g. 100 Ohms to 10 uF to filter conducted spikes better, followed by your higher impedance R divider near by.

Any serious automotive design must pass these tests which requires series diode for reverse voltage (accidental loose battery terminal) , series current limiting and MOV Clamp. enter image description here

  • \$\begingroup\$ So with these guidelines if a spike from something like the alternator did make it through the internal clamping diodes would be able to handle it? \$\endgroup\$ Commented Oct 21, 2016 at 19:44
  • \$\begingroup\$ Not necessarily it is just a simple attenuator. You would need to analyze the effects and use series shunt MOVs as required to pass automotive tests. \$\endgroup\$ Commented Oct 21, 2016 at 21:31
  • \$\begingroup\$ I read up on what a MOV is and found sources how they can be used to suppress automotive transients. There's also a lot of mentions of using a TVS to suppress transients. I'm not sure if I'd need one or both. I'm also wondering if they'd affect ADC measurements of the battery since both seem like they'd affect the voltage divider. \$\endgroup\$ Commented Oct 21, 2016 at 22:36
  • \$\begingroup\$ Is there a centralized source that someone with a (very) basic understanding of electronics could go to find out how to deal with transients or am I aiming for something more complicated than a beginner could "leap frog" into? This is really a one off design for my own utility so I'm willing to work with a design that's not "production-ready", but I also don't want to blow up the thing every time my car start \$\endgroup\$ Commented Oct 21, 2016 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.