Questions tagged [i2c]

I²C stands for Inter-Integrated circuit, and is a data transferation system that allows connections between computers or microcontrollers and low-level peripherals (e.g. sensors or EEPROMS). It is a multi-master, multi-slave, single-ended, serial computer bus.

Filter by
Sorted by
Tagged with
29
votes
4answers
34k views

How can I use I2C to talk to sensors?

How can I talk to digital sensors over the I²C interface? Hardware: Which pins on the Raspberry Pi's GPIO can I use? Software: What I²C libraries are available?
19
votes
3answers
37k views

Firmware 3.18.x breaks I²C, SPI, audio, lirc, 1-wire (e.g. /dev/i2c-1, No such file or directory)

I am using I²C to control a Bright Pi module. I followed instructions from 'Configuring GPIO - Adafruit' and 'Configuring I²C - Adafruit' to set up the I²C. I have done this a few months ago and ...
14
votes
3answers
48k views

i2cdetect shows every possible address

I was trying to turn on I2C following this tutorial http://www.raspberrypi-spy.co.uk/2014/11/enabling-the-i2c-interface-on-the-raspberry-pi/ But I have problem which I cannot solve. The command ...
13
votes
3answers
56k views

Safest way to connect Raspberry Pi to Arduino Uno R3

I am working on a robot using an Arduino Uno R3 and I wanted to have the ability of controlling the Arduino wirelessly, like stopping the Arduino without having to pull the power-plug every time. I ...
13
votes
2answers
21k views

How to make raspbian load the i2c-dev module on boot up

I have installed 2012-07-15-wheezy-raspbian, and the i2c-dev module and i2c_bcm2708 are there and work with i2c-tools. How do I get the i2c-dev module etc. to load at bootup?
13
votes
4answers
25k views

Is there an I2C Library

Is there a simple library to talk to I2C for C++? I have found some stuff for python and Java, but I wanted C++. I was hoping someone has ported the Arduino Wire library so I could use code I have ...
12
votes
3answers
21k views

Meaning of cmd param in write_i2c_block_data

I am testing i2c communication between Pi and Arduino. The doc says: write_i2c_block_data(addr,cmd,vals) Block Write transaction. int addr,char cmd,long[] None I have this test: On Pi: ...
12
votes
2answers
17k views

How to use a DS18B20 temperature sensor in my Pi?

I have a few DS18B20 temperature sensors. These are normally used in Arduino projects, but I don't see why not to use them with a Pi. There is a software called DigiTemp that seems to drive the device ...
11
votes
1answer
1k views

Is it possible to communicate with i2c devices via the GPIO? [duplicate]

Is it possible to communicate with i2c devices via the GPIO? Also, are there any existing drivers or libraries that make this possible from Python?
10
votes
1answer
3k views

Pi 4 I/O interface options… and where to find them

The BCM2711's hardware documentation lists multiple I/O interface options. Among others these are: up to 6 × I2C, up to 6 × UART (muxed with I2C), up to 6 × SPI (only five exposed on Raspberry Pi ...
10
votes
2answers
3k views

Controlling 400 LEDs from a raspberry pi

I have a client who has several large bronze signboards, each with 100-150 little light bulbs on it, totaling approximately 400 bulbs. The bulbs are turned on and off on a schedule, currently by hand ...
9
votes
2answers
8k views

Raspberry as an I2C SLAVE

Does anyone know how to setup a Raspberry Pi 3 as an I2C slave (in C++)? Before someone answers saying that it's not possible, it is possible. Here is a link that says it is possible (pigpio ...
9
votes
3answers
401 views

Current state of I2C in Kernel and Kernel version in general

I need to use kernel drivers for some I2C peripherals, so I need kernel I2C support. As already discussed in a previous question, the current 3.1.9 kernel doesn't provide support for the SoC's I2C ...
8
votes
2answers
18k views

i2cdetect doesn't catch ANY address. How can I tell if I2C working correctly?

I'm having difficulties interfacing the Raspberry Pi to basically any I2C sensor. I've gone through a lot of tutorials on how to get the I2C driver to work and my connections are correct. Still, ...
8
votes
1answer
5k views

How do I bit bang I²C master?

I've installed RPi.GPIO. It doesn't support I²C yet, but can I use it to bit bang I²C? I would just need the Raspberry Pi to be the master.
7
votes
2answers
19k views

What bitrate can I get from an i2c bus?

In short, what is the maximum bitrate that can be achieved writing to an I2C bus from a Raspberry Pi? Should it be the theoretical maximum of 100KB/s? In more detail, I'm writing to an I2C bus from ...
7
votes
3answers
21k views

I2C devices not detected

I'm running raspbian on my pi and followed this tutorial to get the i2c going. i2cdetect -y 1 used to detect my i2c devices but doesn't anymore. The sensor is connected like this: Could this be a ...
6
votes
2answers
2k views

How to setup a MCP79410 real time clock?

I was trying to set up a MCP79410 real time clock (RTC) and had to search quite a bit until I found a way to integrate the RTC's time signal into my Raspbian Jessie: Apparently, even there, some ...
6
votes
3answers
9k views

How to allow I2C access for non-root users?

How do you allow non-root users to access I2C on the Raspberry Pi 2? I've compiled this code for accessing an MPU6050 sensor via I2C, and it works perfectly, but only when I call it via sudo. I ...
6
votes
2answers
6k views

MMA8452 I2C module

I am working on Raspberry Pi Model B. I am trying to interface this device over the I2C Bus on the Rpi. My hardware Connections are: RPi Accelerometer Vcc P1_1 ------------------...
6
votes
1answer
2k views

Controlling a official lego servo motor via Raspberry Pi

I am able to control a simple servo motor such as SG90 by using pulse-width modulation. However when it comes to controlling a 88004 LEGO Servo Motor it is simply a nightmare. By using PWM all I ...
6
votes
2answers
4k views

PREEMPT_RT and RPi Drivers

I'm planning to do some realtime control loop tasks with the RPi. In this post PREEMPT_RT and Xenomai were proposed. I'm thinking about trying PREEMPT_RT, as I'd like to keep it as simple as possible. ...
6
votes
1answer
6k views

Raspberry Pi as slave

I am using a Pi compute module and wish to make two of them to communicate to each other. I have hooked up some slave I2C devices to it (RTC, Temperature sensor). So I don't think making Pi as slave ...
6
votes
1answer
649 views

I2C repeated start with BitBanging not working - Pigpio library on Raspberry Pi B+

First post here on the forum! Been getting a lot of help here from all the past posts and I am grateful for such a great community. I have been trying to use Repeated Start by using the PIGPIO ...
5
votes
1answer
6k views

Can we use other GPIO pins as I2C

I would like to connect multiple I2C devices to my Raspberry Pi. Can I do that? What do i need to take care? Also is there any library which will output I2C on other GPIOs?
5
votes
4answers
5k views

Read data from Si7021 via I2C

I have an Si7012 temperature / humidity sensor attached to the i2c pins on my Raspberry Pi. Specifically, I have the Adafruit "break-out" with this sensor attached https://www.adafruit.com/product/...
5
votes
1answer
1k views

Does the Raspberry Pi support I2C multi-master configurations?

We are using Raspberry Pi 2 single board computers for test automation (they run our feature test against an actual DUT). Our Device Under Test (DUT) uses I2C multi-master mode to communicate with its ...
5
votes
1answer
13k views

Is there a tool to read and write data using I2C?

I am testing out some I2C connected hardware and my C program is working fine using Wiring Pi. However, what I wanted to do was read a byte or write a byte to the slave device from the shell. I ...
5
votes
3answers
8k views

How to use 2 x MCP23017?

I need to control 32 L.E.D's individually, now looking through the forum, the common solution is to use MCP23017 chips, as they can control 16 l.e.d's. With that in mind, I would require two chips. ...
5
votes
2answers
6k views

How to install smbus to virtualenv?

How to setup python-smbus in the virtual env? Pip does not find any appropriate package. Is there a way to make main python installation's libraries visible to virtual env?
5
votes
2answers
11k views

How to read data from arduino with raspberry pi via I2C

I have connected Raspberry pi 2 model B with arduino uno via Bi-Directional Level shifter. Raspberry pi GND ---------- GND Arduino 3.3v ---------- 5v ...
5
votes
3answers
2k views

Raspberry Pi/“Arduino” communication

I'm looking to use a raspberry pi to speak to multiple "arduino" ATMEGA328p ICs (through a logic-level converter). I figure I can do this reasonably well over the GPIO RX/TX and use qualifiers to let ...
5
votes
1answer
6k views

smbus Import Error

I'm trying to use the module 'smbus' on python3. I've downloaded it - when I try to download smbus, it says that smbus is up to date and installed. However, when I try to use it, it says the module is ...
5
votes
1answer
3k views

Pi to Pi Communication over GPIO / USB

I have a Pi Zero that I would like to use to communicate with a B+. In theory I can connect an adaptor cable and a WiFi or Ethernet USB dongle to the Zero, and do the same on the B+. However, as an ...
5
votes
0answers
157 views

Raspberry as I2C Slave, how to slow down transfer rate?

I have had minor success using the PIGPIO library and interfacing the Pi as an I2C Slave (Using GPIO Pins 18 and 19 as SDA and SCL) with a Campbell CR1000X Datalogger I am encountering a problem ...
5
votes
1answer
1k views

GY-521 module / MPU-6050 3x Accelerometer not detected by i2cdetect

I got this GY-521 module (https://www.aliexpress.com/item/MPU-6050-3-Axis-gyroscope-acce-lerometer-module-3V-5V-compatible-For-Arduino/2035920870.html?spm=2114.13010608.0.0.pRpLS4) and no matter what ...
5
votes
0answers
1k views

How can I read and write data to a Character Device File in Linux with PHP? [closed]

I'm trying to read and write to modules on the I2C bus on a Raspberry Pi using PHP. I'm using fopen() and fskeek(). Below is the code I've been trying to use to read data coming in from the physical ...
4
votes
1answer
373 views

Why did my Pi die?

So, I have determined that my Pi is dead. This is what I did in the few days leading up to it: 1. I used I2C about once every 2 seconds, meaning I updated the display about that often. 2. I read ...
4
votes
2answers
982 views

Prevent wake-from-halt

I have an SMBUS (I2C, SMART Battery/charger) communication connected to the RPi: Pin 3 GPIO2 SMBUS SDA Pin 5 GPIO3 SMBUS SCL When pin 5 is connected, the system will wake up after approx 5-20 secs ...
4
votes
4answers
20k views

How can I automatically update the hwclock with NTP when I have internet connection

I'm using an RPi with Raspbian which runs the NTP-daemon by default. I have connected an rtc-ds1307 external i2c hardware clock. I was following the instructions given here to set it up: http://learn....
4
votes
2answers
256 views

Proper way to bit bang I2C

As already mentioned in this question Reading and writing with smbus package, there are chips that, apart for standard SDA and SCL lines, use a third communication line. This means that this "...
4
votes
2answers
7k views

Connecting multiple devices via I2C

http://www.modmypi.com/raspberry-pi/breakout-boards/adafruit/adafruit-pwmservo-driver-16-channel-12-bit-pca9685 How do I connect two I2C devices to my R Pi? Specificaly 16 Channel 12 Bit PWM Servo ...
4
votes
1answer
4k views

How do I use the I2C bus?

I want to attach an I2C device; it has 4 lines (SCA, SDL, +, -). I understand I can connect the first two to pins 3 and 5, and the last two to various places. I also understand I can multiplex the ...
4
votes
3answers
3k views

i2cdetect strange output

I'm following this tuto http://skpang.co.uk/blog/archives/575 in order to setup my rpi with an I/O port expander. My problem is whenever I run i2cdetect to find out the device, I get a weird output. ...
4
votes
1answer
9k views

How to fix Remote I/O Error Whilst Using i2c OLED

I was using my i2c OLED perfectly well when seemingly for no reason I started getting the Remote I/O Error when I ran my Python program. For some reason this was fixed by installing i2c tools again. ...
4
votes
3answers
4k views

Why many RaspberryPi add on has pull up resistors?

I was looking at the I2C in RaspberryPi and I saw that they are pulled by 1.8K resistors(I am not talking about the ID pins). On the other hand, I got one of those RTC and they got two 222Ohm pull up ...
4
votes
1answer
2k views

Windows 10 IOT equivalent of i2cdetect

I am trying to troubleshoot an I2C device connected to my Raspberry PI Model B. The device is giving me the following error: System.IO.FileNotFoundException: The system cannot find the file ...
4
votes
1answer
3k views

i2cdetect on Raspberry Pi kernel 4.1.18-v7+ takes 115 seconds

I have tried on two different Pi's (2 and zero) with fresh installs and have the same problem. I have i2c enabled via device tree via raspi-config. When I run i2cdetect -y 1 without anything plugged ...
4
votes
1answer
2k views

Check for I2C device presence

I'm using I2Ctools to read data off of some devices attached to a raspberry pi via the I2C interface. I want to check if a device in a certain address is present or not. If present, read the data from ...
4
votes
1answer
247 views

I2C bus hangs in master RPi access to MSP430G uC ~1 in 1000 accesses

What I've done to deal with the problem I reset the MSP430, clearing the hung state. I've slowed down the I2C clock's frequency, beefed up the Power Supply, changed pull-up resistors - no change. ...

1
2 3 4 5
12