Gravity: I2C ADS1115 16-Bit ADC Module (Arduino & Raspberry Pi Compatible) (DFR0553)

This is a placeholder topic for “Gravity: I2C ADS1115 16-Bit ADC Module (Arduino & Raspberry Pi Compatible)” comments.

DFRobot I2C ADS1115 16-bit ADC module can accurately collect and convert analog signals. Through this ADC module, Raspberry Pi can easily use a wide range of Gravity…

Read more

Product is garbage. It does NOT provide 16 bit. At max range 16 bits means 0.18mV resolution. This adc won’t read lower than 1mV.
Edit - See my reply below.

1 Like

Hi David

I think this is probably a bit unfair.
at 16bit if the input voltage = the reference then the ADC will output a number 65535 with lower input voltages producing numbers progressively lower down to Zero. The ADC only produces a number, what is done with this is up to the user.

I would suggest the library then converts this result to millivolts for manipulation or whatever. From the example it is obvious the reference is 5.0V

Now a resolution of 1mV in 5000mV is a resolution ofd 0.02%. Just how low a resolution and accuracy are you after. I would suggest if you have a lab or something and want better you may have to write your own library.

I may be entirely wrong here and stand corrected if this is so.
Cheers Bob
Edit;
If you click “more documents” in Core description there are a couple of examples which suggest a resolution of 1mV is correct for this device using the supplied libraries.

2 Likes

Do you mean that you can’t get readings between 0mV and 1mV? The device will always return an integer reading, but what that means as a voltage depends on your settings for the thresholds and the gain. What have you set the thresholds and gain to when you are trying to read voltages less than 1mV?

2 Likes

What is the benefit of using this? I mean Arduino has it’s own ADC channels. Is there any benefit of using this module instead? Thank you.

1 Like

Hi Teplia
The Arduino ADC is 10 bit and returns 1023 steps. This unit is 16 bit and returns 65535 steps. Also most of the RPi don’t have a built in ADC so something like this is needed for analog inputs.
Cheers Bob

4 Likes

I am using the ADC with a Nano to build a milliOhm meter (short finder). With the Nano ADC the resolution limit is 0.05ohm. With the ADC it should be better than 0.001ohm. Note that I am not after precision - just the resolution to detect very small resistance differences.

At the default gain (6.14v) the resolution is supposed to be 0.187mv (not 1 mV). The DFRobot library will only return integer mV values regardless of gain. I switched to the Adafruit 1X15 library (for their version of the ADC) and their function returns integer steps and a function that converts the steps to mV which provider decimal values. So it appears the ADC is fine - it’s just the DFRobot library which has the limitation (or it’s just not well documented).

4 Likes

Thanks a lot.

1 Like

Hi All

Using the Gravity a2d board to control a 200AH LiFePo4 Battery by measuring 4 cells to decide what action to take.
Using a Rpi ZeroW with FreeBasic controlling Opto relays for Charge, Load etc.
Measuring voltages from around 3.00 V to 3.60 V , but the wiring of this requires a resistor divider
network to keep within the voltage limits of the device.
So, at the lowest theoretical value:
Cell1 would be 3.0 V relative to Negative
Cell2 would be 6.0, Cell3 would be 9.0 and Cell4 12.0 v.
By using a resistor divider network of metal film resistors I bring cells 2 to 4 down to 3.0 volts.
Cell 1 is direct to AN1 with 1k ohm to Negative
Cell 2 is with 1k in series and 1k to negative
Cell 3 is with 2k in series and 1k to Negative
Cell 4 is with 3k in series with 1k to negative.

Not using Gain and reading 500 samples of which I remove the High / Low samples and then average the rest. (Typically 498 samples are averaged)
At the moment using continuous sampling, I read each channel and then wait 30 seconds and do it again.

From reading TI forums , resistors over 2k are not recommended as they alter the accuracy.
My software corrects that with a calibration value. Accurate mV Multimeter value / Average Count = ie: 0.1261725
Using a different divider on AN4 I get the actual Battery voltage as well.
When running it is stable within 2 counts (as long as there are no loads or charging currents)

HOWEVER, comparing the reported value in the morning versus later in the day I am getting Total Battery errors
amounting to 0.1 V. Now the Temperature difference is only about 15-20 degree C.

Trying to ascertain what I have done wrong.
Will do more test like heatgun on resistors and looking at the stability of AN1 (No series resistor), but
other than that I am at a loss as to what is the cause of the drift.

I feel sure that the device (ADS1115) is Temp stable.

Looking for constructive comments as to possible causes.

Rgards

1 Like

Hi JW
Is the error going up or down.
Could we have a circuit showing exactly how all these resistors and battery are connected/switched to the ADC.
Could the “error” be the battery discharging. A circuit will help here.
Cheers Bob

1 Like

Hi Robert

I will extract the relevant part of the circuit and post it.
Worth mentioning there are no AC voltages involved, everything runs from the battery.

The ADS1115 is reading lower then the Battery, but will verify and quantify that.
A Lithium battery is nowhere near as bad as other batteries in losing charge when no load connected.
Have had this one sitting at 13.2 V for months.

The battery is discharging of course by running the Rpi , but measuring the Voltage of the battery verifies the error.
As an example , running the Microwave for 30 seconds doesn’t drop the battery by 0.1 v and that draws 150 amps.

The other possibility is that I have quit the Rpi program and made unrelated changes and then started the program again.
That includes re-initialising the !2C or sometimes even re-powering it.
However that is the nature of the beast, having to power off and then On again and expecting to get the same reading.

1 Like

Hi All

Extract of the circuit.
Extract

1 Like

Hi JW
Don’t see much basically wrong with that set up except the value chosen for the resistors seems a bit low. Personally I would up that by a factor of 10 (basic 10k). That is a pretty big battery so the permanent drain of the RPi and resistor networks should not worry it too much.

The only thing I can see is the batteries will have a slightly different current through them even though they are in series. This is due to your metering resistor set up. Think about it. Battery 1 (on the right in your circuit) will have the 3mA due to its own 1k to ground plus the 3mA for the other battery resistor networks. Total 12mA. Battery 2 will have its own 3mA plus battery 3 & 4, total 9mA. Battery 3 will have 6mA and battery 4 3mA. Now I don’t know if this is going to upset your set up or not but is worth keeping in mind.

This would be similar to a scenario often come across in the motor industry. 24V battery system. 12V radio connected across one 12V battery in a 2 battery series connection. The radio only discharges one battery. When charging the charging process only continues until the upper 12V batter is fully charged. The lower (the one with the radio connected) one will never fully charge. This will continue for some time until the lower one is flat. Before this happens you will probably find the vehicle will no longer start but not before the lower battery has become lower than the safe discharge level snd is damaged.

This is overcome in a system such as yours due to the balancing carried out by the battery management circuitry during charging. I am assuming you charge separately with such a system. The thing you have to watch is you don’t discharge battery 1 to an unsafe level by possibly using a protection circuit on each battery.

Raising your divider values by a factor of 10 of course will reduce this unbalance without interfering with your division ratios.

This unbalance may not cause a problem but is worth keeping in mind.
Cheers Bob
PS. I don’t think a heat gun on the resistors is going to reveal anything. They should be 1% metal film resistors with a pretty good temp coefficient and are all subject to the same ambient temperature anyway so the ratios should not change.

1 Like

Hi Robert

Many thanks for your time replying.
You may well have hit the area of contention with the resistors.(input impedance)

Around 3pm today I re-calibrated the values and the next reads thereafter showed the values spot on.
In other words the the ADS1115 reported 3.350 V and that is what I measured with the Fluke.

Around 6pm I checked and found the following.
Note: These are actual multimeter values versus ADS1115

Cell 1 (No series R) read 4 mV higher, 31 counts
Cell 2 (1K series R) read 14 mV higher, 108 counts
Cell 3 (2 k series R) read 17 mV higher, 132 counts
Cell 4 (3 k series R) read 37 mV higher, 280 counts
Total Error = 72mv

The puzzle is that the error increases with Resistor Value.
This seems to support the statement I read that said “the lower the Input impedance, the more accurate the result”
BUT, the result was perfectly accurate for about 10 minutes.

It also mentioned a capacitor on the analog In ports to reduce the input impedance.
That will be my next test and also do a dump into a file of all 500 reads.
As the A2D is a sigma Delta device , doing 500 reads with only 6mSec in between each read may be to fast.
In other words will an input cap recover to stability fast enough for the next read.

Note that I have posted a question on the TI Forum, but won’t hear back from them till maybe Tuesday. (Monday in the US)

1 Like

Hi JW
Are you measuring directly across individual cells or measuring with respect to -ve or ground. I don’t know why the cells would be higher unless you are charging at the same time. It appears the cells are indeed going higher as reflected in the ADC counts, in other words the ADC seems to be telling the truth. One problem in measuring voltage of individual cells WRT ground is that the charge condition of any cells nearer to ground will affect the overall readings above it. But if you are comparing readings between cells you would be recording the cell values. Another thing any change to the internal resistance of the cells will affect readings as this is effectively in series with the series resistor or the upper leg of the voltage divider.

I don’t know where you read that. The 1k Rs to ground could be regarded as input impedance, the others are source impedance. It is true that the lower input resistor results in a more accurate reading but given the DMM is 10MΩ (which comes into the equation) and the ADC would probably be in the GigΩ or even TeraΩ range I think this can be safely ignored.

A cap across the ADC input will do nothing. There is no recovering to do as the voltage is there always and will simply charge up and follow the battery voltage.

There is one way the battery APPARENT voltage will increase. Are you driving any sort of motor speed controller or any other PWM sort of device. If you are, the leads from the battery to the switched controller should be VERY short or a capacitor of several thousand µF should be connected across the battery input AT THE SWITCHED CONTROLLER. The reason is the inductance of a longer piece of wire is being pumped by the PWM and results in an apparent increase in source voltage (battery). Similar to the action of a boost converter. That is the reason the battery wires on golf buggies and similar devices seem ridiculously short.
Cheers Bob
PS. The only way the higher divider values would alter the accuracy is if the ADC input impedance is indeed low (100s of kΩs instead of GΩs). I don’t know what the actual impedance of that particular ADC is but some time ago I had occasion to approximately measure the Arduino ADC and found it to be something like 2GΩ. I created a post on this subject at the time describing how I did this.

1 Like

Hi All

More detail needed.

Each cell is measured with respect to Ground, BUT because the Voltages on cells 2,3,4 are to high for the ADS1115, a voltage divider is employed.
Such is the reason for the 1k,2k,3k resistors.
All measurements are taken without any charging current and the only load is the Rpi.
The only other device in circuit is a passive Cell balancer, which I have unplugged to eliminate it’s effect.
Basically it is a number of super capacitors that charge from the highest cell and discharge into the lowest.

Robert, you are correct in that the lower cells skew the result.
If we look at a basic value of 3v per cell, then the voltages WRT would be 3,6,9,12
If Cell1 is 3.1 then the true result of Cell2 would be 6.1. If it reads 6.2 then Cell2 is also at 3.1 etc,etc

But this discussion has highlighted my error in reading the voltage manually with the Fluke.(as well as in software)
I should be reading WRT and calculating the cell voltages as I did per above.
Then in software multiply cells to get the actual value (ie:6,9,12) and then analyze each one by subtracting the lower cell values.
The actual multiplier may not be precisely 2,3,4. I have to get my brain around that.

JW160152 the reference to lower impedance accuracy was in a TI forum with the answer coming from a TI rep.
The discussion was about interfacing higher source output impedance devices. The cap was also a suggestion by the TI rep.

Without taking a UNI course on how to read TI spec sheets, I have not been able to easily find the actual
input impedance of the ADS1115. What confuses the issue is that “any pin except power supply pins can take up to 10mA”
If that includes the Analog In, then the input impedance is definitely not in the gOhm range.

1 Like

Hi JW

If the resistors are 1% it will be or as close as you will need assuming a very high ADC input impedance.
If this impedance is low enough this must be considered as being in parallel with the lower resistor of the divider. Bear in mind this only applies to the upper 3 cells as you don’t have an effective divider on the bottom cell, just a 1k to ground and the internal resistance of the cell should be low enough to be ignored.

You can get an idea of the ADC input impedance by doing the following.
Connect i cell directly to the ADC, note the ADC reading.
Connect the same cell to the ADC via a 10MΩ resistor or as high a value you have.
Note the ADC reading.
If the input resistance is very high there will be little change in ADC number. This number will vary in proportion to the lowering of input impedance.If you have a high enough resistor of 100MΩ or so it is possible to calculate the approximate input resistance. Using this method you are effectively using the ADC as a voltmeter (which it is). Do not use your DMM to measure as if the ADC resistance is high the 10MΩ of the DMM will have the greatest effect.

I am a bit confused here too. What is the actual IC on that ADC device and I will try to find a data sheet. Some do quote the input resistance. Or post a link to the relevant site.

This is a bit different to a battery. A capacitor (super or not) will lose about 63% of its voltage in one time constant so the voltage will drop more rapidly than a battery and more suited to a higher impedance load (longer time constant) but to have 200AHr you must have lots of Farads. I am not sure AHr is the right terminology for capacitor rating, will try to check on that. I have never used them but I am aware of the relative rapid initial voltage drop.
Cheers Bob

1 Like

Add on
Just found the data sheet.

I think that is an indication of the minimum series or source impedance you possibly should be using a source resistor of minimum 470Ω assuming you have programmed a FSD of 4.096V. connect this AFTER the 1k resistor or in other words connect the 1k directly from battery to ground then the current limiting resistor battery to ADC or leave the 1kΩ out altogether. Your current limiting resistor can be a bit higher but I would not go higher than 1k as this is now forming a voltage divider with the 6MΩ input impedance.

It appears the input impedance is quite low. For 4.096V FSD the common mode impedance is only 6MΩ
but your 1kΩ resistor in the divider lower leg for the upper 3 batteries should be OK, with the 6MΩ in parallel the result is 999.83Ω, a negligible change. The upper resistors of 1k, 2k, 3k should limit the current to well less than 10mA.

DO NOT measure voltage between the ADC and ground, measure at the battery. The 10MΩ of your DMM will cause an error in the real ADC reading. Not much but it might worry you and confuse the issue
Cheers Bob

1 Like

Hi JW
I just re-read your last post. Please disregard my previous reference to super cap discharging. I realise now you were referring to the cell balancer NOT the batteries. Senior moment, I am allowed to have these.

Referring to your measurement technique. The data sheet for that chip gives an input impedance of 6MΩ common mode on FSD setting of 4.096V which I assume you are using. It also gives an impedance of 15MΩ for differential 4.096V FSD input. This suggests that you can set it to measure the difference voltage between inputs. This is basically what you are doing by a subtraction method. It would be nicer if you could do this directly as I think maybe you can as one of the uses listed is battery monitoring and management. I don’t quite know how this is done as I have not read the data sheet in detail. I might do that if I get a chance and you might look into this too as it might be better than the unbalanced system currently under trial.
Cheers Bob

1 Like

Hi Rob

At the ripe age of 77 I get a few of those senior moments as well.
Have included a diagram with voltages that show something very interesting.
The voltage drop across the 3k for example is 791 mV which is 0.2mA.
But after seeing these results I am now at a loss as how to proceed to get actual cell voltages.
Let me know what you think of these results.
Elec-04.pdf (13.4 KB)
Regards

EDIT: The differential mode only allows 2 analog inputs.
EDIT2: If the voltage drop is linear when the rail goes from say 3.1 V to 3.5 then it may be do-able.
Edit3: Working just on Cell2; 25019 x 2 = 50038 x 0.133078 = 6659 - Cell1 3329 = 3330 (Cell2)
The constant of 0.133078 comes from Actual V WRT Earth = 6659 / 50038
Like I said, if the voltage drop is linear, then the constant method will work.

1 Like