Qwiic_PT100 ADS122C04

Hello, I would like to use this board for two differential connections Vin and GND for a very sensitive Photodiode. I was unsure which inputs to use. I believe A0 is 3.3V and A1 is ground for device one and A2 is 3.3V with A3 being ground. I was unsure looking at the schematic.

https://www.sparkfun.com/products/17059 You can find a quick hookup note on this product page

Does anyone have experience using more than one of these? I attempted to initialize each one and then read the raw voltage but I am getting an identical value for each of the sensors.

SFE_ADS122C04 mySensor;

void setup() {
  Serial.begin(115200);
  while (!Serial)
    ; //Wait for user to open terminal
  Serial.println(F("ADC TEST"));

  
  Wire.begin();

  if (mySensor.begin(0x45, Wire) == false) // U1 Address 0x45 
  {
    Serial.println(F("Device not detected at I2C address. Please check wiring and Reset"));
    while (1)
      ;
  }

  mySensor.configureADCmode(ADS122C04_RAW_MODE); // Configure the PT100 for raw mode


  if (mySensor.begin(0x41, Wire) == false) // U2 Address 0x41
  {
    Serial.println(F("Device not detected at I2C address. Please check wiring and Reset"));
    while (1)
      ;
  }

  mySensor.configureADCmode(ADS122C04_RAW_MODE); // Configure the PT100 for raw mode

  if (mySensor.begin(0x40, Wire) == false) // U3 Address 0x40
  {
    Serial.println(F("Device not detected at I2C address. Please check wiring and Reset"));
    while (1)
      ;
  }

  mySensor.configureADCmode(ADS122C04_RAW_MODE); // Configure the PT100 for raw mode
  
}

void loop() {

///////////////////////////////////   Sensor U1     ////////////////////////////////////////////////
  
  mySensor.begin(0x45, Wire);
  buttonState = digitalRead(buttonPin); 
  // Get the raw voltage as int32_t
  int32_t raw_v = mySensor.readRawVoltage();

  // Convert to Volts (method 1)
  voltsA = ((float)raw_v) * 244.14e-9;

  // Convert to Volts (method 2)
  voltsB = ((float)raw_v) / 4096000;
  
  volts_1 = voltsA * -1;
  volts_2 = voltsB * -1;
  //mySensor.endTransmission();

  
///////////////////////////////////   Sensor U2     ////////////////////////////////////////////////
  
  mySensor.begin(0x41, Wire);
  buttonState = digitalRead(buttonPin); 
  // Get the raw voltage as int32_t
  int32_t raw_v = mySensor.readRawVoltage();

  // Convert to Volts (method 1)
  voltsA = ((float)raw_v) * 244.14e-9;

  // Convert to Volts (method 2)
  voltsB = ((float)raw_v) / 4096000;
  
  volts_3 = voltsA * -1;
  volts_4 = voltsB * -1;
  //mySensor.endTransmission();

  
///////////////////////////////////    Sensor U3    /////////////////////////////////////
  
  mySensor.begin(0x40, Wire);
  buttonState = digitalRead(buttonPin); 
  // Get the raw voltage as int32_t
  raw_v = mySensor.readRawVoltage();

  // Convert to Volts (method 1)
  voltsC = ((float)raw_v) * 244.14e-9;

  // Convert to Volts (method 2)
  voltsD = ((float)raw_v) / 4096000;
  
  volts_5 = voltsA * -1;
  volts_6 = voltsB * -1;
  //mySensor.endTransmission();

  Serial.print(F("The raw voltage is 0x"));
  Serial.print(raw_v, HEX);
  Serial.print(F("\t"));
  Serial.print(volts_1, 7); // Print the voltage with 7 decimal places
  Serial.println(F("V"));
  Serial.print(volts_3, 7); // Print the voltage with 7 decimal places
  Serial.println(F("V"));
  Serial.print(volts_6, 7); // Print the voltage with 7 decimal places
  Serial.println(F("V"));
  
  delay(250); //Don't pound the I2C bus too hard

Hi BBBeck,

You will need to create a separate mySensor for each sensor. Please try:

SFE_ADS122C04 mySensor1;

SFE_ADS122C04 mySensor2;

SFE_ADS122C04 mySensor3;

if (mySensor1.begin(0x45) == false)

if (mySensor2.begin(0x41) == false)

if (mySensor3.begin(0x40) == false)

int32_t raw_v_1 = mySensor1.readRawVoltage();

int32_t raw_v_2 = mySensor2.readRawVoltage();

int32_t raw_v_3 = mySensor3.readRawVoltage();

You can delete the three extra mySensor.begin(0xnn); from your main loop. Those are redundant.

Best wishes,

Paul

Thank you so much! That worked perfectly. The issue I am now having is that I am trying to change AIN0 and AIN1 to AIN2 and AIN3 to read the other differential pair but I am not getting a reading for the second inputs

void setup() {
  /////////////////////////////////////////      Sensor U2     /////////////////////////////////////////////////////////

  if (mySensor2.begin(0x41, Wire) == false) 
  {
    Serial.println(F("Device not detected at I2C address. Please check wiring and Reset"));
    while (1)
      ;
  }

  //mySensor2.setInputMultiplexer(ADS122C04_MUX_AIN1_AIN0);      // Route AIN1 and AIN0 to AINP and AINN
  mySensor2.setGain(ADS122C04_GAIN_1);                         // Set the gain to 1
  mySensor2.enablePGA(ADS122C04_PGA_DISABLED);                 // Disable the Programmable Gain Amplifier
  mySensor2.setDataRate(ADS122C04_DATA_RATE_20SPS);            // Set the data rate (samples per second) to 20
  mySensor2.setOperatingMode(ADS122C04_OP_MODE_NORMAL);        // Disable turbo mode
  mySensor2.setConversionMode(ADS122C04_CONVERSION_MODE_SINGLE_SHOT); // Use single shot mode
  mySensor2.setVoltageReference(ADS122C04_VREF_EXT_REF_PINS);  // Use external 5V reference
  mySensor2.enableInternalTempSensor(ADS122C04_TEMP_SENSOR_OFF); // Disable the temperature sensor
  mySensor2.setDataCounter(ADS122C04_DCNT_DISABLE);            // Disable the data counter (Note: the library does not currently support the data count)
  mySensor2.setDataIntegrityCheck(ADS122C04_CRC_DISABLED);     // Disable CRC checking (Note: the library does not currently support data integrity checking)
  mySensor2.setBurnOutCurrent(ADS122C04_BURN_OUT_CURRENT_OFF); // Disable the burn-out current
  mySensor2.setIDACcurrent(ADS122C04_IDAC_CURRENT_OFF);        // Disable the IDAC current
  mySensor2.setIDAC1mux(ADS122C04_IDAC1_DISABLED);             // Disable IDAC1
  mySensor2.setIDAC2mux(ADS122C04_IDAC2_DISABLED);             // Disable IDAC2

}

void loop() {

  mySensor2.setInputMultiplexer(ADS122C04_MUX_AIN0_AIN1);      // Set U2 MUX AIN2 and AIN3 to AINP and AINN  
  // Get the raw voltage as int32_t
  int32_t raw_v_2 = mySensor2.readRawVoltage();

/////// Change MUX settings to read from AI2 and AIN3
  mySensor2.setInputMultiplexer(ADS122C04_MUX_AIN2_AIN3);      // Set U2 MUX AIN2 and AIN3 to AINP and AINN  
  
  int32_t raw_v_5 = mySensor2.readRawVoltage();

  // Convert to Volts using 5V external reference
  volts2 = ((float)raw_v_2) * 596.05e-9;  ///for U2 ALT MUX

  // Convert to Volts
  volts5 = ((float)raw_v_5) * 596.05e-9;  ///for U1 ALT MUX

Hi BBBeck,

Can you upload a sketch of your circuit?

It is not clear to me how you have connected your signals to AIN2 and AIN3. Are you using the Qwiic PT100 board - and are you using one half of the B split pad to connect to AIN2?

Are you powering the board from 3.3V or 5V?

Best wishes,

Paul

I removed Jumper A and B and soldered wire to the pad. The signal to AIN2 and GND to AIN3 . I am using 5V, my only known issue is not being able to switch between reading the Analog Inputs. When I used debug mode as shown in the Sparkfun Library it jumps between the input mux modes instead of staying on one then switching.

Odd output.PNG

Hi BBBeck,

I think I see your problem…

readRawVoltage calls configureADCmode(ADS122C04_RAW_MODE)

https://github.com/sparkfun/SparkFun_AD … y.cpp#L385

which will set the mux back to AIN1/AIN0

https://github.com/sparkfun/SparkFun_AD … y.cpp#L204

You will need to call readADC instead and do your own data conversion to convert back to voltage… Please see Example9 for more details:

https://github.com/sparkfun/SparkFun_AD … Config.ino

Best wishes,

Paul

Paul you are amazing! Thank you so much for taking the time to help me out!