I'm building a circuit whereby users are able to connect their battery to the pcb which will then be sampled by a micrcontroller. Voltage divider circuitry is all good so please don't focus you attention on this.

The battery is a LIPO battery and I was planning on getting the user to connect the JST-XH balance lead to the PCB. Now for those familiar with LIPO batteries the connector is different based on the number of cells the battery has.

See this website for more on balance leads if you need to: https://sites.google.com/site/tjinguytech/charging-how-tos/balance-connectors/

So I was thinking of having various JST-XH female connectors on the PCB so if the user had, for example, a 3-cell battery they'd connect the balance lead of the battery to the 3-cell female connector on the PCB. If they had a 4-cell battery they'd connect the 4 pin female balance connector to the pcb, 5-cell battery to 5 pin connector to pcb, etc....

The problem here I guess is if a user accidentally connected 2 batteries say a 3 cell and 4 cell battery at the same time: the circuitry is not only dangerous but things might start smoking (as at the moment I have the + and - ends of the pcb female connectors on the same net.

Balance Connector example

Does anyone have any suggestions as to how this can be achieved (without diodes, I don't want the voltage drop, plus I believe the diode cannot be connected in parallel due to the fact that the battery will be discharging large amounts of current through a parallel connection to the motor).

I have thought about just havine one two-pin female connecotor on the pcb then issuing a converter which suitable for the different types of batteries, to prevent any mishaps, but would like to see other alternatives/solutions.

In particular the possibility of having some form of dip switch on the board so that when the dip switch is at a particular position it will pass either the three, four or five cell battery voltage through to the adc circuitry (but only one) or any other solution you can think of.


Perhaps you could simply add some resistors between the connectors. Four resistors in total: two separating the positive terminals from each other, and two separating the negative terminals from each other. Assuming that your voltage sampler is very high impedance, then the resistors won't affect the reading.

I don't know exactly what the resistor network is supposed to do, but I assume it's a potential divider, intended to reduce the battery voltage, so it can be sampled.

For example, if your resistor divider is supposed to divide the voltage by 3, you can set up your resistors like this:

Battery safety circuit

The 1k safety resistors plus the divider resistors together make up a 10k:5k divider.

  • \$\begingroup\$ Resistor might be a problem Rocket as this voltage goes through a controlled resistor network to divide the voltage. \$\endgroup\$ – Peter H Jul 15 '12 at 3:09
  • \$\begingroup\$ @PeterH - I think you can make the protection resistors part of the controlled resistor network. I'll have time to draw up a schematic later tonight. \$\endgroup\$ – Rocketmagnet Jul 15 '12 at 15:41
  • \$\begingroup\$ Ingenious idea rocketman... That should work perfectly. \$\endgroup\$ – Peter H Jul 16 '12 at 22:29

All you're doing is reading the voltage? In that case why not just slap in extremely low-current fuses? That's a kind of hack-y solution but it might do for your purposes. Though I see you say this is actually connected to a motor as well, so almost certainly no then.

Another option is that it looks like the connectors are 0.1" spaced, and you could put on a single 5 pin 0.1" header, and just tell them to always plug it in in a certain orientation (you wouldn't get the polarization protection from the header shroud/guide). Then you wouldn't have to worry about multiple batteries plugged in at once, but you would have to worry about users plugging the connector in backwards. But you could protect that by having a reverse-polarity protection diode which shorts ground to Vin in the case of a reverse polarization plug. This has the disadvantage that if someone plugs it in backwards they'll get an extremely hot diode, but it should save the rest of the electronics. You could put an LED that says ERROR_REMOVE_BATTERY which turns on if they plug it in backwards and hope that people would notice it?

This is the problem of how idiot-proof do you really want to make your system? Because no matter what you do the universe can throw a bigger idiot at the problem. I think plugging in multiple batteries simultaneously seems unlikely, but that's just me.

If all you're looking for is dip-switch configurations to prevent multiple batteries from being connected you should probably be aware that if these switches have to handle the current coming from the battery then you should expect to pay a lot for them (like $10 per switch at least), and the answer is probably just to have either the ground connections or the positive connections disconnected unless a switch is thrown, one for each battery. This is simple but similarly prone to error (probably more prone to error than just not connecting multiple batteries simultaneously).

Hope that enormous ramble helps somehow. Good luck figuring it out!

  • \$\begingroup\$ Hi Kit, Thanks for you help.What I meant by the diode was that basically if it is in parallel with the + and - battery terminals things will go boom.. I.E It's an absolute no no as a motor pulling 30 Amps will require a diode the size of a small brick.... We have all connected circuitry incorrectly at some point in time... Because these are lipo batteries that can discharge very high currents, hence my reasons for safety. Thanks Series diodes with the analog to digital circuitry should be ok as this part of the ciruit is very low current, but it's the voltage drop that's concerning. \$\endgroup\$ – Peter H Jul 14 '12 at 8:13
  • \$\begingroup\$ Indeed we have all connected something incorrectly at some point, and I still stand by my "you can only protect yourself so much." Is there a reason you don't just put down a single 5-pin connector, the positive connection being in the leftmost pin (pin 0), and then a ground connection on pins 2, 3, and 4? Like I said: no problem with multiple batteries, just problems with polarity. I think you may be able to solve only one of these two problems without interfering with the readings, but maybe someone has a better idea which solves both? \$\endgroup\$ – Kit Scuzz Jul 14 '12 at 9:40
  • 1
    \$\begingroup\$ The balance lead of a lipo battery contains a voltage potential of approx 3.7V for each neigbouring pin. Think of them like 3,4 or 5 batteries in series. When measuring a voltage from the top to bottom you get the entire voltage reading. It's the same with the JST-XH connector. The website above explains it very well. If I were to connect the middle pins to the bottom we would also see smoke as it would be like short circuiting one of the batteries cells connectd in series. Cheers, Pete \$\endgroup\$ – Peter H Jul 14 '12 at 10:54
  • \$\begingroup\$ Ah! Gotcha, I should have actually read through your provided link. I assume you're not trying to drive the motors through this, this is just the connection you're using for monitoring? \$\endgroup\$ – Kit Scuzz Jul 14 '12 at 19:58
  • 1
    \$\begingroup\$ Not exacty picturing your configuration in my head with the diodes. Polyswitch fuses of 0.1A between positive to positive terminals do you think they'd work ok Kit? Fused connection example \$\endgroup\$ – Peter H Jul 15 '12 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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