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.

ADS1015 MUX switching

Other Parts Discussed in Thread: ADS1015

Hi!

I'm using ADS1015 to measure 4 voltages, all of the lines are single ended. Supply for ADS1015 is +3.3V. All input signals (AIN0,...AIN4) should be in allowed range.

My problem is that I can't switch MUX through I2C to be in single-ended mode. Default is differential measurement. When I send command to switch MUX to single-ended measurement (for example input AIN2) i get simmilar value in config register, but in differential mode (sending [2:0]MUX: 110, but then I read from the register 010, same for all other inputs, AIN1: 101, but then I read 001 value from config register).

Why does it always switch to differential measurment? Is there a sequence of commands needed to be perfomed before switching to single-ended measurement?

Thanks

  • Hi,

    If you could provide an oscilloscope shot while  probing the SDA and SCL pins showing the complete I2C transaction when writting the configuration register and another oscilloscope plot while reading the configuration register. 

    If you have an schematic showing the device configuration and address pin  the  this may be helpful also.  If a code snippet is available; we could review it also.

    Thank you and Best Regards,

    Luis

  • Thanks for reply.

    About oscilloscope - it would be quite hard for me to provide oscilloscope plot at the moment. I was checking this I2C interface earlier with oscilloscope, while communicating with other devices and every thing  was ok. I'm sending quite large number of data through I2C and it goes without any errors (not to ADS1015).

    Also, writing to registers in ADS1015 -> for example writing to Lo_thresh or Hi_thresh is ok. I can read the values back - they're the same (except if you got in Lo_thresh 0000 on [3:0] bits, I can change it by writing, but maybe it is ok ;) ). Also, reading default values from registers is ok (same as in datasheet).

    About schematic:

    Supply Vdd -> +3.3V, Alert/RDY - not connected, ADDR pin is connected to 1.

    About voltage inputs:

    several DC voltages, +3.3, +5, +12V, -5V -> they are connected through resistor voltage divider, so the voltage, which is read by ADS1015 should be in accepted range - but I'm not sure if there are actualy ok -> could some kind of overvoltage change the mux?

    I think thats all about device configuration.

    About the code -> mostly I wanted to change the mux to single-ended measurement and start single measurement. I was writing data to config register:

    0x5183 (PGA 2/3 to be sure that voltages are in range) -> here when I read register I get 0x9183 (cleared "1" in MUX section)

    and after that:

    0xD183

    Thats all. I can read the conversion register and the data is updated, so rest of commands probably execute ok.

    Does this switching could be done by input voltages (overranged etc)?

    Thanks and Best Regards

  • Hi,

    The input voltage should not exceed the VDD supply.  If a resistive voltage divider is in place to attenuate the input voltage to less than 3.3V (or VDD); this should work fine.  The absolute maximum ratings voltages are shown in page 2; provided that these voltages are not exceeded the device will work without issues...  

    When writting the config register; you will need to ensure to write the correct point register value to the configuration register.  Please follow the sequence as shown on page 11 of the datasheet:

    First Byte:  0b10010010 => I2C 7 bit Address follow by a low read/write bit (assuming address pin connected to VDD)

    Second Byte: 0b00000001 => pointer register to access the config register

    Third Byte => 0b01010001  => Change to the desired MSB configuration settings (in this example AINP=> AIN1; AINN =>GND; +/-6.144V)

    Forth byte =>  0b10000011 => Change to Desired LSB configuration settings

    Please let me know if this works for you.  If you are able to get the oscilloscope plots; we will also happy to review them.

    Best Regards,

    Luis

     

  • Hi!

    I programmed the chip with commands you written in post.

    And it looks like it's working! :D

    After sending those commands, I read the configuration register and got 0xD183, so the mux haven't changed :)

    I don't know why it wasn't working earlier :)

    Thanks for help!

    Best regards

  • One more question about reading measured data.

    For example I'm getting 0x2AC0. So to know what is the voltage I'm calculating:

    FS/2^11 * 0x2AC?

    where FS = 6.144V in settings you sended?

  • Hi,

    That is correct.  When using the full-scale of +/-6.144V:

    6.144V / (2^11) * 0x2AC = 6.144V / (2048) * 684 = 2.052V

    Best Regards,

    Luis

  • Thanks for answer :)

    Best Regards

  • No, thank you for the answer. I have exactly the same question.

  • Hello,

    Answering you question about voltage calculation (as far as I remeber/ checked it):

    Measurement is 12 bit, after getting data from I2C ADC (per  8bits packets), first 8 bit data is MSB packet, second packet is LSB.

    Then, I shift values by 4 to the right (>> 4) - let's call this value as MEAS_VAL.

    Since the reference voltage of ADC chip is 4.096V, I'm calculating measurement resolution:

    4.096 / 2^11 = 0.002 volt/bit

    so to get the measurement voltage value I'm doing:

    0.002 * MEAS_VAL

    And thats all :)

    This should work for both positive and negative voltage values (I think I tested it on both cases).

    Hope this helps :)

    Best regards,

    Peef