Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

TCA9548A Multiplexer with Python and non-adafruit sensors
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

TCA9548A Multiplexer with Python and non-adafruit sensors

by CaptainPivo on Wed Mar 25, 2020 5:42 pm

Hi, I'm currently experiencing a few issues with implementing the tca9548a multiplexer with two bluerobotics celsius fast-response temperature sensors.

I've been able to detect both sensors by switching channels and even get a reading from each one. The problem is I can only grab the temperature reading one time from each sensor before I get an error. ( I should add that when I run one sensor through the mux there is no problems gathering the data continuously, it is when I start switching between the channels)

The code I have is:
https://github.com/PeterBrichta/Data-Ac ... pSensor.py

And the error I'm getting is:
bluerobotics error2.jpg
bluerobotics error2.jpg (744.78 KiB) Viewed 53 times


From what I've gathered is after the first loop an i2c device is no longer detected on the bus. I'm not sure if it's a problem with the code I've written or the multiplexer possibley?
Any help is greatly appreciated, thank you!

CaptainPivo
 
Posts: 5
Joined: Wed Mar 25, 2020 5:27 pm

Re: TCA9548A Multiplexer with Python and non-adafruit sensor

by adafruit_support_carter on Thu Mar 26, 2020 1:58 pm

Let Blinka take care of the underlying I2C bus setup, so no need to import smbus. And then see the example here:
https://github.com/adafruit/Adafruit_Ci ... pletest.py
for how to pass in the TCA channel instead of the I2C bus to your sensors. The driver will take care of the mux channel switching under the hood.

adafruit_support_carter
 
Posts: 14872
Joined: Tue Nov 29, 2016 2:45 pm

Re: TCA9548A Multiplexer with Python and non-adafruit sensor

by CaptainPivo on Fri Mar 27, 2020 12:34 pm

Hi I appreciate the reply!

I've tried implementing this code just to see if I can even get a single sensor running:

https://github.com/PeterBrichta/Data-Ac ... ltiTemp.py

I believe it correctly combines the example you posted with the TSYS01 sensor example https://github.com/bluerobotics/tsys01- ... example.py

But I'm receiving the following error (had to crop):
bluerobotics error v1.jpg
bluerobotics error v1.jpg (930.4 KiB) Viewed 33 times

bluerobotics error v2.jpg
bluerobotics error v2.jpg (845.96 KiB) Viewed 33 times


The code I originally posted did somewhat work for me and was based off a tutorial another adafruit employee posted viewtopic.php?f=19&t=138544

Hope I provided enough information to explain my issue, thanks again for the help!

CaptainPivo
 
Posts: 5
Joined: Wed Mar 25, 2020 5:27 pm

Re: TCA9548A Multiplexer with Python and non-adafruit sensor

by adafruit_support_carter on Fri Mar 27, 2020 12:42 pm

It has something to do with tsys01.py. Where is the code for that?

adafruit_support_carter
 
Posts: 14872
Joined: Tue Nov 29, 2016 2:45 pm

Re: TCA9548A Multiplexer with Python and non-adafruit sensor

by CaptainPivo on Fri Mar 27, 2020 12:50 pm

Here is the github for tsys01:
https://github.com/bluerobotics/tsys01-python

And here is the example I used as a guide:
https://github.com/bluerobotics/tsys01- ... example.py

Hopefully that's what you were asking for.

CaptainPivo
 
Posts: 5
Joined: Wed Mar 25, 2020 5:27 pm

Re: TCA9548A Multiplexer with Python and non-adafruit sensor

by CaptainPivo on Fri Mar 27, 2020 12:55 pm


CaptainPivo
 
Posts: 5
Joined: Wed Mar 25, 2020 5:27 pm

Re: TCA9548A Multiplexer with Python and non-adafruit sensor

by adafruit_support_carter on Fri Mar 27, 2020 12:59 pm

That code is expecting an I2C bus number, not an actual I2C bus. So it probably won't be usable with our TCA library as is.

adafruit_support_carter
 
Posts: 14872
Joined: Tue Nov 29, 2016 2:45 pm

Re: TCA9548A Multiplexer with Python and non-adafruit sensor

by CaptainPivo on Fri Mar 27, 2020 1:34 pm

Is there a fix to this issue? Or am I better off creating multiple buses like this example and scratching the use of the tca9548a?
https://www.instructables.com/id/Raspbe ... c-Devices/

Fairly new to all this so I appreciate any direction to solving this issue.

CaptainPivo
 
Posts: 5
Joined: Wed Mar 25, 2020 5:27 pm

Please be positive and constructive with your questions and comments.