LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using PCA9548A multiplexer with NI8451 I2C interface device to control multiple sensors

Hi, 

as stated in the subject I have a PCA9548 multiplexer, I am trying to control multiple HTU21D Humidity and temperature sensors, but for now I am just trying to read from 1 channel, 1 temperature reading to figure out how it works.  

Here is the setup for this project : 

alicei_0-1723562009186.png

The part that I have been unsure of is how do I go from telling the device I want to use the address of 70 for the multiplexer and then from there tell the program that within the multiplexer I need to go into X channel and look for X adress

 

Here is what I have so far, but I get an error at the write function saying : "NI-845x: The slave did not acknowledge an address+direction byte transmitted by the I2C master..." 

 

alicei_2-1723563670976.png

 

This is a working example for just reading 1 sensor when directly connected to the NI8451 which works ( I simplified it to just read once for simplicity's sake ) 

alicei_3-1723563799266.png

 

 

Thank you for any help or suggestions I can get on this !!! 

 

0 Kudos
Message 1 of 2
(259 Views)

Since all your sensors connected to the MUX are the same address, you need to ensure you configure the MUX (switch actually) to connect to only one channel when you read the sensor.

 

The order of execution should look as follows,

  1. Write to MUX to select only CH0 (write 0x01 to addr 0x70)
  2. Read temperature from HTU21D
  3. Write to MUX to select only CH1 (write 0x02 to addr 0x70)
  4. Read temperature from HTU21D
  5. ... so on for the rest of the channels

 

Here is a simple code to configure the PCA9548 to connect N channels

santo_13_0-1723769067820.png

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 2
(200 Views)