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: Switching between input channels not possible?

Part Number: ADS1115

Dear all,

I spent many days learning how to use the ADS1115.

Today I tried to write an application (Lazarus - free pascal) which uses more than one input.

Please tell me, whether my algorithm/sequence is correct.

Hardware setting: 1Vdc at A0; 0.5Vdc at A2

* initialize ADS1115

* write 1100010110000011 to config-register

* switch to conversion-register

* read conversion-register

* switch to config-register

* write 1110010110000011

* switch to conversion-register

* read conversion-register

BUT: The values for A0 and A2 are nearly the same! (A2 should be half of A0)

The same behaviour writing a new gain to the config-register; the next value is nearly the same...

Please help!

Kind regards,

Dietmar

  • Hi Dietmar,

    You can use switch between channels and it looks like you are using single-shot mode which is recommended when switching channels. However, when you use single-shot mode, you need to account for an additional wait time of ~20-30us (Due to the device powering up). I wonder if the conversion register is not being updated due to a new conversion not happening. 

    Roughly how long is the wait time from writing to the config register to reading the conversion register? Can you pol Bit-15 of the config register when you are reading?

    Regards,

    Aaron Estrada

  • Hi Aaaron,

    thanks for your reply!

    I don't know exactly how to read the bit15 of config-reg while reading the conv.reg.

    But I tried the following:

    Immediately before and after reading the conv.-reg read 3x the config-reg with timestamp in microseconds.

    Please have a look at the logging data:

    Conf-reg: 1110010110000011, 438891us

    Conf-reg: 1110010110000011, 439990us

    Conf-reg: 1110010110000011, 440989us

    Value conversion-register (Input A0): 8008, 544887us

    Conf-reg: 1100010110000011, 546113us

    Conf-reg: 1100010110000011, 547269us

    Conf-reg: 1100010110000011, 548422us

    _____end sequence A0_____

    Conf-reg: 1100010110000011, 235638us

    Conf-reg: 1100010110000011, 236875us

    Conf-reg: 1100010110000011, 238026us

    Value conversion-register (Input A2): 8019, 341567us

    Conf-reg: 1110010110000011, 342776us

    Conf-reg: 1110010110000011, 343926us

    Conf-reg: 1110010110000011, 345141us

    _____end sequence A2_____

    Kind regards,

    Dietmar

  • Hi Dietmar,

    It looks like you are setting the channels correctly and reading the values for AIN2 even when AIN0 is being selected. Is it possible to add some delay (maybe around 150ms to be safe) between setting the configuration register and reading the conversion register? With the delay, I would like to see if you are seeing similar results in the conversion register. 

    Regards,

    Aaron Estrada

  • Hi Aaron,

    I have built in a delay of 200ms between writing the config register and reading the conversion register, but unfortunately there is no change in the behavior of the ADS1115: It still seems as if the ADS1115 cannot be switched to A2 and when reading the conversion register has an almost identical value after the supposed switch to a2, as when reading the a0.

  • Hi Dietmar,

    As a sanity check, have you verified that the voltage levels at the device inputs are correct? Can you also provide a schematic if available?

    When switching channels using single shot mode you need to: 

    1. Configure the config register to start a conversion, set the data rate and use the correct mux settings to read the desired channel. 

    2. Wait the data period (1/128 in your case) + %10 of the data period + 20us. This is the time it takes to make a conversion with 10% to account for variation in the internal clock and an extra 20us to wake up the device after the last conversion. However, it seems like you are adding plenty of wait time in your case. 

    3. Read the conversion register. 

    4. Repeat from step 1 on the new channel. 

    Regards,

    Aaron Estrada