Volt Meter / 24 Analog Pins?

Hey guys.

So I decided I wanted to mess around with making a volt meter but I wanted to see if there's a way to get more analog pins?

The Arduino Uno R3 board I have has 6 Analog In pins. Is there a way to add on 18 more?

I want to create a project that can measure the voltage of 24 different items at once (This is for a battery, so I'm measuring each individual cell, and the battery has 24 cells in it)

I was going to use this project for the starting of just getting it to measure 1 cell/item.

All my parts come in tomorrow so wanted to get a head start on ideas for the final project which hopefully will consist of 24 leads (Input Voltage)

Thanks!

.

Ah, I see.

Correct me if I'm wrong but would this be better to use? Seems a bit more advanced and less work than the other project.

You would want to use an analog multiplexer.

.

Hi,
Consider 32 analog inputs on 2 Megas, (at about $18 each). Make one tell the other it's 16 values.

And you'd have LOT of code space and LOTS+ digital I/os and Serial ports..

Can you do it that cheap otherwise with no chips to solder?

Simple analog multiplexers require a common Gnd line. This means that the range of the last cell in a series will have a high offset, which reduces the effective ADC resolution (1/1024 of the absolute voltage). What's the total voltage of the battery?

You can use two multiplexers, for the + and - poles of the cells.

In either case keep in mind that the multiplexers have a limited voltage range, i.e. the voltages on all input pins must not exceed the maximum voltage range. If you add voltage dividers, to reduce the absolute voltages, these resistors will permanently sink current from the cells.

RDaugherty:
I want to create a project that can measure the voltage of 24 different items at once (This is for a battery, so I'm measuring each individual cell, and the battery has 24 cells in it)

Is this for a 24-cell lead/acid bank (stack)?
Note that you can't measure individual cells this way. Just the voltage of a tap in the stack.
Code has to subtract tap voltages to work out cell voltages.
Accuracy of the top cells might be reduced to 0.1volt.
Cells are also unequally discharged by the voltage dividers.
Tell us more about your project.
You might want to look at a "flying cap" solution.
That only needs one analogue input, and measures cells with a much higher resolution.
Leo..

Yes, the batteries I will be measuring are 24 cell lead flooded batteries.

Why can I not measure individual cells? Each cell has a negative and positive post that I can put a regular multimeter on and get the voltage of each cell individually.

So my idea is just to do the same but with 24 leads instead of just one so I can read all of them at once. This isn't for getting an overall voltage or anything but so I can do stress tests on the batteries and see how far each voltage drops per cell and find any problem childs.

I work for a battery company and at our shop we have load banks that we can place the batteries on and every hour we take a reading of each individual cell. So my thoughts were to make something that I can attach a set of leads to each negative/positive post and pull each ones voltage.

For 24 cells you need e.g. 48 relays, to connect both wires of a DVM or ADC to the + and - of each cell.

DrDiettrich:
For 24 cells you need e.g. 48 relays, to connect both wires of a DVM or ADC to the + and - of each cell.

48 relays?

Sorry, this is only my second project for arduino I'll be working on and I have very little technical knowledge, but the project above doesn't state anything about relays, just a couple of resistors for the divider and two wires, one negative one positive.

Did you mean relays as in leads/wires?

Re: circuit protection of series battery voltage measurement
https://forum.arduino.cc/index.php?topic=365750.msg2521095#msg2521095

The simple way is voltage dividers on each tap of the cell string.
Voltage dividers, because the Arduino can only work with voltages <5volt.

The first divider loads (discharges a bit) the first cell. The second (tap) loads the first and the second cell.
The third one loads the first, second and third cell. etc.
You see that the first cell discharges faster, because it has to supply all 24 voltage dividers.

There are ICs that can switch taps on/off as needed (74HC4067).
Don't know if there are high voltage ones (60volt).

Resolution goes down with the ratio of the voltage divider, so the measurement of the "top" cell is the least accurate.
As said, you can only measure "tap voltage" this way, so you have to calculate cell voltages (more inaccuracy).

An other way is using small relays to connect each cell in turn to Arduino ground and one analogue input.
Much like you already do now with your DMM. Move TWO terminals to another cell.
Also available in chip form, but more expensive than 24 DPDT miniature relays, and made of unubtanium.

Stack monitoring has been done before.
Enter something like "battery stack monitor" in the search box on top of this page.
http://forum.arduino.cc/index.php?topic=436369.0
http://forum.arduino.cc/index.php?topic=426850.0
https://forum.arduino.cc/index.php?topic=92074.45
Leo..

You are right, 24 DPST relays are sufficient, one for each cell. I had SPST relays in mind.

And take care that the Arduino Gnd is not otherwise connected to the battery, neither directly nor through power supply, USB or some other connected device.

DrDiettrich:
And take care that the Arduino Gnd is not otherwise connected to the battery...

Not possible if you use the "flying cap" principle.

Cap connected to the two common terminals of a DPDT relay.
Two NC contacts to the battery.
Two NO contacts to Arduino ground and analogue-in.

Also not a problem when two or more relays are accidently activated.
Leo..

So for just testing until I decide on the best way to integrate 24 cells into this just reading one cell.

I got the ability to do it but my data seems to not be accurate.

I'm thinking I messed up the wiring?

Not good with drawing/still learning schematics but here's an image of the board.

Blue Wire going to the breadboard = A0 on Uno.
Black Wire going to the breadboard = GND on Uno.

Resistor nearest negative rail = 10k
2nd Resistor (Blue) = 100k

Code

float vPow = 4.7;
 float r1 = 100000;
 float r2 = 10000;
 int count = 0;
 bool Battery1VoltStatus = false;
 bool Battery2VoltStatus = false;
 
 void setup() {
   Serial.begin(9600);
   
   
   Serial.println("--------------------");
   Serial.println("DC VOLTMETER");
   Serial.print("Maximum Voltage: ");
   Serial.print((int)(vPow / (r2 / (r1 + r2))));
   Serial.println("V");
   Serial.println("--------------------");
   Serial.println("");
   
   delay(2000);
 }
 
 void loop() {
   float v1 = (analogRead(0) * vPow) / 1024.0;
   //float v2 = (analogRead(1) * vPow) / 1024.0;
   float Battery1Volt = v1 / (r2 / (r1 + r2));
   //float Battery2Volt = v2 / (r2 / (r1 + r2));

   

  if (Battery1Volt > 1.00) {
    if (Battery1VoltStatus == false) {
      Battery1VoltStatus = true;
      Serial.println("Battery 1 Connected.");
    }
  }
  
  if (Battery1Volt > 1.00) {
    Serial.println("Battery 1 Voltage: ");
    Serial.print(Battery1Volt);
    
  }

  if (Battery1Volt < 1.00) {
    if (Battery1VoltStatus == true) {
      Battery1VoltStatus = false;
      Serial.println("Battery 1 Disconnected.");
    }
  }


  delay(500);

 }

I have been playing around with something similar to this but only either 4 or 8 batteries that are wired in series. My testing consists of 2 quad op-amps for 8 batteries set up in a differential mode to read the individual battery voltage, this means I don't have to subtract battery 1 from battery 2. I got the idea from another thread where some one posted it about a battery balancer.
This seems to be working ok some people say use relays but I found it easier with the op-amp. At the moment I'm only testing with 4 batteries and using an 18bit adc chip, but thinking of looking at a multiplex method.
I'm out in a bit can post my drawing if required

I think this is the thread you're referring to.
https://forum.arduino.cc/index.php?topic=346070.0
Leo..

Hi,
I posted this basic schematic in another thread for indication of how switch cap measurement could be used.
To select relays you could use a port expander chip to save on controller I/O.


Tom... :slight_smile:

A shift register of the TPIC family can switch eight relays directly (no other parts needed).
You can daisy-chain as many as you like. The whole chain only uses three Arduino pins.

https://forum.arduino.cc/index.php?topic=92074.45
Post#49 has a picture of an 8-cell flying cap volt meter I once designed.
Three boards can be stacked to make a 24-cell flying cap voltmeter.
Diagrams and code are also somewhere in these posts.
Leo..

leo yeah that's the one. I can see you used a 4051 I may do that way so I can use the MCP3426 16bit adc been studying nick's example of the 4051 just playing around with that rather than the 10bit analogue read bit just trying to figure it out.
Tom that looks interesting idea

Sorry did not mean to high jack thread