Home        Store        Learn        Blog

Multiple sensors via two I2C MUXes

Hi
I have an Arduino mega with a Qwiic Shield (SparkFun Qwiic Shield for Arduino - DEV-14352 - SparkFun Electronics) to that I connect two Qwiic MUXes (SparkFun Qwiic Mux Breakout - 8 Channel (TCA9548A) - BOB-16784 - SparkFun Electronics). To oneof the MUXes I connect 3 Bar30 and 3 Celsius Temp sensors, to the other 3 and 2. I resoldered the sensor wires to Qwiic connectors in order to connect them to the MUXes.
The temp sensors function fine but all the pressure sensors, except the “last one in line” - the last one sampled by the sketch, output garbage readings. If I add the “init” function in the void loop before the “read” the sensors readings are fine.
The init function takes some time to run, so that’s not great. In addition this seems like it might be trouble up the road.
Any thoughts?
Thanks

Could you post a copy of your sketch? I take it the sketch compiles correctly with the Arduino IDE and uploads to the mega? Some sensors, especially temp require a slight delay 0.5-1sec just to balance out/calibrate, Can you test each of the sensors individually just to eliminate a bad connection/solder joint?
I have basic knowledge of Arduino but if your sketch is uploaded I’m sure someone with more programming knowledge than me will take a look and help you out,

Hi Craig
Attaching the sketch, it’s only a part of the whole project but this is what I used to test out the sensors setup and it remains pretty much the same when integrated into the whole. MUX_Sensors_Pub.txt (13.3 KB)
Yes, I tried every sensor by itself through the MUX, works fine. The problem surfaces when there’s several and it seems it’s due to the pressure sensors, not the temp.

Thanks