This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS1115: Fluctuations and Offset Errors in Single-Ended Mode with ADS1115.

Part Number: ADS1115
Other Parts Discussed in Thread: ADS1220, ADS131M02

Tool/software:

Hello,

I am currently working with the ADS1115 ADC and STM32f4, in my project to measure current changes across an AC load using a CT sensor. I have encountered fluctuations in ADC readings when using single-ended mode, but the readings are stable in differential mode. Below are the details of my configuration and issue:

Configuration:
 
I need to operate ADC in continous mode not in single shot mode so using conversion ready signal in ALERT/READY pin i am reading the value stored in conversion register. According to the information in data sheet i setted the High_threshold register msb with 1 (the value i wrote is 0x8000) and low threshold register MSB to 0 (the value i wrote to this register is 0x0000)

  1. ADS1115 Settings:

    • OS bit: 0 (conversion is not in progress)
    • MUX[14:12]:
      • For differential mode (the following i checked with): 
        • 001: AINP = AIN0, AINN = AIN3
        • 010: AINP = AIN1, AINN = AIN3
        • 011: AINP = AIN2, AINN = AIN3
      • For single-ended mode:
        • 100: AINP = AIN0, AINN = GND
        • 101: AINP = AIN1, AINN = GND
        • 110: AINP = AIN2, AINN = GND
        • 111: AINP = AIN3, AINN = GND
    • FSR: checked with 2.048V and 4.096V and the formula used to convert the ADC value is voltage = ((adc_value * FSR * 1000) / 32768);
    • Data Rate: 128SPS
    • Comparator Mode: Zero
    • Comparator Polarity: One
    • Comp_que: Set to 00 (no comparator)
  2. Hardware Setup:

    • VDD: 5V connected to ADS1115
    • Ground: Common ground across all components (ADS1115, STM32 microcontroller, and voltage divider)
    • Input Voltage for Testing: 3.3V from the STM32 microcontroller, stepped down to 1.651V using a voltage divider circuit (2 resistors, each 1kΩ).
    • Test Signals: Used a multimeter to verify input voltage at 1.651V.

Observations:

  1. Fluctuations in Single-Ended Mode:

    • When I apply 1.651V to the input (AIN0), I observe fluctuations in the ADC readings. The values are not constant and vary in a range like 1.601V, 1.624V, and 1.532V at different times. I am difficult to predict the variation.
  2. Offset Readings:

    • When I check the ADC value with 0V input (to measure offset), I observe fluctuating negative values like -0.101V, -0.92V, and -0.27V at different times. These values are inconsistent, making it difficult to calibrate the offset error.
  3. Stable Readings in Differential Mode:

    • When I switch to differential mode (AINP = AIN0, AINN = AIN3), the ADC shows stable and correct readings: 1.653V when applying the input voltage and 0V when measuring the offset by connecting 0V.


      Questions:

      • Why am I observing these fluctuations in single-ended mode?
      • What could be causing the offset errors in single-ended mode, and how can I correct them?
      • Is there a way to stabilize the ADC readings in single-ended mode, similar to the stable readings in differential mode?
      • How can I add the offset values for proper calibration in my application?

      Any help, suggestions, or guidance on how to resolve this issue would be greatly appreciated!

  • Hi Athulya,

    I'll take a look at this and get back to you by tomorrow.

    Best Regards,

    Angel

  • Hi Angel,

    Thank you so much for your prompt response. Looking forward to hearing from you tomorrow.

    Best Regards,

    Athulya

  • Hi Athulya,

    to measure current changes across an AC load using a CT sensor.

    You seem to be describing an AC application. The ADS1115 is typically intended to measure DC / slow-moving signals.

    The max output data rate offered by the ADS1115 is 860SPS. Using the max data rate available, for detecting a 60Hz signal, you would only get about 14 samples per cycle of your waveform. 

    This is more than likely not enough for your application, and won't get a good recreation of the input signal. 

    You might want to consider using a different ADC that is meant for these types of AC applications, such as the ADS131M0x family of devices:

    ADS131M04 data sheet, product information and support | TI.com

    the formula used to convert the ADC value is voltage = ((adc_value * FSR * 1000) / 32768)

    The voltage value is calculated by multiplying the output code, when converted from binary to decimal, times the LSB size corresponding to the FSR configuration.

    Voltage value = adc_value (in decimal) * LSB size

    Comp_que: Set to 00 (no comparator)

    '11' would be what disables the comparator. '00' asserts the alert pin after one conversion when the output is not within your lo-thresh / hi_thresh register settings. 

    Offset Readings

    Offset measurements are performed by tying the inputs together for the differential measurements, and shorting the inputs to GND for the single-ended measurements. Is this what you are doing to measure offset, or are the inputs simply being left floating?

    When I switch to differential mode (AINP = AIN0, AINN = AIN3), the ADC shows stable and correct readings: 1.653V when applying the input voltage

    From your drawing, the output of the voltage divider is connected to AIN0, but AIN3 seems to be left floating. Can you clarify what are the actual input voltages at the input pins for your different MUX configurations?

    Best Regards,

    Angel

  • Hello Angel,

    Thank you for your reply.

    I am working on measuring current and voltage using a CT sensor and a voltage sensing module (ZMPT101B) with the ADS1115 ADC. I have a few clarifications and issues, and I would greatly appreciate your input.

    1. Regarding Sampling Rate for 50Hz AC Signal:
      According to Indian standards, the AC frequency is 50Hz. Using the ADS1115 at its maximum data rate of 860 SPS provides 17 samples per cycle. From my understanding, this might not be enough for accurately calculating RMS or other AC parameters. Could you please help me understand whether this sample rate is sufficient or explain why it might not be ideal for calculating accurate values?

    2. Voltage Conversion Formula:
      I am using the correct LSB size corresponding to the selected FSR configuration for converting the ADC value to voltage.

    3. Comparator Configuration:
      I configured the COMP_QUE bits to 00 as I am not using the window comparator feature (high and low threshold registers). I have set the ADC to continuous mode, and from my understanding of the datasheet:

      • With COMP_QUE = 00 and COMP_POL = 1, the ALERT/RDY pin goes high when data is ready in the conversion register.
      • I set the MSB of the high threshold register to 1 and the MSB of the low threshold register to 0, ensuring the comparator is configured properly for my application.
    4. Offset Calculation:
      For single-ended configuration, I grounded the unused pin. For differential configuration, I connected the input to the corresponding analog pin and grounded A3. With this setup, I am now getting reasonable values.


    However, I am stuck on the following issues:

    1. RMS Calculation for Voltage and Current:

      • I connected the CT sensor to A0 and the ZMPT101B module to A1.
      • In my code, I first calculate the RMS current (from A0), followed by the RMS voltage (from A1). Initially, this did not work correctly because the ADC was still in continuous mode, and I noticed issues while switching channels.
      • To fix this, before reading the A1 value, I stopped the ADC by setting the MODE bit (8th bit) to configure the ADC into single-shot mode, putting it in a power-down state. Then, I reconfigured the ADS1115 for continuous mode to read from A1. This approach works, but I am unsure if it is an efficient way to handle channel switching for voltage and current measurements.
    2. Using ADS1115 for Energy Monitoring:
      While I understand the ADS1115 might not be ideal for AC signal applications, I am constrained to use this ADC for now. Do you have any suggestions or more efficient approaches to calculate voltage and current for energy monitoring with the ADS1115?

    Thank you for your time and suggestions. Please let me know if I need to provide more details.

  • Hi Athulya,

    I'll get back to you on this early next week.

    Best Regards,

    Angel

  • Hi Angel,

    Thank you for your response. I'll wait to hear back from you.

    Looking forward to your feedback.

    Best Regards,
    Athulya

  • Hi Athulya, 

    Initially, this did not work correctly because the ADC was still in continuous mode, and I noticed issues while switching channels.

    When cycling through the mux it is better to use single-shot mode.  The main reason is that when running in continuous mode the new configuration will not take place until the conversion ends if there is already an ongoing conversion.  This will require that the next conversion after the mux change needs to be thrown away so that the conversion result is valid for the desired mux input.  This differs from the ADS1220, for example, where the conversion will automatically restart when writing a new configuration to the registers. The issue when switching mux channels in continuous conversion mode, is that it is possible that the next conversion reading after changing the mux setting still corresponds to the previous configuration. 

    Unfortunately, I don't have good suggestions for energy monitoring as this device was not intended for these types of applications. You will have to decide if 17 samples per cycle is good enough for calculating your parameters.

    I can suggest taking a look at the ADS131M02, an ADC with a higher data rate more suitable for these types of applications:

    ADS131M02 data sheet, product information and support | TI.com

    Best Regards,

    Angel

  • Hi Angel,

    Sure, I will discuss this with my management. Thank you for your reply and suggestion!

    Thanks and Regards
    Athulya