3
\$\begingroup\$

I want to measure the voltage of my motorcycle battery using an microcontroller (ST32F401CE). The voltage from the battery is not a static value, since when riding, it'll be (according to the service manual) between 13.5 and max 15.5.

The microcontroller I use has an embedded 12-bit ADC converter and the ref+ is 3.3 volt. I know I have to use a voltage divider circuit. And I calculated R1 and R2 with the formula: V1 = Vm * (R2/(R1+R2)), where V1 = 3.3, vm = 15.5, R1 = 56K and R2 = 15.148k. Of course 15.148 isn't a valid resistor value, so I'll use 15k which'll give me a v1 of 3.275, which is a bit under the 3.3 ref+ voltage.

My question: Will this voltage divider circuit still work when the battery voltage changes to 13.5 volt or lower? Is the voltage divider circuit never going above the v1 value?

Programming it is no problem, since I got enough experience in that. But this is my first time making the circuit from scratch. My knowledge on voltage divider circuits is also very little. Any explanation is highly appreciated.

\$\endgroup\$

2 Answers 2

4
\$\begingroup\$

Yes this voltage divider will still work when the input voltage changes to 13.5v. You will then get 2.85V on the input to the microcontroller. I would also suggest using a voltage follower going into the microcontroller. The output of the voltage divider is going to be a fairly high impedance. You want to have a fairly low impedance in order to quickly charge the ADC sampling capacitor inside the microcontroller. D1 and D2 are optional. These are to protect the microcontroller from over voltage on the ADC pin.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
2
  • \$\begingroup\$ Thanks a lot! However, in my circuit, I used a AMS1117-3.3 voltage regulator to power the microcontroller. What does V2 mean in your circuit? Is that the connection to power the microcontroller? \$\endgroup\$
    – Cremus
    Commented Sep 28, 2020 at 15:17
  • 1
    \$\begingroup\$ Yes, that would be what comes off of your voltage regulator. \$\endgroup\$ Commented Oct 9, 2020 at 17:05
2
\$\begingroup\$

It will still be valid for lower voltages. However, even if the dimensioning of the divider considers the supposed highest voltage, the charge alternator when the engine is running produces voltage spikes and it is better to add surge protection like a transient voltage suppressor or TVS.

\$\endgroup\$
4
  • \$\begingroup\$ Ah alright, I get what you mean. But, between the alternator and the battery is a voltage regulator/rectifier. Won't that protect the circuitry? \$\endgroup\$
    – Cremus
    Commented Sep 28, 2020 at 15:11
  • \$\begingroup\$ There are diodes and regulator but the spikes start to appear when the battery is almost dead which reduces its filtering effect or when the carbon brushes of the regulator start to wear away. \$\endgroup\$ Commented Sep 28, 2020 at 15:51
  • \$\begingroup\$ Long time ago, but I've been busy. The transient voltage suppressor can be just a zener diode right? Which protects the circuit for spikes above, lets say, 16 volts? Which, if I understand it right, protects the voltage divider circuit and the ADC input of the microcontroller? \$\endgroup\$
    – Cremus
    Commented Mar 3, 2021 at 9:14
  • 1
    \$\begingroup\$ Yes it can be a zener. It protects the ADC there is no risk on the voltage divider. \$\endgroup\$ Commented Mar 3, 2021 at 9:38

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.