jscax
Posts: 8
Joined: Thu Oct 05, 2017 9:19 am

Multiple I2C sensors Pi Zero

Fri Oct 06, 2017 10:06 am

Hi all,
I'm not a beginner I'm a complete newbie.

So let's say I want to connect 3-4 I2C sensors to Pi Zero, do I need any expansion? My guess is: yes.

https://www.aliexpress.com/item/PCF8574 ... 63874.html
Is this something that makes sense?

PCF8574 vs MCP23017?

thank you very much

QMESAR
Posts: 55
Joined: Wed Sep 06, 2017 10:41 am

Re: Multiple I2C sensors Pi Zero

Fri Oct 06, 2017 3:07 pm

Hi.

I2C communication is an address based communication protocol
Basics -
You have 1 I2C bus with multiple sensors on the same bus each sensor having an unique address to communicate to it.

Pit fall some sensor alow for only 2 address so make sure the sensor you want to use can be configured for a number of addresses or at least to the same amount as sensor you are using

I do not thing you need the IO expansion board which you showed by the link

jscax
Posts: 8
Joined: Thu Oct 05, 2017 9:19 am

Re: Multiple I2C sensors Pi Zero

Fri Oct 06, 2017 3:47 pm

Ok so:
I2C is a bus where I can address multiple devices. Great.

How does it work when it comes to the wiring scheme? How will this work without the expansion?

I connect the first I2C sensor to the GPIO then I can cascade another sensor connecting it at the pins of the first I2C sensor, correct?

thank you

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Multiple I2C sensors Pi Zero

Fri Oct 06, 2017 5:11 pm

jscax wrote:
Fri Oct 06, 2017 3:47 pm
I connect the first I2C sensor to the GPIO then I can cascade another sensor connecting it at the pins of the first I2C sensor, correct?
No, you don't cascade them. Every device is connected to power, SDA and SCL on the Pi.
Of course you could do this by using one cable each for SDA and SC and connect all the devices to these two, but that's not what I call cascading.
The most important thing with I2V is that each device has it's own, unique address. On many, but not all devices you can change the address to avoid duplicates.

QMESAR
Posts: 55
Joined: Wed Sep 06, 2017 10:41 am

Re: Multiple I2C sensors Pi Zero

Fri Oct 06, 2017 5:36 pm

jscax wrote:
Fri Oct 06, 2017 3:47 pm
How does it work when it comes to the wiring scheme? How will this work without the expansion?
Ask Dr Google and you will see many pictures how to this :D

alphanumeric
Posts: 2547
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Multiple I2C sensors Pi Zero

Fri Oct 06, 2017 7:39 pm

I have several sensor boards/devices connected to my I2C bus, DS1307, BMP180, SI1145, Sense Hat. They are all wired in parallel. They each have unique addresses so no conflicts. I used a Proto Hat and some 90 degree headers. https://www.adafruit.com/product/2310 I just daisy chained the headers together on the Proto Hat. Then used jumper wires to connect to the sensor break out boards.
Pictures here, https://1drv.ms/f/s!AjOYwiwlwDtpgq8_0VrdS3_H5xL_AA

Return to “Beginners”