I connected Raspberry Pi 3 to an Arduino Uno through I2C. The Arduino Uno uses the I2C as slave.

When I connect AM2320 sensor (temperature and humidity) to the Arduino Uno, I am getting the response that the sensor is offline.

I tested the sensor on Raspberry Pi 3 and it is working fine. On the Raspberry Pi the address is 0x5c. On most libraries, the address is 0xb8. I have the same result when I tried these 2 addresses.

Do I have problem because Arduino Uno is working as slave?

  • Two comments and a request. C1) rPI is powered at 3.3V, while the arduino uno is powered at 5V. What pullup voltage are you using on the I2C lines? Remember that 5V is too much for the rPI, and 3.3V should be not enough for the arduino.... C2) 0x5C and 0xB8 are essentially the same address. I2C have 7bit addresses, while the last bit of the first byte is the read/write one. So the proper address is, in binary, 1011100 (saved as 101 1100, or 0x5C), but arduino saves it with the R/W bit too (1011 1000, or 0xB8, for more easiness). R1) remember to choose an answer if it answers your question
    – frarugi87
    Sep 25, 2017 at 15:56

3 Answers 3


You can do it. A single device like the Arduino can be both a slave and a master.

It's explained in great detail by Nick Gammon in http://www.gammon.com.au/i2c in the paragraph Communicating with other devices


Indeed, I2C slaves cannot communicate with one another.

There are some obscure capabilities for devices to switch role, but that is likely to introduce lots of complications.

You might look at using bit-banged (or "soft") I2C on other digital pins and move the peripheral's I2C lines there instead o the hardware I2C pins connected to the pi. For example, a web search quickly found something that claims to do this at:


No idea if that particular one will work for you, but there are others as well.

Or you can re-design your scheme so that the pi reads the sensor, and if necessary writes the values of interest to the Arduino.


I had may be a bad connection but I can read the sensor AM2320 on Arduino- Uno and send the value back to Raspberry Pi.

Arduino side:

#include am2320
#define SLAVE_ADDRESS 0x04
AM2320 th;
Wire.write( (int)(th.t * 10)); // th.t is for temperature which I send 

Raspberry side:

import smbus
bus = smbus.SMBus(1)
address = 0x04
number = bus.read_byte(address)

Raspberry Pi and Arduino Uno seems to work good together with and I2C sensor on Arduino side. Thanks for you time to help me and I will go to the link you propose.

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.