bms system, measuring cell voltages via optocouplers/opto-isolator

hi

I'd like to build a battery monitoring system for my electric bike, I have 24 lifepo4 cells in series, so 72v pack

I've googled my ass off, and I know the best way to do this is to use optocouplers between the cells and the arduino (so I cam measure each cell voltage individually

I also read that I need to connect the optocouplers up in a special way to read voltage through them... but I'm not sure how do do this

all the info I found online was unfinished.. so people talking about how to do it... but then no diagrams or people saying "I did it like this"

I can build the system fine once I know what I'm doing... I'm just a bit lost here... never used an optocoupler before

any help is much appreciated

thanks

Alan

knighty:
I'd like to build a battery monitoring system for my electric bike, I have 24 lifepo4 cells in series, so 72v pack

...and I know the best way to do this is to use optocouplers between the cells and the arduino (so I cam measure each cell voltage individually

I also read that I need to connect the optocouplers up in a special way to read voltage through them... but I'm not sure how do do this

"Between the cells"? No way.

You want to make a battery monitor such that you can measure each 'cell'. Fine.
As for the rest of it, stop.

What is the object? A real-time monitor?
There are many ways to go about that, but how rigorous are your requirements?

An optocoupler is just a way to pass a digital signal between two circuits that are not connected electrically. They are simple to use, and if you look at the data sheet for the one you have in mind it will probably include an example circuit diagram showing how to connect it.

I think there are basically two ways to approach this.

The first way uses some device connected to each cell which produces a digital signal indicating the voltage of that cell. It might be a simple high/low indicating whether the voltage is above/below a threshold, or it might be a serial data stream containing a voltage measurement encoded in some way, for example produced by a small standalone Arduino connected to each cell. The digital signal from each cell would be connected to the digital input of an Arduino via an optocoupler. Hence the Arduino would see the same high/low signal that is being output from each cell. If the HIGH/Low signal just indicates the threshold state, you could read that directly. If it is carrying a serial data stream, you'd need to read and decode that on the receiving side. Given the large number of cells to be monitored it probably isn't practical to use a hardware UART for each cell but you could use a software serial driver. The standard Arduino driver only supports reading from one port at a time, but I understand the AltSoftSerial library avoids that restriction.

The second approach is to connect the junction between each pair of cells to an analog input using a voltage divider to convert the expected voltage range (relative to the Arduino ground) down to a 0 .. 5V signal. The higher the voltage you needed to measure the more you'd need to divide it down and the less resolution you'd have in the resulting reading. Depending how accurately you need to know the voltage, that might be a problem - you'd have to calculate the resolution available and work out what resolution you needed to know whether this was viable.

I would use one ATTiny25/45/85 and two opto isolators per cell. One opto isolator would be used to pass data to the ATtiny from the master Arduino or similar processor. The ATtiny would be in power down mode until it received a wakeup signal via the opto. Each ATtiny would have its own address stored in EEPROM, and unless it receives a message addressed to itself, it would go back into power down mode. On receiving a message addressed to it, it would read the internal voltage reference, calculate the cell voltage (using a calibration word stored in EEPROM to allow for variation in the internal voltage reference between devices), and send the data to the master processor via the second opto isolator.

You could use less hardware by putting all the ATTinys in a ring and so use just one opto isolator per ATtiny, however if one of them failed then it would be less straightforward to determine which one.

I don't see why you couldn't use an analog opto-isolator to interface between the arduino and the battery cells. Then multiplex the output from the opto-isolators to the arduino in order to select between cells to monitor. This will not be real time, there will be a small delay between cells being read. The delay will be amplified if you decide to do input sampling (averaging the voltage read on each cell "x" amount of times, before going on to read the next voltage). Higher input sampling= more stable readings but longer delay, however I think the arduino is fast enough in order to make any delay between voltage updates seem negligible.

Another note: remember to power your arduino from a separate source. Personally, I would make an auxiliary battery pack on the ebike for powering low current devices such as the arduino.

And don't think that you can use dual multiplexers to switch between cells (one multiplexer for positive terminal, one multiplexer for negative terminal) without optoisolation, readings will be erroneous.

alex12342011:
I don't see why you couldn't use an analog opto-isolator to interface between the arduino and the battery cells.

Whilst that could be made to work, I can see two problems with it:

  1. You would have to calibrate each opto isolator separately, because the current transfer ratio of an opto isolator varies between different samples of the same part number. [But my solution requires the ATtiny voltage references to be calibrated, so I suppose that is no worse.]

  2. The circuit would draw a few mA all the time to drive the opto isolator, thereby draining the battery when not in use. You could have some additional electronics to turn the drive to the opto isolators off when the battery voltage gets too low or on command from the master processor (via a second opto isolator), but then it's getting more complicated than the ATtiny solution I suggested.