The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
2
votes
1answer
505 views

Controlling I2C slave on Arduino with Python

Typically, when I connect my Arduino to a slave device through I2C or SPI, I'll control the slave using instructions coded in the firmware. The output data will be then printed to the Serial port and ...
2
votes
1answer
817 views

I2C collision detection

I have put together a system that uses multiple Arduinos and a couple of 20x4 LCD displays to monitor my PV sun tracker and a weather station. I am using I2C to link them all together. One of the ...
2
votes
2answers
496 views

Problems reading I2C sensor when using a Xbee module

I'm developing a project where I can control a RC boat with GPS and a magnetometer. How ever, I was developing everything connected to my computer and worked pretty well. When I was going to make some ...
2
votes
1answer
807 views

Can't retrieve data from X-NUCLEO-IKS01A1 using I2C protocol

So I bought this nucleo expansion board, the X-NUCLEO-IKS01A1, and on the package it says it is compatible with Arduino Uno. My goal here is to read data from any sensor on this board. (When I can ...
2
votes
2answers
6k views

How to read data from Arduino with Raspberry Pi via I2C?

I have connected a Raspberry Pi 2 model B to an Arduino Uno via Bi-Directional Level shifter, from this BLOG: Raspberry pi GND ---------- GND Arduino 3.3v ---------- ...
2
votes
1answer
1k views

Send AND Receive through i2c / set Arduino as master AND slave

For a project I'm using 2 Arduino Uno's, where Arduino#1 (master) sends raw data to Arduino#2 (slave). The slave should receive and encrypt the data and afterwards send the encrypted data back to the ...
2
votes
1answer
350 views

Communication over I2C protocol with more than one A/D device

According to datasheet of MCP3021 A/D converter (Microchip, page 16) the MCP3021 can be accessed by proper address bits in control byte. In case of MCP3021 5AT the address is 101, in case of MCP3021 ...
2
votes
1answer
3k views

Multiple I2C Devices connected parallel

I have two Lidar Lites, connected to one APM. I have no issue with getting data from one of them, i use the code below #include <I2C.h> #define LIDARLite_ADDRESS 0x62 // Default ...
2
votes
1answer
183 views

Function not successfully reading sensor registers

I'm trying to write a library for an accelerometer/magnetometer sensor. The sensor is a LSM303D chip (https://www.pololu.com/file/0J703/LSM303D.pdf). I've written a function, readRegister() (below) ...
2
votes
1answer
990 views

Use AS3935 with I2C?

Has someone experience with interfacing the AS3935 lightning sensor using I2C? I found a library but it only works with SPI as far as I can tell. I really don't want to give up 4 pins for SPI as I ...
2
votes
2answers
147 views

If I have a group of Arduinos connected via I2C, can one Arduino cause the rest to freeze?

I have a group of four Arduino boards connected via I2C. One is the master, which sends and receives values from all of the others. I noticed that the Master will stop executing its loop if power is ...
2
votes
1answer
311 views

Interfacing accelerometer LSM303DLH with Arduino UNO using I2C

I am trying to connet a tri axis accelerometer LSM303DLH to arduino UNO using the libraries taken from the following links (https://github.com/adafruit/Adafruit_LSM303DLHC and/or https://github.com/...
2
votes
1answer
3k views

I cannot find the I2C device by scanning

I've been trying to get a LCD I bought from deal extreme to work for some time with my ATTiny85 chip. It should be capable. I've tried googling the device but there is no proper documentation, so I ...
2
votes
3answers
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 ...
2
votes
1answer
717 views

Reading CMPS10 raw values

I've got a cmps10 compass module hooked up to my arduino due through a logic level converter. I am writing code to convert the raw magnetometer readings into a bearing that I can use but have run into ...
2
votes
2answers
2k views

Arduino to Raspberry Pi wired communication

I am new to Raspberry Pi (just brought mine before writing this post), and I am looking to see what is the most ideal way for two way communication between an Arduino and a Raspberry Pi (USB, SPI or ...
2
votes
0answers
25 views

qMenuSystem using DigoleSerial library doesn’t work on my I2C Monochrome OLED

Just like the title says I’m trying to make qMenuSystem to work with my oled display. Here is what I know so far about my display : - It's a Monochrome OLED 128x64 (Blue) Display - It's connecting ...
2
votes
0answers
308 views

How to use SPI to set/ read registers for a sensor (Avoiding need for Github Lib)

Ok so as some readers might have seen, my current project involves using MPU's. The idea is sending data via CAN bus to a controlling MCU to then send to a raspberry pi to perform the calculations ...
2
votes
1answer
849 views

Communicating with magnetic sensor - TLV493D-A1B6 over I2C

I'm using the TLV493D-A1B6 sensor connected to an Arduino Uno: I've attached all necessary documentation at the bottom. This is a 3D magnetic field position sensor that detects the magnetic field ...
2
votes
1answer
271 views

Arduino --> RPI I2C issue

ok, I feel like this should be simple, but I am at a loss Simple code mock up to send 4 bytes(mimicking a float) over I2C from Arduino to rpi. I am trying to create a state machine so that I can ...
2
votes
1answer
4k views

I2C libraries for ATTiny85?

I want to transmit I2C data, using a Digispark ATTiny85 board: http://digistump.com/products/1 http://digistump.com/wiki/digispark/tutorials/connecting I've found the following I2C libraries. Which ...
2
votes
0answers
3k views

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 ...
2
votes
2answers
324 views

I2C device responding, but data is nacked

I'm working on a project where I have to communicate to several devices over I2C using a Genuino 101. Now I'm trying to get data off the bus but wire.available() stays at 0, even though my trace ...
2
votes
0answers
485 views

CJMCU-116 9DOF mpu9250 driver [closed]

I've recently bought a CJMCU-116 sensor equipped with MPU9250. It features magnetometer, accelerometer and gyroscope. It uses I2C for communication. I've scouted everywhere but I could not find any ...
2
votes
1answer
121 views

Accelerometer (I2C) and Fona Shield (software serial) won't work together

I am using a Fona 808 shield with an Arduino Uno and the LSM303 accelerometer. The accelerometer is connected via I2C and the Fona uses software serial. My project requires the accelerometer to be ...
2
votes
0answers
431 views

Connecting arduino and EV3 using I2C

I'm trying to connect arduino uno and ev3 by using this guide (http://www.dexterindustries.com/howto/connecting-ev3-arduino/), everything works perfectly but when i tried to use analogRead block to ...
2
votes
1answer
3k views

Serial not working with I2C [closed]

I have been working on a hydroponic garden that is controlled with Arduinos. I have everything working except for the user interface. What I would like to do is have an LCD screen paired with a rotary ...
2
votes
0answers
640 views

Raspberry Pi, Teensy and Arduino's on i2c

I just got into an interesting mess. I have 3 Arduino's (Pro Mini's) and 2x Teensy's (3.1's) connected via I2C to a Raspberry Pi Master. The 2x Teensy's I2C data lines are connected via OctoBoards ...
2
votes
0answers
119 views

How can I send a number from a master and make the slave read it?

I am building a fan controller using an Arduino and a Raspberry Pi (the Pi is the master and the Arduino is the slave). The Raspberry Pi generates random numbers and I want the slave (Arduino) to be ...
2
votes
2answers
815 views

Arduino I2C via USB Serial cable? [closed]

An Arduino UNO is given. I want to establish an I2C communication channel between Arduino UNO and a Linux Machine which have only USB ports available to communicate with peripherals. Currently I can ...
1
vote
2answers
93 views

Arduino I2C Wire.onReceive hangs after a few loops

I have an Arduino Leonardo (master) and a Polulu A-star 328 PB(slave). I intend to use the slave to actuate some servos. I've modified the code from https://www.arduino.cc/en/Tutorial/MasterWriter to ...
1
vote
2answers
46 views

Two sensors using I2C

We have two sensor one of them(MPU6050-gyro) is communicating using I2C, the other is via SPI(SD card reader). Now, we need an additional component as a sensor that the barometer which communicates ...
1
vote
3answers
332 views

Which EEPROM has a long lifecycle?

I would like to build a box counter for machine, so I'm going to use EEPROM in Arduino to save count. But the lifecycle is limited to 100,000 writes. Please suggest an external EEPROM with a long ...
1
vote
4answers
1k views

Read float and long from external EEPROM chip

I am using an Arduino to read information from an EEPROM chip over I2C with the code I found here: https://playground.arduino.cc/Code/I2CEEPROM It works great for int and char values but I also need ...
1
vote
2answers
3k 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 ...
1
vote
2answers
398 views

Arduino Uno 2 I2C devices problem

I have two I2C devices connected to an Arduino Uno: an RTC and an OBD interface (see links below). The SCL/SDA of both devices connect parallel to SCL/SDA (respectively) of the Uno. My problem: when I ...
1
vote
2answers
125 views

Is I2C a good option for transmitting data over 200 meters by cable?

Is I2C a good option for such application or are there other protocols? I know that modules like these exists to extend I2C range, and I'm planning to use this one (P82B96). I'd like to use a ...
1
vote
2answers
527 views

I2C between Arduinos without Master

I am working on a library for some Arduinos that should talk between each other. The aim is that I can load the same binaries onto each Arduino. The I2C ID will be set by DipSwitches. So far ...
1
vote
2answers
7k 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 ...
1
vote
1answer
362 views

Bizarre compilation problem — only compiles with the addition of a single Serial.println() line?

I have a SwitchDoc Labs DS3231 Real Time Clock Module that I am using with an Arduino Mega. It's connected to 3.3V and the SDA(20)/SDL(21) pins. I'm also using SwitchDoc's RTC_SDL_DS3231_ARDUINO ...
1
vote
3answers
1k views

How to wait for next n bytes in I2C exchange?

I'm trying to get data from a sensor, but don't see how I can get data back. I'm looking at the data on the I2C bus with a logic analyzer, and I'm sending what I expect, but I seem to cut off the ...
1
vote
2answers
176 views

Problem with reading data from HMC5883L in GY-86

I am trying to read the data from GY-86 with my arduino UNO. While reading MPU6050 and MS5611, it works quite well. But somehow I can't read anything from HMC5883L. Here is the code I used: #include &...
1
vote
2answers
1k views

How to write a digitalWrite array for MCP23017 expander chip?

I'm using multiple expander chips for my project and I was wondering if there is a way to shorten the loop code by using array? So that I don't have a super long code. void setup() { mcp.begin(0); ...
1
vote
2answers
108 views

Virtual analog inputs? Possible? [closed]

Just wondering whether it is possible to create 'virtual analog' signals, I am designign a system that uses a tank level sensor (pressure transducer); the component has not yet arrived and I am ...
1
vote
2answers
3k views

Arduino Yun - not enough i2c & interrupt pins?

I'm trying to build a small personal weather station. The rain sensor, and wind speed sensor use interrupts. The barometric sensor uses i2c SDA and SCL. Reading the Arduino Yun manual, it says there ...
1
vote
1answer
39 views

Communication between arduino nano and MCP3424 over I2c

I'm am completing a project of mine that uses an MCP3424 i2c 18bit ADC and an arduino nano to measure temperature with an NTC thermistor but am having trouble with the arduino wire library. This is my ...
1
vote
1answer
427 views

I2C LCD Serial Interface Board not displaying text

The code dont gives error, but not displays "Hello World" #include <Wire.h> #include <LiquidCrystal_I2C.h> // Set the LCD address to 0x27 for a 16 chars and 2 line display ...
1
vote
1answer
1k views

i2c wire length

I have some problems with i2c. I can not use long wires on SDA and SCK bus. This seems to be the consequence of the capacity between the SDA and SCK wires and not between SDA/SCK and GND. I figured ...
1
vote
2answers
1k views

I2C from two masters (ATtiny85, ESP8266) to one slave (ATmega328)

I've been working on a project with I2C protocol where an ATmega328 (Arduino) configured as slave, receives messages from an ATtiny (ATtiny85, ATTinyCore by SpenceKonde) configured as master, or from ...
1
vote
1answer
997 views

I2C FRAM read/write is very slow. Taking over 500 microseconds per read, almost 500 per write

I've used the example code for the Adafruit I2C FRAM breakout board, but I've made it even simpler by just writing the same thing to each byte location and then reading them all off, doing nothing ...