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.

767 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,982
  • 9
  • 48
  • 87
11
votes
2 answers

Cheap Wired Multipoint Mesh Network

I'm looking to make a 15 x 15 grid of load sensors and RGB LEDs for an interactive dance floor. Each node will be driven by an arduino and the entire floor will be managed by a RaspberryPi. I'm trying to figure out the best way to have the nodes…
Jeremy Gillick
  • 481
  • 1
  • 3
  • 8
11
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,145
  • 3
  • 13
  • 23
10
votes
1 answer

How to design and debug a custom I2C master-slave system?

How to proceed, when in need of a custom I2C master-slave system? What are the design criteria to apply? What are the debugging tools one can use to troubleshoot problems?
Igor Stoppa
  • 2,125
  • 1
  • 15
  • 20
9
votes
3 answers

I2C LCD Serial Interface Board not displaying text (wrong pins?)

I have a 1602 LCD screen that works fine on its own. However I wanted to free some pins by using an I2C / IIC LCD controller I purchased separately. While the controller seems to be communicating with my Arduino UNO on the right address, I cannot…
Bort
  • 397
  • 2
  • 6
  • 18
9
votes
4 answers

How do functions outside of void loop work?

I am used to Arduino sketches with a void setup() part that runs once, and a void loop() part that keeps looping. What happens when you have void functions outside of the main void loop()? Will these all keep looping in parallel or do they run one…
Blue7
  • 245
  • 3
  • 4
  • 8
8
votes
2 answers

How to choose alternate I2C pins on ESP32?

I'm a begginer with Arduino and this may be a basic question but I'm facing an issue. I'm using a HTU21D sensor with an ESP32. This sensor use I2C communication. Inside the Arduino library, there is this function to start to collect data: //Start…
Gazouu
  • 273
  • 2
  • 4
  • 10
8
votes
2 answers

Burning sketch with I2C

Not a pure Arduino question really. I'm actually using a standalone ATmega168. So far I've been using AVR-ISP programmer (working from AVR Studio) to program the chip. After everything is done, the chip will be covered and I will only have access to…
tsf144
  • 243
  • 2
  • 9
7
votes
0 answers

Handling non-standard I2C read response lengths with Wire library

I'm trying to read from a Sam&Wing XW12A 12 channel touch sensor IC using I²C. The IC responds to an address read packet with 16 uninterrupted bits representing its state. However, since I²C usually uses 8 bit bytes separated with an ACK signal,…
Jim
  • 171
  • 3
7
votes
2 answers

Is there a pullup on I2C?

I am using an Arduino Uno R3. It is not clear on the schematic whether there are pullups on the A4 and A5 I2C pins. Are there hardwired pullups or do I have to add them myself?
harry_p_6
  • 175
  • 9
7
votes
3 answers

Sainsmart LCD 2004 - LiquidCrytal_I2C library issue unable to compile

I bought a Sainsmart LCD2004 from Amazon to use with my Arduino Uno. I understand that since this LCD uses I2C a new library needs to be downloaded. From the sainsmart website I dowloaded the LCD 2004…
Caesar
7
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
  • 274
  • 2
  • 4
7
votes
3 answers

Multiple I2C sensors with the same address

I am trying to find the simplest way to connect multiple (preferably around 10-20) IMU sensors to one controller. There are two constraints: sampling at 60Hz and reasonably simple wiring as I want to put it on clothes. I am totally new to the…
Łukasz Kidziński
  • 173
  • 1
  • 1
  • 7
7
votes
3 answers

I2C 2 way communication between Arduino Uno and Arduino Mega

If I remove the transmission code from slave this works properly but I need to transmit from slave. Here is my master code #include void setup() { Wire.begin(3); Wire.onReceive(receiveEvent); } byte x = 0; void loop() { …
srinivas
  • 83
  • 1
  • 1
  • 4
7
votes
2 answers

Difference between Wire.setClock() method and TWBR method for changing I2C Frequency

I want to change the I2C frequency of my Arduino Mega 2560. I did find two methods. One method is to change the TWBR variable after Wire.begin(). The other one is to use Wire.setClock() after Wire.begin(). Whats the difference between the 2…
William Roy
  • 515
  • 4
  • 10
  • 22
1
2 3
51 52