Questions tagged [i2c]

Inter-Integrated Circuit (I²C) is a bus for low speed peripherals. Use this tag for questions regarding how to use I²C with an Arduino, or for problems with I²C and your Arduino.

Inter-Integrated Circuit (I²C) is a bus for low speed peripherals. It was invented by Philips, but many companies have created devices using the I²C protocol.

Use this tag for questions regarding how to use I²C with an Arduino, or for problems with I²C and your Arduino.

See the Wikipedia article for more info.

751 questions
12
votes
3 answers

How do I use I2C devices with Arduino?

I have a few useful I2C components, such as a 16-bit port expander (MCP23017), which I'd like to use in various projects. What do I need to do to make these work with Arduino? Will it work with any Arduino, or do I need a specific board or shield?
Peter Bloomfield
  • 10,932
  • 9
  • 47
  • 87
10
votes
1 answer

What does it mean in I2C, "NACK received"?

I am reading about I2C. On this site: http://playground.arduino.cc/Main/WireLibraryDetailedReference#endTransmission It says that endTransmission() can return one of the following status codes: 0: Successful send. 1: Send buffer too large for the…
Mads Skjern
  • 1,125
  • 3
  • 13
  • 23
6
votes
1 answer

Arduino as a custom I2C slave device

I'm trying to interface with a master I2C device that doesn't exactly follow the normal I2C protocol. The only difference really is in the read request. A "normal" I2C read operation looks like this ([M]aster, [S]lave): S | SLA+R | ACK | Data | Ack…
5
votes
0 answers

Why is Wire.onReceive() called during requests?

I'm building a complex I2C-based networking protocol and have noticed that the Wire.onReceive() handler is called both for I2C read and write operations. When the master writes to the slave, it is called as you'd expect. But it also seems to be…
Jeremy Gilbert
  • 254
  • 2
  • 4
5
votes
4 answers

How to setup an I2C bus which stays valid if a slave is powered down or fails?

I have setup an I2C bus between 3 Arduinos (Master, Slave1 and Slave2) by connecting all 3 A4 pins together, all 3 A5 pins together and one GND pin of each Arduino to a common ground line. The 3 Arduinos are currently being powered by independent…
4
votes
2 answers

How to change the I2C address of the AS5048B?

I saw this video from James Bruton. See the links to the GitHub repos in the video description. I bought a few AS5048B boards from AMS, so I can measure the position of my stepper motors. In the sosandroid repo, I ran program_address and was able to…
John Doe
  • 151
  • 5
4
votes
3 answers

Can't detect I2C displays with Arduino Nano

All cables tested and work: SCL - A5 SDA - A4 VCC - 5V GND - GND I'm using an Arduino Nano board and an I2C display - I've tried everything to get it to work and I'm now convinced it's a hardware fault. Using the Arduino I2C address scanner, it is…
Baddog22
  • 41
  • 1
  • 1
  • 4
3
votes
2 answers

Is it possible to use multiple I2C sensors with Arduino without an I2C multiplexer?

I have an IMU sensor and a Bluerobotics temperature sensor, both have different I2C addresses. I want to integrate both with an Arduino UNO, I know I can do this with an I2C multiplexer but I don't have access to one right now. Is it possible to…
ssmalik
  • 39
  • 1
3
votes
1 answer

Sensor TSL2591 with Arduino Mega

I have three light sensors TSL2591, of signal I2C, that I need to connect (together) to an Arduino Mega. However, I'm not very sure of how share the SDA and SCL pins of the three sensors and I don't know how to change their address for the Arduino…
3
votes
1 answer

Three or more Arduino slaves sending bytes to 2 different I2C devices

I'm trying to connect 3 Arduinos with this scheme: Arduino1 Master, Arduino2 Slave, Arduino3 Slave. The slave devices need to communicate with each other and I'm trying to programming Arduino2 and transmit bytes to the other slave device Arduino3…
Francesco Valla
  • 366
  • 1
  • 8
  • 16
3
votes
1 answer

Performing multiple Wire.writes() - does endtransmission slow things down?

Here's a question for anyone knowledgeable of the ways of I2C. I'm curious about sending multiple writes to a device and was looking at the code for a MPU9250 module. There is a nice library that compiled straight off the shelf by Kris Winer…
Owen White
  • 31
  • 1
  • 2
3
votes
1 answer

Arduino as Slave to Return Multiple Values

I'm having trouble trying to get my two Arduino Unos to communicate with each other over i2c. I'm trying to have the master request for analog values from the slave by sending a request to the slave device for one of the six ADC pin values. Master…
awwende
  • 33
  • 3
3
votes
2 answers

Two-wire communication (I2C) between Arduino Micros

I am attempting to communicate data via I2C between two Arduino Micros, but can't seem to get the "slave" device to detect a Wire.onRecieve() event. Per the specification on this site [http://www.takktile.com/tutorial:arduino] (and verified against…
3
votes
3 answers

Arduino I2C maximum number of writes per transmisson

Is there any limit on the number of Wire.write() commands consecutively in between the Wire.beginTransmission() command and the Wire.endTransmission() command for the Arduino Wire library?
pascalm
  • 57
  • 2
  • 4
2
votes
1 answer

I2C cabling rules for 2+ devices

I'm attempting to wire two breakout boards with i2c devices to a Mega2560: a HD44280 LCD with PCF8574 i2c backpack a combo board with DS1307 + AT24C32 There are two obvious possibilities for cabling: two 10-inch ribbon cables that come together…
Bitbang3r
  • 523
  • 1
  • 3
  • 11
1
2 3 4 5 6