Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Sensors on Raspberry Pi GPIO

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

My problem is that I now want to add a second sensor to the GPIO, the BMP085 pressure sensor also on a breakout board from Sparkfun. What wiring examples I have found suggest that it needs to hook into the same GPIO pins as the TMP102. They should both register as serial devices, but I am unsure how to wire everything together.

I'm a programmer at heart, so hooking up electronics makes a nervous. :-)

Any suggestions will be greatly appreciated.

Thanks.

like image 909
codingCat Avatar asked Feb 15 '23 21:02

codingCat


1 Answers

If your sensors use I2C and it looks like the TMP102 and the BMP085 do, you are in luck.

I2C is designed to have multiple devices sharing the same 2 wire interface. Each device must have a distinct address though so you need to make sure your devices don't conflict. You will have to read the datasheets or other documentation for your sensors to find out how to set the address.

Once you configure the address for each sensor you should be able to connect both devices to the same SDA and SDL pins.

like image 134
Craig Avatar answered Feb 27 '23 12:02

Craig