7
\$\begingroup\$

I want to measure the open circuit voltage of a battery cell (differential reading, that is A0-A1). In order to do that, I am using an industrial PLC based in Arduino Mega and a cheap but accurate ADC (ADS1115). I need to get an accuracy of 100uV (which I should be able to get with ADS1115 by far). However, due to some unexpected noise/currents, my accuracy is only 0.01V (really bad). This means that, if I want to measure for example 1.3005V, I get one second 1.3005 volts, the next second I get 1.3030 and the next second 1.2980 and so on. I know that the real voltage value has not changed at all, as I am checking its value with a BTS system (big and expensive separated equipment). I cannot have so much change in so little time, specially changing from increase to decrease in value. I need the measurement to be completely stable along time. Averaging the value alone is not an option.

This is my set up. Note that I am using a breadboard to connect everything.

enter image description here

Some comments which can help to the diagnosis:

  1. Could the problem be caused by the grounds? As I understand, with this set up I am having common grounds, and this could add current paths and create noise. I have read that it is recommended to isolate the analog ground (ADC) from the digital ground (PLC) by adding an isolator. Could this help? Anyways, I have read that an ADC has one digital ground but also an analog ground. However, in the ADC datasheet I find only one ground (the analog), which comes from the PLC.

  2. Could the problem be related with common Vdd? I mean, the same power supply is used first by the PLC, and then, the PLC gives the Vdd to the ADC. In the past, there was even no external power supply, so the ADC was powered by the proper Arduino Mega by the USB cable. This generated some big variations in the ADC reading that improved after adding the power supply. Please, note that the USB cable is always connected and with traffic (for debugging use only).

  3. I have read on this thread that it is a good practice to add an small capacitor to the ADC input to hold the signal. Could this help? I have not added one in my set up.

  4. ADS1115 datasheet suggests to add an small cap (0.1 uF) to decouple Vdd. Do I still need to to this, even though that Vdd comes from the PLC?

  5. Also ADS1115 datasheet suggests: Analog inputs with differential connections must have a capacitor placed differentially across the inputs. As I am doing a differential measure, could this improve the reading?

  6. I have already tried to add a low pass filter to one and both ADC inputs, but the measurement variation got worse!

  7. IMPORTANT UPDATE: As i briefly mentioned in the beginning (but I didn't put it in the drawing) I also have a Battery Test System (BTS) connected to the battery cell in order to charge/discharge it. This BTS operation is the following: it provides positive current (around 300 mA) during charge cycle, and then for the discharge cycle it provides -300 mA, then charging again, discharging, and the loop goes one like this. I say this right now because, when I tried to connect the (-) side of the battery (=A1) to the analog ground as some people have pointed out, it removed the noise. HOWEVER, during discharge cycles, a voltage drops appears and the battery loses a lot of its capacity (which is not feasible). As one person has suggested, maybe this is because the current is able to have a path and then it creates a voltage drop? Is there an easy way to avoid this current?. This is the set up with the BTS included:

enter image description here

\$\endgroup\$
11
  • 2
    \$\begingroup\$ Keep in mind that precision and repeatability are not the same as accuracy. There are several sources of error in the ADS1115 and it looks to me that you will be doing very well if you can achieve 14 bits of accuracy. Note that the worst-case gain error alone is 0.15% \$\endgroup\$ Jun 15, 2022 at 23:18
  • 3
    \$\begingroup\$ Am I right in saying you've literally connected the battery positive to A0 and negative to A1, and there's no other connection between the battery and your circuit? That ADS1115 is the adafruit module? If so, that whole battery setup is floating, and while there may indeed be a fixed voltage difference between A0 and A1, the value of either with respect to your ADC's ground is undefined. A0 and A1 are flopping up and down (in unison) like two glued-together leaves in a breeze. \$\endgroup\$ Jun 16, 2022 at 3:40
  • 4
    \$\begingroup\$ Regardless of what you do to improve the circuit, you should apply a low-pass filter in software, given that your sampling rate is vastly faster than any realistic battery voltage changes. \$\endgroup\$ Jun 16, 2022 at 13:00
  • 1
    \$\begingroup\$ 1. Yes. Show schematic and layout. 2. Yes. See above. 3. Depends on your speed requirements. Some ADCs are very hungry for input current when sampling. 5. Probably yes. 6. Show measurements and schematic please. \$\endgroup\$
    – winny
    Jun 16, 2022 at 14:56
  • 3
    \$\begingroup\$ @bardulia Averaging is a "moving average filter", not a LPF. There's a difference. For you though, either would help. It's better to read at 8 samples per second in the Arduino, and average 16 samples when you need to use the data. \$\endgroup\$
    – Graham
    Jun 16, 2022 at 15:08

4 Answers 4

9
\$\begingroup\$

A differential measurement still needs a ground reference point, due to how most ADC front ends/signal conditioners are designed.

You need to connect the (-) side of the battery to both one analog input and to GND of the ADC module.

The decoupling capacitor on the supply rail to the ADC is always needed. Sometimes you need two of them for good performance. The capacitors need to be on the PCB where the ADC is. They won't do much good if they are connected via the impedances present in typical breadboard construction.

\$\endgroup\$
11
  • 1
    \$\begingroup\$ Pretty sure this is the right answer. Simple to fix too. I'm not sure if I understood your "fix" though. Connect battery negative to ADC GND and battery positive to A0. I assume that's what you meant. \$\endgroup\$ Jun 16, 2022 at 4:04
  • 1
    \$\begingroup\$ @SimonFitch There is some advantage to differential input in spite of one side being grounded. So (-) goes to A0 and GND, (+) goes to A1, ADC is configured for differential input. \$\endgroup\$ Jun 16, 2022 at 4:21
  • 1
    \$\begingroup\$ I'm not sure I see what advantages there would be. Care to elaborate? \$\endgroup\$ Jun 16, 2022 at 5:51
  • 1
    \$\begingroup\$ @bardulia I see now that the last time you asked this question you were told that you need a ground connection to complete a circuit. This is absolutely true. Reconnect the ground so that the ADC can function. If that causes problems (which it will not if your drawing is accurate), ask why in your question. \$\endgroup\$ Jun 16, 2022 at 17:15
  • 1
    \$\begingroup\$ @bardulia Your new drawing shows that the battery test system is powered by the battery you are testing. Is that correct? \$\endgroup\$ Jun 16, 2022 at 22:04
4
\$\begingroup\$

Question 1:

I do not expect ground currents in your analog path that could mess up your readings. The ADC is at an end point of the supply path.

Question 2 and 4:

Yes, absolut possible. A series inductor of 10-100 µH and a capacitor of at least 100 nF at the ADC supply side are good style. This improves the performance of the voltage reference and the amplifier inside the ADC.

Question 3 and 5:

This is true for ADCs, that do not contain buffer amplifiers, like most ADCs integrated in microcontrollers. And it may help on noisy or high impedance signal sources. Your system has a buffer amp in the ADC and the differential noise from a battery should be very low. Summary: This will probably not help.

BUT we can expect a large common mode voltage noise. The battery is not connected to a reference point of your circuit. It has a random floating charge and receives all sort of noise from the environment. The common mode input resistance of the ADS1115 is 6 Mohm in this mode and can not deal with this noise, which can reach several volts in both directions.

The voltages at the ADC inputs may temporary leave the allowed range and the difference seen by the ADC is lower in this case.

The quick solution is to connect battery minus (=A1) to ADC AGND. This way the circuit is no longer a bipolar instrument.

If you want the ADC to operate more in the center of the input range, provide a voltage divider with 2 equal resistors between VDD and AGND and connect this to A1. A capacitor of some µF between A1 and AGND will cancel the common mode noise. This solution allows bipolar differential measurements.

\$\endgroup\$
14
  • 1
    \$\begingroup\$ @bardulia You can use an isolation DC/DC converter for the ADC if your PLC is in an industrial rack with a lot of other components, but typically good L/C filtering is good enough. Can you explain the "voltage consuption" during discharge more in detail? Probably my last paragraph solves this. \$\endgroup\$
    – Jens
    Jun 16, 2022 at 15:50
  • 1
    \$\begingroup\$ @bardulia I assume the separate BTS is not fully isolated from your PLC GND. Its activity can mess up your meaurement and the BTS does not expect to have external current paths to somewhere else. It could react erratic. In this industrial context you should use an insulated DC/DC converter to feed the ADC and use digital isolators like e.g. ADuM1251 for the I2C communication. Make the ADC a DC island. \$\endgroup\$
    – Jens
    Jun 16, 2022 at 18:38
  • 1
    \$\begingroup\$ @bardulia I don't think so, but I would like to see the new schematic for a qualified answer. \$\endgroup\$
    – Jens
    Jul 18, 2022 at 17:10
  • 1
    \$\begingroup\$ @bardulia 200uV spike is not far from the resolution of the ADC, improving this is a challenge. You can try 2 x 10 ohm in the input path and 10 nF across the inputs. Another attempt I often use is to buffer the results and replace the artefacts by the mean value of the adjacent values. You can easily double the sample rate to implement this. What voltage range for the PGA do you use? The ADC uses oversampling, so you don't know if the spike is one single large impact or several small deviations in one oversampling interval. A much higher sampling rate could show this. \$\endgroup\$
    – Jens
    Jul 23, 2022 at 2:56
  • 1
    \$\begingroup\$ @bardulia This RC filter is just a blind shot for typical RF noise. If you don't know the nature of the artefact, it is hard to fight it. Could as well be a large common mode impact, which would need two capacitors to GND. Try to catch such an event with a scope or make some extra EMI noise with mobile phone, drilling machine etc close by. \$\endgroup\$
    – Jens
    Jul 24, 2022 at 14:26
3
\$\begingroup\$

Could the problem be caused by the grounds?

Yes and the cabling could also do this. Current going back through the cable between the ADS and the PLC can cause voltage differences on ground. Know what the current is and use a decently sized wire (the resistance in the wire will create voltage noise V=IR)

Could the problem be related with common Vdd? Yes, measure the ripple and then look at the PSRR and calculate the noise. PSRR is a figure that tells you how much the power supply will affect the measurement.

I have read on this thread that it is a good practice to add an small capacitor to the ADC input to hold the signal. Could this help?

Adding filtering (not a capacitor) helps in rejecting noise, you can't filter everything though because you will start filtering signal. This must be calculated

ADS1115 datasheet suggests to add an small cap (0.1uF) to decouple Vdd. Do I still need to to this, even though that Vdd comes from the PLC?.

Yes you do, it will help with noise from power and ground and common mode noise from cabling. Ideally you should have a voltage regulator next to the ADS (and your reference should be on the same board if it needs one)

Also ADS1115 datasheet suggests: Analog inputs with differential connections must have a capacitor placed differentially across the inputs. As I am doing a differential measure, could this improve the reading?

I would do what the datasheet says.

I have already tried to add a low pass filter to one and both ADC inputs, but the measurement variation got worse!

If you are doing a differential measurement, you need a differential LPF, if you only filter one side then the noise will not be subtracted differentially and will look worse in most cases.

\$\endgroup\$
7
  • \$\begingroup\$ Regarding your first paragraph, that is exactly what happens when I connect the ground to the negative side of the battery: a current appears and I get a high voltage drop which affects negatively the capacity of the battery (not feasible). This only happens during battery discharge cycles (not during charge cycles). On the other hand, I will try all of your suggestions one by one to see if it improves. \$\endgroup\$
    – bardulia
    Jun 16, 2022 at 15:26
  • \$\begingroup\$ I have updated the question with the BTS system that I didn't talk about before (point 7 of the diagnosis comments). \$\endgroup\$
    – bardulia
    Jun 16, 2022 at 21:59
  • \$\begingroup\$ I have some progress. Find the new schematic here postimg.cc/PNj2dxXD The measurement has improved a lot because right now I have 1mV accuracy. The only problem I still got is that, once in a while, I get an spike in the measurement around 0,2mV but in the opposite direction of the charge/discharche cycle. My feeling is that the ADC is not able to hold the value sometimes. Any ideas?. I guess I can try a differentical cap at the ADC input but I don't know how to calculate its value (for example, the cut-off frequency, as the datasheet says). \$\endgroup\$
    – bardulia
    Jul 22, 2022 at 23:03
  • 1
    \$\begingroup\$ Yes, DC DC have more ripple. PSRR of the ampliifier describes how much of the power supply ripple will get through to the signal \$\endgroup\$
    – Voltage Spike
    Sep 20, 2022 at 15:47
  • 1
    \$\begingroup\$ Yeah, that would be best \$\endgroup\$
    – Voltage Spike
    Sep 30, 2022 at 13:19
2
\$\begingroup\$

You need an anti-alias filter in hardware

You say

Filtering/averaging is not an option

However if you don't low-pass-filter in hardware at the Nyquist rate or lower, aliasing is going to seriously mess up your measurements. As VoltageSpike says, for a differential signal you'll need filters on both sides of the signal.

According to this link the ADC can sample at up to 860Hz. So all the noise above 430Hz (or whatever speed you measure at) is getting "reflected" back down. This isn't going to be pretty. Just by the way, this is one of the reasons that early CDs in the 1980s had a bad reputation, because they hadn't properly worked out anti-aliasing on the ADCs back then.

You would benefit from filtering in software

Battery voltage doesn't change that quickly, so consider how fast you genuinely need this to respond. If you're sampling at 5ms intervals but you only need the data every 100ms, a digital low-pass filter in software will definitely improve your signal.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ The OP should note that software filtering can improve resolution and reduce the effects of random noise, but it can not remove systemic errors and improve accuracy. \$\endgroup\$ Jun 16, 2022 at 15:01
  • \$\begingroup\$ @ElliotAlderson I agree on that. For me, resolution is not an issue as sometimes I can get the one expected, it is an accuracy and error issue. \$\endgroup\$
    – bardulia
    Jun 16, 2022 at 15:23
  • \$\begingroup\$ Graham, right now I have set the ADC to sample as slow as possible (8 samples per second), because I only need to take samples every 2 seconds or so. I already tried in the past to set a hardware LPF (RC one) around 50Hz, but the results were worse. I have to retry it anyways because maybe the layout was not correct. \$\endgroup\$
    – bardulia
    Jun 16, 2022 at 15:35
  • 1
    \$\begingroup\$ @bardulia Both are simply wrong, so whoever those people are, ignore them as sources of advice! :) If your sample rate is 860Hz, you should have an anti-aliasing cutoff at 430Hz (Nyquist) or slower. It's that simple. \$\endgroup\$
    – Graham
    Jul 25, 2022 at 14:10
  • 1
    \$\begingroup\$ @bardulia Theoretically, if phase response is an issue for you then you might choose to cut higher and accept that you're going to let through some extra noise. This would only be for highly specialised applications, and would be an engineering judgement of accepting higher noise to get a filter that lets the signal through faster. It is not, ever, something that should be done all the time. Anyone who suggests that is literally so ignorant of the subject that they don't even know what aliasing is, and that's the level you should believe their advice. :) \$\endgroup\$
    – Graham
    Jul 25, 2022 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.