Skip to main content

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.

Filter by
Sorted by
Tagged with
1 vote
2 answers
5k views

How to change i2c address for mpu9250?

I'd like to connect 12 mpu9250 sensors to one arduino board. I can't find documentation on how to change the addresses of mpu9250 boards. (i read through the reference ). Some tutorials talk about ...
kirill_igum's user avatar
5 votes
4 answers
5k views

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 ...
Jolas Marginópolis's user avatar
10 votes
1 answer
3k views

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's user avatar
  • 2,125
7 votes
3 answers
20k views

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 ...
Łukasz Kidziński's user avatar
6 votes
2 answers
13k views

What does this notation stands for? Wire.read() <<8 | Wire.read()

I'm using the Arduino's site test code for getting raw values from a MPU-6050 accelerometer + gyro. In the loop, there are this lines for getting the next data from its registers: Wire.requestFrom(...
Julio's user avatar
  • 113
3 votes
2 answers
924 views

I2C protocol doesn't work properly

I am trying to make I2C Communication between NodeMCU and arduino Uno boards. However it is not working properly. It makes communication for once time when i uploaded code. Master Device Code(NodeMCU ...
Snefru Clone's user avatar
2 votes
2 answers
7k views

Arduino slave with 2 masters sharing the same I2C Bus?

Consider a scenario where two (or more) master devices (the NodeMCU's, in this case) share an I2C bus with one (or more) slave device(s), like thus: Would this be a feasible setup? In other words, ...
tony gil's user avatar
  • 362
1 vote
1 answer
281 views

Servo jitter with two atmegas

So i'm building my own quadcopter at this moment and I have designed a flight controller board for it using two atmega328p's. I've programmed it so that the first atmega receives al the data from ...
nemo bondt's user avatar
0 votes
1 answer
2k views

Software I2C - sending data

I'm trying to read a voltage in from a power supply to an Arduino Micro, then send it to an oscilloscope through an I2C (MCP4725). I would use the default pins on the Micro but I want to wire three ...
Hayden Bartsch's user avatar
12 votes
3 answers
29k views

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 ...
Peter Bloomfield's user avatar
9 votes
3 answers
62k views

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 ...
Bort's user avatar
  • 397
7 votes
3 answers
67k views

Sending and receiving different types of data via I2C in Arduino

I have found a few good tutorials on how to send and receive data via I2C in connected arduinos. My limitation is now how to transmit different types of data like for instance, long, float, etc. Right ...
Camilo's user avatar
  • 359
7 votes
5 answers
17k views

Alternatives to Wire library for I2C

I am looking for (reasonably easy to use and well tested) alternatives to the Wire library. Wire works very well, but: I only need the Arduino to act as I2C master and the Wire library seems to be a ...
fuenfundachtzig's user avatar
7 votes
3 answers
31k views

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 <Wire.h> void setup() { Wire.begin(3); Wire.onReceive(...
srinivas's user avatar
5 votes
1 answer
15k views

How to connect new OV7670 FIFO to Arduino?

I bought a new OV7670 FIFO camera to connect to my Arduino UNO a few days ago. The picture of the cam board: I found this forum, it is nice try but it looks chaotic and confusing with about 50 pages,...
zokit's user avatar
  • 53
5 votes
3 answers
8k views

How do I use two I2C LCDs with 4 pins?

I have two I2C LCD screens: one with 2 lines one with 4 lines. Both have 4 pins each: GND, VCC, SDA, SDL. I connect SDA and SDL to A4 and A5 respectively, and I display text on each one of them with:...
Konstantinos's user avatar
5 votes
3 answers
4k views

Arduino Due and BNO055 address in i2c mode

I have a project where I need to have several IMUs, the BNO055 shuttle board (I explained my project here), I manage to get the Euler angles from one BNO055 sensor, which have the address 0x29, ...
BunkSB's user avatar
  • 61
5 votes
2 answers
15k views

I²C with ATTiny85 at 8MHz using TinyWireM library

Hello fellow Arduino enthusiasts, I am trying to make the ATTiny85 talk I²C with a MMA7660 breakout board I have (it's an accelerometer, this is a follow up question to my previous one). I would ...
Omer's user avatar
  • 1,380
4 votes
2 answers
384 views

I2C sensors not working when I connect to LCD 20X04

I am making a hydroponic nutrient monitoring system using Arduino Uno, Atlas Scientific EC sensor, pH sensor, and RTD (temperature) sensor in I2C mode. I also want to use LCD 20x04 to display the ...
Angela Radityatama's user avatar
3 votes
2 answers
12k views

I2C and SPI at the same time?

I would like to ask a question relating to the following communication setup: STM32 -- Arduino Pro Mini -- ADNS3080 sensor The interface between STM32 -- Arduino is I2C and the interface between ...
user3752073's user avatar
3 votes
2 answers
45k views

How to display variables on 0.96" OLED with u8glib library?

I have Arduino Uno and 0.96" I2C Oled 4 Pinned display. These are my Arduino codes: #include "U8glib.h" U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE); // VDD=5V SCL=A5 SDA=A4 int a = 10; void ...
Bay's user avatar
  • 305
3 votes
3 answers
3k views

What is the right way to query an I2C device from an interrupt service routine?

The ADXL345, for example, requires that interrupts are responded to by querying the INT_SOURCE (interrupt source) register. In example code for the SparkFun ADXL345 Arduino Library, there is code that ...
James Brusey's user avatar
3 votes
3 answers
3k views

Interfacing Arduino through USB or I2C?

I am planning to connect multiple Arduinos to my Raspberry Pi. There are basically two ways I can achieve that: Use an USB hub. Each Arduino will then be available through ordinary serial commands ...
frodeborli's user avatar
2 votes
3 answers
7k views

Receiving two-byte int values over serial

I am using Python smbus write_word_data method to send int values from a Raspberry Pi to an Arduino using I²C. This seems to be the correct method. When I send values from 0-255, I see the following ...
Bachalo's user avatar
  • 251
2 votes
2 answers
642 views

Can I safely integrate 3,3v sensor with 5v Arduino UNO? How?

I plan to use Adafruit's RGB sensor with Arduino working as a RGB controller running on 5V. In my location, the 5V-compatible version of the sensor is not available. There is a 3,3V pin on my Arduino ...
Adam Ryczkowski's user avatar
2 votes
1 answer
417 views

What is the execution context of the function registered via the Wire.onReceive() method?

I'm basically wondering if it's OK to Serial.write() or print in the function I register to be called when I2C data is received. I can't seem to find the execution context or any warnings. http://...
tarabyte's user avatar
  • 131
2 votes
2 answers
11k views

How to choose SDA/SCL pair on Arduino Due?

On Arduino Due, there are two pairs of SDA/SCL pins that I can use for I2C. There is SDA0 and SCL0 at, respectively, pins 20 and 21 and another near AREF. How do I choose which one of them I use? I ...
snoob dogg's user avatar
2 votes
1 answer
153 views

Get address of a I2C transaction when multiple addresses are registered

I have an application polling 4 ADCs by I2C. The application shall also write on some ADC registers. In order to test it, I'd like to use a single Arduino UNO, enabling it for receiving I2C messages ...
lumaca96's user avatar
2 votes
1 answer
619 views

How can I identify, debug or fix a faulty IMU?

I have an LSM9DS1 breakout board by Sparkfun, and am communicating with it using a Mega 2560 over I2C. The board is given 3.3 V power as defined in the data sheet, though there seems to be confusion ...
J Collins's user avatar
  • 295
2 votes
2 answers
14k views

Disabling i2c internal pull up resistors

How do you do this? I've been digging around and I can see that I should do this and supply my own external pull up resistors but I don't know exactly how to disable them. The pages I've been reading ...
David Tran's user avatar
1 vote
1 answer
3k views

How to close/end a Wire.begin()?

I have an ESP32 cam, and I attached an i2c light sensor to it. I need to read the light level at startup, then I don't need the i2c connection again. The problem is, the board uses 2 i2c connections I ...
Radu's user avatar
  • 113
1 vote
0 answers
1k views

trouble running i2c and spi at the same time

I know this question has been asked before but I am having trouble running I2c and SPI at the same time. I am attaching my code below. The problem when I run the code is that the LED's don't blink ...
Brit 's user avatar
  • 41
1 vote
1 answer
459 views

Modifying Arduino IMU library to rely on DSSCircuit's I2C Master Library

For an Arduino project I am working on, I am trying to modify the SparkFun 6 Degrees of Freedom IMU Digital Combo Board - ITG3200/ADXL345 to support DSSCircuit's I2C Master Library (https://github.com/...
John Doe's user avatar
1 vote
2 answers
4k views

Two-way communication on multimaster I2C bus

I'm trying to send data both ways between an Arduino Mega 2560 slave and 2 Arduino Nano Zero (ATSAMD21G). This example is a simplified setup and code. There will be more masters along with passive ...
kb_'s user avatar
  • 41
0 votes
2 answers
941 views

ESP8266 not working with MPU 6050 over wire library and I2C

I'm trying to use this version of ESP8266 to access MPU 6050. However, it's not working. https://www.amazon.com/gp/product/B07HF44GBT/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1 i.e. ...
ShoutOutAndCalculate's user avatar
0 votes
1 answer
1k views

HMC5883L not working in continuous mode!

I'm just starting with the HMC5883L, I'm writing my code with C and also my own I2C library. I noticed that the values on the Arduino IDE's serial monitor are constant. Then I developed a function ...
R1S8K's user avatar
  • 283
0 votes
3 answers
4k views

Multiple I2C slave devices on Arduino - Pull-up values

This question is asked a lot and I've found many usable details on different forums regarding adding pull-up resistors on SDA/SCL lines. I know that only one resistor should be added on these lines ...
Nima Sajedi's user avatar
0 votes
1 answer
2k views

MCP4725 I2C address

I want to use four of MCP4725 DAC module at the same time but it only has two I2C addresses which can be set via jumpers: In page 10 of the datasheet it says: Device Address Selection pin. This ...
ElectronSurf's user avatar