0
\$\begingroup\$

I am using a Raspberry Pi Zero 2 to talk through a TCA9548A to multiple ADS1015, each ADS1015 is on a separate SDA/SCL channel of the TCA9548A. I am able to scan all channels and see the active addresses (0x48) on channel 0 of the TCA9548A and channel 1 of the TCA9548A. However I am not sure how to write the python code to select the analog input 0 on the channel 0 ADS1015 and then read the conversion. And then change to channel 1 of the TCA9548A and select/read analog input 2 of the ADS1015 on that channel.

Basically I am confused with how to select the TCA9548A channel to write the ADS1015 configuration bytes and then read the conversion bytes out. Maybe its not supposed to be done this way since I am multiplexing I2C channels?

It seems like I am trying to write/read to address 0x70 and 0x48 at the same time?

Edit 1: when I run the example code that scans channels on the TCA9548A I can see the 2 ADS1015's on channel 0 and channel 1. enter image description here

however I am not able to call the module correctly to read the value on channel 0 of the ADS1015 that is on the channel 0 of the TCA9548A. enter image description here

sorry I am new to python and the adafruit example codes are just not clicking with me.

Edit 2: saw that I was using wrong module and updated to try and use AnalogIn and now am getting a blank screen: enter image description here

\$\endgroup\$

2 Answers 2

0
\$\begingroup\$

No, not the same time.

First select which TCA9548 channel you want, i.e. which ADC chip you want to communicate with.

Then communicate with that chip as it was the only chip on the bus.

Then switch to next chip and communicate with it.

\$\endgroup\$
1
  • \$\begingroup\$ I can establish connection ad see ads1015's connected on channel 0 and 1 of the TCA9548A but can't seem to communicate with them appropriately \$\endgroup\$
    – user298907
    Jun 5, 2023 at 13:30
0
\$\begingroup\$

This is exactly how its supposed to be done. In pseudocode, you want to:

i2cBegin(0x70); //to begin i2c communication with the multiplexer

i2cWrite(0x00); //to open channel 0

i2cBegin(0x48); //to begin i2c communication with the ADC

i2cWrite(.....); //whatever writes/reads you want to do with ADC1

i2cEnd(); // to end i2c comm with the ADC

i2cWrite(0x01); //to close channel 0 and open channel 1

and so on and so forth.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ In pseudocode yes, but not really. The mux allows to select buses by a bit mask, not by a number. So any number with more than one bit on will select more than one bus. And the sequence does not need to be that tight with restarts. The mux can be separately communicated with start, address, data, and stop, so it allows to use the ADCs with no modifications to the ADC code, it doesn't need to know and care about the mux. \$\endgroup\$
    – Justme
    Jun 3, 2023 at 4:23
  • \$\begingroup\$ I can establish connection ad see ads1015's connected on channel 0 and 1 of the TCA9548A but can't seem to communicate with them appropriately \$\endgroup\$
    – user298907
    Jun 5, 2023 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.