I'm trying to build a circuit that can scale down several lipo batteries (5 cell) up to 22V max to be safe to either 3.3V or 5V for measuring with a PIC microcontroller using the analog to digital converter.

Now the problem is I have more than one battery for each motor and each battery is isolated from one another. There is no common ground between them.

Can someone offer some advice on how I can measure the voltage of these batteries using the PIC's ADC. Some form of voltage divider will of course be needed and suggestions on this are welcome.

My analog circuitry skills are extremely weak so please provide as much detail and or references. Any calculations would also be appreciated.

I'd like to ensure some level of filtering/isolation is present due to the LiPos obvious high current usage and noise of the motor.

PS: I know there are very cheap LED voltmeteres on ebay for this but I want to be able to send the sampled voltages back to a base in my project.

  • \$\begingroup\$ While Steven's answer is valid there are other completely different topologies. Possible problems with analog optocouplers are error level and cost. Look at the datasheet carefully. \$\endgroup\$ Commented May 15, 2012 at 11:53
  • \$\begingroup\$ @OlinLathrop by 'error level' do you mean added noise/inaccuracy? \$\endgroup\$
    – kenny
    Commented May 15, 2012 at 14:54
  • \$\begingroup\$ @Olin: doesn't "0.01% servo linearity" mean there shouldn't be error level problems? Especially at DC. \$\endgroup\$ Commented May 15, 2012 at 14:57
  • \$\begingroup\$ @Federico: Yes, 0.01% is very good. Many aren't that good. Watch the price though. Like I said, this is certainly one workable approach. My point is that there are also other completely different methods. \$\endgroup\$ Commented May 15, 2012 at 15:13
  • 1
    \$\begingroup\$ @Olin - I've seen several occasion where the user changed his mind and accepted a different answer. It happened to me to, in both directions. Besides, even if the question is a few days old a new answer would bump it, and it will attract new attention. This isn't a waste of time. I've had several old answers upvoted because the question was bumped when a new answer was added. People do seem to find it useful. I'm curious to see other solutions here, now there's just mine. \$\endgroup\$
    – stevenvh
    Commented May 27, 2012 at 8:35

1 Answer 1


If you can't connect the circuits an analog optocoupler like the IL300 may be useful:

enter image description here

The input and output remain separated, yet you have the analog value of the battery's level available to the ADC on the other side. The IL300 has an excellent 0.01% servo linearity.

(Vcc and ground left and right of the optocoupler are obviously different.)

transfer function
Opamp U1 will try to make its inverting input equal to \$V_{IN}\$, that's

\$ I_{P1} = \dfrac{V_{IN}}{R1} \$

It controls \$I_{P1}\$ by varying the LED's current \$I_F\$, but we don't need this value in our calculation. Since the photodiodes are matched \$I_{P1} = I_{P2}\$, and the output of U2 is

\$ V_{OUT} = I_{P2} \times R2 \$

so that

\$ V_{OUT} = \dfrac{R2}{R1} \times V_{IN} \$

So, even when R1 is drawn far away from U2 it plays a role for it. The circuit might not work if you choose R2 ten times larger than R1 and your input voltage is 2V.

The short circuit current for the photodiodes is 70 µA. If Vin is for instance 1 V then R1 must be at least 15 kΩ to allow the opamps to get Vb also to 1 V. A value of 100 kΩ for R1 (and R2) will give you an input range of several volts.

  • \$\begingroup\$ Thankyou Thankyou Thankyou !!!! This is exactly what I need! \$\endgroup\$
    – Peter H
    Commented May 15, 2012 at 10:58
  • \$\begingroup\$ @olin I'm open to alternative solutions. \$\endgroup\$
    – Peter H
    Commented May 27, 2012 at 4:30
  • \$\begingroup\$ @Peter - I'm not sure Olin will be notified of your comment. I am, because it's my answer, but he hasn't commented here, and I think that's a requirement. If you didn't see the name hint while you were typing his name, he won't be told. His comment was a comment to your question, not to my answer. Maybe you should move your comment there. \$\endgroup\$
    – stevenvh
    Commented May 27, 2012 at 4:36
  • \$\begingroup\$ Thanks Steve, Just another question with regards to your solution. It's recommended to have operational amplifiers on both the left and right side of the IL300. Most amplifiers I know of require that the differential input voltage be lower than Vcc of the Op amp. The Lipos are connected to an esc which can provide regulated 5.75Volts. I can use this to power the left op-amp. Should I be building a resistor dividor to lower the lipo voltage then feed then feed this into the left op-amp which is powered by the 5.75V. Say a 1/10th dividor? What are your thoughts? \$\endgroup\$
    – Peter H
    Commented May 27, 2012 at 8:14
  • \$\begingroup\$ @Peter - Yes, a divider is advisable. I don't think many opamps can handle Vcc at their input. But why 1:10, and not 1:1? That will place the input voltage right in the middle, where you have the most headroom up and down. You'll need that especially if you're not using a Rail-to-Rail I/O opamp. \$\endgroup\$
    – stevenvh
    Commented May 27, 2012 at 8:19

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.