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.

ADS1120: ADS1120 sample code.

Part Number: ADS1120
Other Parts Discussed in Thread: ADS124S08, ADS1220, ADS114S06

 I am looking for a sample code for the measurement of the temperature via 3 wire sensors like PT100/PT1000 or 2 wire sensors like NTC /PTC. I am a beginner with ADS1120 so any help in this regard will be much appreciated.

  • Hello,

    All supporting material is available on device product page, ADS1120, this will be true for all TI devices, any supplementary documentation or EVM will be listed.

    As for software, there is a sample code available for this family of devices, available in the Design and Development section of the product page.

    Regards

    Cynthia

  • Hi Syed,

    I would suggests reviewing the applications section of the ADS1120 datasheet.  I would also recommend taking a look at A Basic Guide to RTD Measurements.  This document is a very helpful guide to explain the measurements.  We are currently working on specific example code for temperature measurements for the ADS1x20 family of devices, but the code is not yet finalized and unfortunately I cannot give a timetable as to when it would be available.  We do have a Temperature Sensing Library that you may find helpful as it shows the various code examples of how the measurements are made but the code is geared toward the ADS124S08 devices.  However the code could be adapted for your use.

    There is basic example code available for the ADS1220 which is the 24-bit version.  The example would only differ with respect to the length of the conversion result for the ADS1120.  All communication commands and register settings would be the same.

    Best regards,

    Bob B

  • Hi Bob,

    thanks for your answer. Actually, we were using ADS114S06 in our devices and we are now using ADS112 in the smaller variant of our device. I am currently trying to measure a 2 wire RTD. I am using a resistor of 400 ohms in place of RTD, with my fixed Rref = 4020 ohms. RTD is connected between AIN1 and AIN2. IDAC1 is set at 500uA and AIN0 is selected as IDAC1 Mux. Currently, I have turned off the IDAC2. Gain is 1. SPS is normal 20. PGA is enabled and internal temp + burn out current is disabled. 

    After configuring the SPI. I reset ADC, afterwards Write 4 bytes of config 0x43 0x30 0x00 0x55 0x20. Read it back and it is the same. I send the start command and wait for 60ms afterwards I send a read data command and I read 0xEF 0x95 back, I am not sure what I am reading this doesn't make any sense. Kindly help me understand what am I doing wrong It is not just inaccurate instead it is completely wrong.

    PS:  With ADS114 we are also not using IDAC2 intentionally. We measure first between AIN1 and AIN2 and then between AIN2 and ANI3 and subtract both measurements to cancel the effect of lead. As we do not want to rely on the matching accuracy of the 2 current sources. Whereas 2 wire measurement is known to be a little inaccurate as it is measured only between AIN1 and AIN2.

    looking forward to your response

  • Hi Syed,

    The code value being returned is a negative value as the output is binary 2's complement. The result is showing as -4203 codes and at a gain of 1 this would be about 0.  Just a quick approximation the result would be around 500 Ohms as a negative value. Double check the voltage across the reference resistor and verify that the current is flowing across the resistor from AIN1 to AIN2.

    Best regards,

    Bob B

  • Hi Bob, thanks for your answer. I just REFP0 is connected to Rref at the side of the ground and REFN0 is connected to Rref from where the current enters. (Oposite to what is shown is page 52 of the data sheet). I guess this is causing the -ve Voltage and negative code. 

    Another problem is if I use the same configuration as described in my last message but use AIN1 and AIN3. I am seeing constant 0xFF 0x61 as the code, regardless of what RTD resistance I connect. If I set PSW to auto I just read 0x7F 0xFF constantly. Do you have any idea what is going on

  • Hi Syed,

    REFP needs to be connected to the most positive voltage relative to AVSS.

    I am very confused regarding your connections.  You said you were using a single IDAC in 2-wire mode using AIN0, AIN1 and AIN2.  It is not clear what is connected to AIN3.  Can you send me your schematic?

    Best regards,

    Bob B

  • So to clear the confusion.

    I will be measuring 2 wire and 3 wire RTDs.
    For the 2 Wire. I will be taking 1 measurement. That is between AIN1 and AIN3. With IDAC1 coming through AIN0.
    For the 3 Wire. I will be taking 2 measurements. i) between AIN1 and AIN2 ii) between AIN2 and AIN3. Afterwards subtracting the second from the first. To have accurate values.
    In both cases, I will be using only IDAC1 via AIN0.

    PS: the above-explained strategy (along with cold junction temperature compensation) has worked fine for us while using ADS114S. So I was hoping to do the measurements similarly with ADS1120.

  • Hi Syed,

    I'm not sure why you would want to turn on the PSW bit as this will turn on the internal connection to AVSS (GND).  This will mean the current will flow through the filter resistor to ground in parallel to the reference resistor.  This will lower the reference voltage considerably.  So there may be some misunderstanding on how AIN3 and the low-side switch work.

    As to the measurement in 2-wire mode from AIN2 to AIN3, when this is shorted you should see something close to 0.  The codes returned appear as a negative offset of about 97 codes.  You can determine the ADC offset by using the mux setting where AINP and AINN are connected to (AVDD-AVSS)/2.  Take several conversions and average, then subtract the code value from subsequent readings.

    The method you have stated for the intended measurement should work with the ADS1120.  Make sure that REP0 is not connected to GND.

    Best regards,

    Bob B

  • thanks for your tips. 

    One thing that I still don't get is why am I constantly seeing 0xFF 0x61 as data when I am taking the 2 Wire measurement between AIN1 and AIN3.

    PS: PSW is Open all the time.

  • Hi Syed,

    Initially you said that you were taking the measurement between AIN2 and AIN3.  I went back and read some of the later posts and I see that I missed that you later said AIN1 and AIN3.  Make sure that you are writing the correct register setting for AIN1 and AIN3 which would be bits 7:4 0100b and not 0101b for the mux settings.

    Best regards,

    Bob B

  • Hi Bob,

    Thanks for your tips regarding the hardware. After easter, I was able to correct my hardware. Unfortunately, the REFP0 and REFN0 were switched so I corrected them.

    Using 0x30 0x00 0x54 0x20. I was able to correctly measure the resistance between AIN1 and AIN2.. (similarly with different MUX config I read between AIN1 & AIN3 and AIN2 & AIN3).

    Now I am facing some problems in detecting short circuit (SC) and wire break (WB).

    I am trying to detect the SC and WB between AIN1 & AIN2

    WIRE BREAK :

    By using internal VREF and turning on burnout current source. I was able to detect WB between AIN1 and AIN2.

    Config : 0x31 0x81 0x14 0x20  and i measured 0x7F 0xFF. (correct for wire break)

    As you can notice in the config that excitation current was still enabled. If I disable that, then I read following

    Config : 0x31 0x81 0x10 0x00  and i measured 0x3D 0xC6 (wierd value)

    SHORT CIRCUIT :

    I was unable to detect a short circuit between AIN1 and AIN2 with any of the above-explained configs. (AIN2 and AIN3 were also shorted as required by my schematic)

    Config : 0x31 0x81 0x14 0x20  and i measured 0x0D 0x55.

    Disabling the excitation current, then I read following

    Config : 0x31 0x81 0x10 0x00  and i measured 0x07 0xCF

    Kindly help me in this regard how to correctly detect the sensor fault as in the datasheet on page 30 there isn't much written. And I am running out of ideas.

  • Hi Syed,

    Not long ago one of my colleagues put together an application note on RTD Wire-Break Detection that you may find helpful.  Take a look at the application note to see if it will help aid you with the process.  Let me know if you still have questions after reviewing the application note.

    Best regards,

    Bob B

  • thanks for the document I will take a look right away. Is anything available to assist me with the Short circuit detection? As with ADS114S we were using internal ref and burn out current to detect Short circuit as well. And right now I am unable to detect that

  • Hi Syed,

    The issue with using the BCS and checking for a sensor short is you will not see a '0' or near zero reading as the BCS will create a voltage drop across the input filter resistors.  

    In a normal operating configuration (IDAC on) and using the internal reference, you should see a near 0 reading if the input (wire) is shorted. The downside to this approach is if there is also a wire-break, the input may also appear as 0.  So here you would need to make sure that the external reference is valid first and there is no wire-breaks.

    Best regards,

    Bob B

  • Hi Bob, 

    thanks for the tips I was able to figure out a way to detect wire break and short circuit. Currently, I want to compensate for the internal temperature. I have enabled the Internal temperature sensor and I am reading 0x0A20 but I don't know what does this value means. Can you guide me on how to compensate it from my earlier read values?

  • Hi Syed,

    The conversion value of the temperature sensor is a 14-bit value left justified.  If you take the 0x0A20 value and right-shift by 2, you get 0x0288 which is decimal 648.  The coefficient is 1 code equals 0.03125 deg C or multiplying times 648 you get 20.25 deg C.

    Actually I'm not sure what you plan on doing with this value as from what I recall of the schematic you are making ratiometric measurements.  What do you plan on compensating using the internal temperature sensor?  It would be highly unlikely that you would need to compensate this way with a 16-bit device as the error would be small relative to the value of the LSB.

    If you are measuring a thermocouple (TC) as opposed to an RTD or thermistor then you would need to compensate for the cold-junction of the connection point of the TC.  The procedure is described in the ADS1120 datasheet in section 9.2.1 and additional information can be found in A Basic Guide to Thermocouple Measurements.  Here you would take the internal temperature reading and convert to the voltage value of the TC type you are using for the cold-junction voltage.  You would then add the TC voltage to the voltage calculated for the cold-junction and then convert that sum back to temperature.

    Best regards,

    Bob B

  • Hi Bob,

    Thanks again for yet another nice and descriptive answer. What I am trying to do is to try to achieve similar precision when measuring 3 wire Pt100 or Pt1000 as we had with ADS114S. With ADS114S we had observed a difference in ratiometric measurements (same RTD & Rref) at 25C -40C (-0.086%) and +60C(0.034%) . So depending on the values written in the electrical characteristics we had a compensation mechanism that requires us to calculate measure the ADC's temperature and depending on the temperature of ADC we had calculated that tiny resistance that is at the end added or subtracted from the main measured resistance.

    Does it sound doable in ADS112S or do you have any other idea for environmental temperature compensation?

  • Hi Syed,

    You can certainly use a similar concept with the ADS1120 as you are using for the ADS114S0x.  Keep in mind that with either device there may be variations from device to device.  Most often in these systems I've seen the predominant issue with gain error produced by temperature drift of the reference resistor.

    Best regards,

    Bob B

  • Hi, bob I want to close this thread with a thank you note. ADS1120S is working fine as of now. thanks for your overall support and quick replies. Your quality of support is indeed top-notch!