# Measuring voltage of a storage system with RPi

simulate this circuit – Schematic created using CircuitLab

I'm trying to figure out how I can measure a voltage of a storage system (~48 V DC) and construct a safe input into an MCP3008 ADC.

I built a voltage divider and I am not sure if it's possible to connect the RPi ground via the digital_GND of the ADC to the analog-ground of the circuit?

Any suggestions would be appreciated, thanks!

• Please edit your question, and post a schematic diagram (the schematic editor is available via an icon or Control-M). What voltage is the ADC operating at? Is the 'storage system' just batteries? What do you mean by 'I'm struggling with the ground of the circuit? What is preventing you connecting the 'storage system', ADC and R-Pi grounds together? What is the opto-isolator for, and how would the ADC be powered? What values of resistor are used for the voltage divider, and why so huge a ratio, 20:1 looks fine. What is the ADC part number (and datasheet link)? Aug 23, 2016 at 13:41

All the grounds can be connected together and to the negative terminal of the battery.

You don't say if the 48V is the actual maximum, so I'll assume it is nominal (calculated from each cells nominal 3.7V), and the actual maximum will be higher (13 cells would be closer to a maximum of 55V)

The voltage divider ratio is so high that the highest voltage at the mid-point is going to be less than a nominal 0.46V (0.55V maximum). That is wasting several digits of the ADC.

A better ratio would be around 20:1 (or even lower), which would give a maximum of 2.7V, and an extra two digits of resolution from the ADC.

You might protect the input of the ADC with a 3V zener diode in parallel with the 1k resistor. That way, if something goes a bit wrong, the ADC should be protected.

I apologise, but I still don't see the need for the opto-isolator. Please add some more information to your question to explain that.

• Thanks! That sounds sensible! I guess if the grounds are connected to each other, the isolation wouldn't make that much sense anyway. I think I will go with the lower ratio and protect the the ADC with a Z-Diode =) Aug 24, 2016 at 7:49
• @Steve.1990 - it might make sense to isolate the R-Pi; there might be something obvious to you but which is not in the question, so we can't know. However, as it stands, something like a zener diode to protect the ADC input, with enough resistance to ensure the zener's power dissipation is protected (which in your set up looks very straightforward to achieve), seems necessary and sufficient. Aug 24, 2016 at 12:23