ADS1115 Voltmeter 60V DC - Page 1
Forum section: electronics / beginners

author: mishomvp
author_rank: Newbie
timestamp: April 29, 2023, 01:24:58 am
content: Hello,I want to make a voltmeter based on ADS1115 (It has good integration with ESPHOME (home assistant) and ESP32), which can measure up to 60-70 volts DC. But if I do it only with a resistor divider, if the polarity is reversed there is a high probability that the ADS1115 will be damaged and the measurement will not be accurate.I will make a galvanic separation between ESP32 and ADS1115 as they did from M5STACK (M5STACK voltmeter), but according to what I found as a schematic they have only one resistor divider.I would like to do it with an op amp that will achieve optimal accuracy. I have no experience with calculating the parameters of an op-amp circuit.The resolution I plan to use is 2.048V or 4.096V.ADS1115 will be powered by 5V.Could I do this for all four ADC inputs?Could you help me with a sample circuit diagram to implement?I accept any recommendations!Thanks in advance!

author: Rick Law
author_rank: Super Contributor
timestamp: April 29, 2023, 09:11:13 pm
content: I do not have the expertise to answer your specific question(s), but I do have a suggestion: The link below is the manufacturer's (TI's) datasheet for ADS111x. It is a treasure trove of useful information. Check it out!!!https://www.ti.com/lit/ds/symlink/ads1115.pdf?ts=1682746862769On page 36, you will find a "typical application" which serves as a good example. I used the ADS1115 (adafruit module) with an Arduino (Nano, V3 era board) on many occasions. I used individual divider for each of the 4 channel and encounters no problem. You do have to watch the input impedance whichif I recalled correctlyis below 1 Mega Ohm. So if you input directly from a voltage divider, the divider's measuring resister will have a < 1MOhm resister in parallel with it. Check that out carefully, or hope that may be it was merely my poor recollection.It does blow easily if the voltage is improper, let alone inverting the polarity. You just have to design/implement with that in mind. Replacing the ADS1115 (on my adafruit module) is quite a fun affair and a learning experience.

author: dobsonr741
author_rank: Frequent Contributor
timestamp: April 30, 2023, 12:02:29 am
content: Take a look this build:http://www.scullcom.uk/millivolt-meter-mk2/Reference and the precision input divider might not be needed in yours, however best to copy the input buffer and input protection.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 30, 2023, 10:39:44 am
content: IN ground referenced mode the ADS1115 can only measure positive voltages (maybe a few mV in the negative direction). To get a full +- range one could lift the input ground to some 2 V and use the ADC in differential mode. This would however mean no more 4 channels bit 2 or maybe 3 (not sure if the ADC support this). This would also mean that the input signal ground is not the same as the ADC / µC ground.The input resistor of the divider would provide some protetion (current limiting) and this may be sufficient. This need high enough a resistor and a type suitable for a bit higher voltage (maybe 2 or 3 in sereis instead).Without extra clamping, so relying on the ADC internal diodes, clamping at one channel could however effect the accuracy of other channels.Extra buffers could avoid using the ADC internal diodes for clamping, but the buffers may also add some offset and drift.

author: iMo
author_rank: Super Contributor
timestamp: April 30, 2023, 11:10:35 am
content: The 1115 does not have an external Vref input, there is the internal Vref only.The voltages at its analog inputs cannot be outside 0..5V with 5V Vcc (see the datasheet).You may configure the inputs as "differential", with AIN- offset to, let say, 2.5V (against the GNDA) and the AIN+ pin voltage could then be from 0..5V (against the GNDA) "representing" bipolar -2.5V to +2.5V input range.Mind the input voltage VIN/GND (wired to AIN+ and AIN- via a divider R1/R2 for example) must be "floating" against the 1115's Vcc/GNDA (it means the input divider's GND is not wired to 1115's GNDA).For example with R1=90k and R2=10k the input voltage VIN could be from -25 to +25V (against GND).

author: MrAl
author_rank: Super Contributor
timestamp: April 30, 2023, 01:20:55 pm
content: Quote from: mishomvp on April 29, 2023, 01:24:58 amTo protect against a negative input you just need to clamp the input to ground with a diode, and provide a resistor from that to the input of the ADC.To measure both plus and minus voltage inputs you just need to bias the input to some level, like one-half of the ADC reference voltage. You do that with three resistors making a double voltage divider. That means connect three resistors, R1, R2, R3 to the same junction point, that leaves three open ends, one for each resistor. The open end of R1 becomes the input, the open end of R2 goes to a voltage reference (like what you have mentioned), and R3 goes to the actual ground of the ADC.(see diagram)The formula is then:Vadc=((Vin*R2+Vref*R1)*R3)/(R2*R3+R1*R3+R1*R2)where Vref is whatever reference you choose.Now since we will want symmetrical plus and minus measurements, and that's probably the best anyway, we know that for Vin=0 we must have one-half of the reference voltage Vref at the ADC input. This means that R3 is uniquely related to R1 and R2 as:R3=(R1*R2)/(R1-R2)Using this and the fact that with Vin equal to max and the ADC input equal to max, we can solve for R2:R2=(Vref*R1)/VinTaking all this together, we get:R2=Vref*R1/VinMaxR3=R1*R2/(R1-R2)Now say we have VinMax=20v (that would be really plus and minus 20v) and Vref=5v, and we choose R1=10k.That makes R2=2500 Ohms, and then R3=10000/3 Ohms, or 3333 Ohms.Now if Vref=4.096v and VinMax=20v again, then with R1=10k we get:R2=2048 OhmsR3=2575.452716297787 Ohms, maybe use 2575 Ohms or something else close to that.If Vref instead was 2.048, then:R2=1024 Ohms,R3=1140.82 Ohms, maybe use 1141 Ohms.You must connect the open end of R2 to the reference voltage, that's important.Using this arrangement, when Vin=20 the ADC input will be equal to the reference voltage, and when Vin=0 the ADC input will be equal to one-half of the reference voltage, and when Vin=-20 the ADC input will be equal to 0.This requires that you make the code for the reading as appropriate. Since 0v input means 1.024v in the above, that means that a reading of 1.024v represents 0.000 volts. Since 20v input means 2.048v to the ADC, that means that 2.048 represents +20v.Since -20v gives us 0v ADC input, that means that 0v to the ADC means the input is -20v.This means the code has to do this:VinMeasured=Vadc*A+BwhereA=Vref/(2*VinMax), andB=Vref/2With the previous example this would mean the code would be:Vin=(625*Vadc)/32-20where Vadc is the measured input to the ADC.So this solution only requires 3 resistors.In the diagram, V2 is the actual input voltage to be measured. V1 is the reference voltage.

author: mishomvp
author_rank: Newbie
timestamp: April 30, 2023, 08:40:00 pm
content: Hello,Thank you all!Thanks for the thorough answers.Now I understand what the idea was M5stack voltmeter.Now I need to find a suitable IC for the purpose. I think I found a suitable one MAX6138AEXR21+T.Do I need to add any additional RC filters?Do I need to add additional protection at the entrance, for example with BAV99.I'll draw up everything I've figured out so far and post it hereMy idea is to publish everything as open source so that if someone else wants to do it, they have something to use as an example. Of course, it will have been tested before.

author: dobsonr741
author_rank: Frequent Contributor
timestamp: April 30, 2023, 09:27:08 pm
content: If you are using the floating GND to measure bipolar voltage you need an isolated supply and an I2C isolator. Otherwise your GND will not float when you connect it to the DUT.There are plenty of DC/DC converters below $5 on DigiKey, as well as I2C isolators.

author: mishomvp
author_rank: Newbie
timestamp: April 30, 2023, 11:32:42 pm
content: Yes! Thinking of using an ISO1540 (Or whatever I can find in stock, CA-IS3020S is option too) IC for I2C and DC/DC Aimtec 5V/5V. 3.3V LDO to power I2C isolator from ESP32 side.

author: dobsonr741
author_rank: Frequent Contributor
timestamp: April 30, 2023, 11:42:14 pm
content: Go higher than 5V on the isolated side of the DCDC converter. The DCDC converter’s output has a lot of ripple, even when they claim to be stabilized. To feed a precision ADC you’ll need an LDO to get rid of that ripple. I use a 7.5V DCDC + LDO in a situation like yours for a 5V ADC supply.

author: mishomvp
author_rank: Newbie
timestamp: May 01, 2023, 12:37:37 am
content: Quote from: dobsonr741 on April 30, 2023, 11:42:14 pmThank you! I hadn't even thought about that!I've drawn the schematic, but there's more to add. Please correct me if I have made a mistake.

author: Srijal97
author_rank: Contributor
timestamp: January 03, 2024, 07:27:49 am
content: Quote from: mishomvp on May 01, 2023, 12:37:37 amHey @mishomvp, thank you for this post!I'm planning to implement a similar circuit using the ADS1110 to measure voltage of a 14S LiPo battery (about 42V to 60V). Did you end up trying out this circuit you have provided? Any lessons learned or changes made?