Multiple Sensors on Raspberry Pi GPIO

I am working on a sensor package for my PI. I already added a Sparkfun TMP102 temperature sensor. On the GPIO, it is powered by pin 1, grounded on pin 6, with pins 3 and 5 processing serial data. I wrote a python script to read data and everything works fine.

My problem is that now I want to add a second sensor to the GPIO, the BMP085 pressure sensor is also on the breakout board from Sparkfun. Which wiring examples I found show that it should connect to the same GPIO pins as the TMP102. They should be registered as serial devices, but I'm not sure how to connect everything together.

I am a programmer at heart, so connecting electronics makes me nervous. :-)

Any suggestions would be greatly appreciated.

Thanks.

+4
source share
2 answers

If your sensors use I2C, and it looks like TMP102 and BMP085, you're in luck.

I2C is designed for the simultaneous use of multiple devices with the same two-wire interface. Each device must have a separate address, so you need to make sure that your devices do not conflict. You will need to read the data or other documentation for your sensors to find out how to set the address.

After you configure the address for each sensor, you can connect both devices to the same SDA and SDL pins.

+5
source

Yes, more than one sensor can be connected to the i2c bus until an address conflict occurs. One caveat: several sensors on small boards (circuit boards) have pull-up resistors on the SDA and SLC lines. Since it is theoretically possible to add up to 128 sensors on this bus, a lot of problematic resistors will become a problem. One of them is required, two is normal, but I do not know how much you can add after that. It will be necessary to remove them from breakouts.

+1
source

Source: https://habr.com/ru/post/1491728/


All Articles