emceefall
Posts: 1
Joined: Thu Mar 22, 2018 9:43 pm

Multiple I2C Sensors with Same address (no peripherals/multiplexer)

Thu Mar 22, 2018 9:53 pm

I have several pressure sensors that I would like to connect to one raspberry pi. They have fixed addresses, all 0x28. I know a multiplexer is a solution but for my needs I may have a solution that will not need a multiplexer. I the frequency of the pressure sensors is high and the frequency that I need data is comparatively low so I had the idea to power the sensors from GPIO pins that I turn on and off depending on which sensor I would like to take a reading from. Both sensors are connected to the same I2C SDA and SCL pins but from my understanding, only one sensor should be sending data at a time if I only have one receiving power from a GPIO pin at a time.

Unfortunately when I attempt this the show I2C command shows that there are devices at all I2C addresses. I can still take data but it reads as 1.24 PSI (the range of the sensor is (-1.24,1.24). If I disconnect a sensor and try to run just a single sensor after this it still reads 1.24 and that there are devices connected to all I2C addresses. It only goes away if I restart the PI.

Any help is appreciated.

The sensor I am using is:
https://www.mouser.com/productdetail/ho ... iChIAqk%3D

Here is the datasheet:
http://www.mouser.com/ds/2/187/honeywel ... 708740.pdf

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Multiple I2C Sensors with Same address (no peripherals/multiplexer)

Mon Mar 26, 2018 5:18 pm

You have to order the correct pressure sensors. There are a 6 different addresses available depending on what you order.

See page 13 of the datasheet and look at the output type. You can order devices with the following addresses - 0x28, 0x38, 0x48, 0x58, 0x68, and 0x78

There is no cheating on something like this. Thee reason is that there is no CE line. If you had a CE line, then you could do what you want.

The upshot to all this is:
You either have different addresses or use a i2c multiplexer. With a multiplexer you can have up to nx8 devices connected to a single i2c bus, where n= the number of different device addresses. Since there are two i2c buses, that also means you can have twice as many devices.

I understand that at $26 each, the buying new sensors is out of the question. Having said that, your cheapest and easiest solution is no buy a $5.00 multiplexer.
Last edited by Richard-TX on Mon Mar 26, 2018 5:26 pm, edited 1 time in total.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

User avatar
joan
Posts: 14069
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Multiple I2C Sensors with Same address (no peripherals/multiplexer)

Mon Mar 26, 2018 5:23 pm

If you have spare GPIO you can add software I2C buses. You need two spare GPIO per bus and a resistor pull-up on each GPIO.

You can find the needed software details in /boot/overlays/README.

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Multiple I2C Sensors with Same address (no peripherals/multiplexer)

Mon Mar 26, 2018 5:28 pm

Adding more i2c buses is yet another option as Joan said.

Enjoy!
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

Return to “Interfacing (DSI, CSI, I2C, etc.)”