5

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.

codingCat
  • 2,396
  • 4
  • 21
  • 27
  • This site's for programming questions. Wiring up a Pi is definitely off topic. – Marc B Jul 16 '13 at 21:18
  • Fair enough. I could argue this this is programming at the hardware level... but I concede the point; This question is a little deep for the RPi site and I was hoping to attract the attention of some experienced eyes. Do you have a suggestion for a hardware equivalent to Stackoverflow? – codingCat Jul 16 '13 at 21:48
  • To answer my own questions, StackExcange now has its own hardware / electronics site up and running: http://electronics.stackexchange.com/ – codingCat Jul 11 '15 at 22:28

2 Answers2

7

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.

Craig
  • 4,750
  • 22
  • 21
  • 1
    Thank you. Hardware info seems to come in two varieties. Sixty page tech specs that assume full knowledge and explain nothing, or one page examples that assume no knowledge and explain nothing. Either way unless the example is exactly what you want you are out of luck. Your answer lets me know that at I won't be blowing up my Pi or sensors by wiring them together. This gives me the confidence to experiment a little. Now, lets see if my luck holds out, and they use different addresses. Anyone else wish to weigh in with some more details? – codingCat Jul 17 '13 at 03:27
  • 1
    Check the bildr links on the Sparkfun product pages I think they have the I2C addresses in the text and/or code examples. – Craig Jul 17 '13 at 15:42
  • The wiring is complete. TMP102 in at address 44, bmp085 in at address 77. Now the easy part: Coding to read the data. :-) – codingCat Jul 18 '13 at 05:28
  • "you should be able to connect both devices to the same SDA and SDL pins" - but how do you physically do that? I'm using female-to-female jumper cables and this obviously uses the full pin. – Claudio Kuenzler Jun 19 '19 at 13:08
2

Yes, more than one sensor may be connected to the i2c bus as long as there is no address conflict. One caveat: a number of sensors on small boards (break-out 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 multitude of pull up resistors will become a problem. One is required, two is definitely OK, but I don't know how many you can add after that. It will be necessary to remove them from the breakout boards.

BreezyKen
  • 21
  • 2