# sensing up to 100 voltages on a single arduino

hey folks, i'm an arduino newbie, and i've been reading up on how to sense voltages. I know about using a voltage divider or something for individual voltages, but i have an application where i want to monitor up to 100 different discrete voltages (batteries).

I read about doing some LED driving using a 10x10 matrix, but is that something i can do for sensing things?

What would happen if i wanted to go more than 100?

Thanks.

Use an analogic multiplexer. That way you can connect 100 or more sensing points to only one analogic port of your arduino and then you cycle through the multiplexers address's.

For an example of analogue multiplexers see:- http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html

If the voltages are reasonable they can be sent through the multiplexer before being cut down with a potential divider otherwise you have to cut them down first. Note this is not like a matrix, it is more a one dimensional data select. In other words a succession of switches that eventually connects the voltage you want to the analogue input.

Thanks for the information. I've been looking up information about multiplexers and how to use them. As i said before, i'm a complete noob, so it'll take me some time to figure it out, but i think i've got some good information now.

Thanks!

yes, the batts are in series. However, I'm thinking of measuring voltages of each cell individually, so the voltage range is between 2.2 and 3.8v per cell.

You might want to get hold of some uniselectors to switch both the ground reference and the positive terminal of your sense circuit. If you don't know what they are simply google it, lots of good info there. That way you can drive the multiplexer input directly with full 2.5 volts being applied directly, so permitting maximum resolution and absolute discrimination between cells.

Otherwise, as Richard says, you're onto a loser due to all cells being in series. If you set up a resistor divider to drop the top cell from 200+, say 250 down to 5 volts then the same divider when measuring to first cell of say 2.5 volts with the same resistor divider, will in fact be ranged down to 50 millivolts maximum - ie rubbish resolution for every cell from number 1 to number 100 and almost total lack of discrimination.

As an alternative to a uniselector or strowger device you could use 100 double pole relays to achieve the switching required. Two poles required to connect the -ve and +ve cell terminals to the arduino reference and input terminals. However you need to consider the possibility of a system failure permitting two relays to be energised simultaneously. If this occured then they would effectively place a short circuit between the faulty relay cell and the cell being measured. Therefore when you de-energise a relay and prior to energising the next you should read the relay status to confirm that both its poles have disconnected from the measured cell prior to energising the next relay in sequence. Effectively the double pole relays are simply emmulating what you would be doing if you were sticking a pair of meter leads across individual cell terminals, sequentially one after the other. All this leads to a large and expensive relay system but I cannot think of another way to accurately monitor individual cells on a large series connected battery system. jack

Make a board with the MUXs, an ADC (with an SPI interface) and a few shift regs to address the MUXs, isolate this circuitry with a \$10 DC/DC converter and a few opto couplers and probably add a voltage reference to give the ADC a clean AREF. Now your Arduino can control the MUXs and read the ADC pretty much regarless of the voltage being measured.

For that matter, isn't there a 48/64 whatever IP mux shield. If that has a serial interface you could use that by adding the DC/DC converter and optos.

Rob

Have a look at the Centipede shield

http://docs.macetech.com/doku.php/centipede_shield

It uses i2c which would be difficult to isolate I think, but there may be other similar boards with an SPI interface which would be easy to isolate.

EDIT: Then there's the MUX shield

http://mayhewlabs.com/arduino-mux-shield

This needs a heap of IO pins to address the MUXs but you could do that with a couple of 595 SRs.

You would still have to add an ADC on the isolated side.

Rob

This is great information. Thanks again. this discussion is now beyond my understanding, but i'm learning, and hopefully will get it soon.

As for Richard's question about what i'm doing. Mainly i'm thinking about how to create a battery management system for an electric vehicle. Yes, i know there have been some already done, but this is a learning exercise for me. my current pack is 36 lithium ion batteries in series (36s1p), so yeah, there's a fair bit of voltage between the first and last batt in the pack. I thought i'd use optos to ensure that there wasn't the possibilty of getting more than one cell's voltage into the bms, but i wasn't sure. With all of this new info, i'll go back to think about it again. :)

Thanks!

You should be able to test individual cells when there is no electrical circuit being made for the whole series of cells. When a electrical circuit is made for the series of cells, then is when issues can arise measuring across individual cells.

I thought i’d use optos to ensure that there wasn’t the possibilty of getting more than one cell’s voltage into the bms, but i wasn’t sure

Not sure if you realise it by now but an opto isolator will not transfer a DC signal only an AC signal. So you can’t use on to isolate your individual cells.
However you could use a voltage to frequency converter on each of the cells (powered by the cell as well). Then AC couple (that is with a capacitor) these oscillators to the arduino, send them through a digital multiplexer (no need for an analogue one) and do the frequency measurement by measuring the time period.

Or, make up your own multiplexer circuit using analog switches such as can be found at www.maxim-ic.com across each batter have a switch pair http://www.maxim-ic.com/products/switches/5v/ See the MAX4741, dual normally open single pole/single throw switch.

that goes to the arduino analog ADC input. All the switches connect to the ADC on one side, the other side is switched on one battery at a time to take a reading. Lot of wiring for sure, but hey, I'm not gonna be doing it :-)

Or be a little smarter and have one switch to each battery junction (they are all wired in series?) and take a positive reading on one battery, then negative on the next, if Arduino supports that.

Well, looks like the MAX4741 won't do negative voltage, but look around, there may be others that will, if the Aruino can ...

Or, make up your own multiplexer circuit using analog switches

You are left with the same problem, that is although the voltage differential is small is is sitting on a large DC offset. That is what is making things difficult and designing a multiplexer that will handle the problem is just going to transfer the problem to measuring a differential voltage with large DC offset. The only answer is to remove the DC offset and transfer just the differential signal. You can't do this with any clever multiplexing you need either op amps that work at 100v or some form of AC coupling of your DC differential voltage.

The Aruiono itself could be left floating, battery operated or magenetically coupled power, one of the pads where you stick your phone, mp3 player, etc on for charging - here we go
http://blog.allion.com/wireless-power-charge-your-phone-without-plugging-in/

Then the negative of the battery being measured can be connected to the Arduino ground as each one is switched in for measurement for the ground reference (assuming it needs one, is taking forever to down load the datasheet this morning).
Serial output optocoupled to where ever it goes.

I believe you will be looking for an animal called an isolation amplifier. You will have to google it. Analog devices has some good ones.

Another method is to take the voltages at a series of points, all referencing a common ground, within your battery string and use a resistor network voltage divider to put them in the range you can handle.

The voltage of the sub-string closest ground is itself. The next sub-string is itself minus the first sub-string's. The next is that voltage minus the sum of the previous strings', etc.

The problem you have to get around is that all the voltages have to be relative to a common ground -- this is what the isolation amplifier can fix -- and as you work your way up the battery chain the whole voltage to common ground is quite large -- and decidedly unsafe. So the accuracy will get dodgy as you work your way up the string. Perhaps you can work in strings of zener diodes to lop off a chunks of voltage offset so that your divider will give you some more accuracy to work with.

Oh, that is making it hard! Take a look at the analog switches - think of them as a chain of knife switches - close a pair across the ends of a battery to connect the battery+ to the arduino ADC input and the battery- to the arduino ground, take a measurement, open it up. Close the next pair, take a measurement, open it up. Go right down the line. Just don't connect the arduino ground to anything but the batteries individually - so its like a handheld digital volt meter. Let me see if I draw up a quick schematic & post it ...

think of them as a chain of knife switches

You can think of them as that but physics won't. As soon as anything is connected to any one of the inputs it becomes part of the circuit. It is not isolated until switched through, you can only do that with a relay.

Dang - how do folks embed pictures in messages?