1

Hi I have to read temp and rh from 2 locations. so I bought 2 am2315 sensors which is i2c logiced temp rh sensor. I connected it as shown in the below diagram, and its working fine. I can read data from the sensor through code from here https://github.com/joaquincasanova/am2315

Now my Question is .. how to add 2nd sensor and read data from that sensor?

enter image description here

5 Answers 5

1

Normally you would connect both sensors directly to SDA and SCL. However, it looks like the am2315 uses a fixed address so that won't work. I suppose you could route SDA through a transistor or relay for each sensor to switch between them. (A GPIO pin would then select which sensor you want to read.)

1

here you have the datasheet: http://www.adafruit.com/datasheets/AM2315.pdf

on page 9 you can see that you cannot change the address of the device (0xB8) so in each I2C bus there can be only one device. Fortunatelly, you raspberry comes with TWO I2C buses. So you should be able to use both of hem and connect one sensor to each bus.

Here you have extra info on the second I2C:

http://raspberrypi.znix.com/hipidocs/topic_i2cbus_2.htm http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=33092

1

Here is a kickstarter for a breakout board for an I2C Mux that would allow you to connect 5 AM2315s to your computer. 4 on the Mux'ed I2C buses and 1 one the main I2C bus.

https://www.kickstarter.com/projects/sunair/really-useful-breakout-boards-for-raspberry-pi-ard

0

You could use a i2c hub to enable a single slave at a time

enter image description here

The RPi should be connected to SCL0/SDA0. The enable pins should be connected to GPIO pins

0

You could also put one of the humidity sensors on a "bit-banged" i2c. This means that you would use additional GPIO to control the second sensor. Here is a post that will lead you in the right direction:

http://www.raspberrypi.org/forums/viewtopic.php?t=40743

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.