Skip to main content

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
32 votes
4 answers
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?
Alex L's user avatar
  • 7,605
19 votes
3 answers
38k 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 ...
LittleOne's user avatar
  • 293
18 votes
5 answers
66k 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 ...
wja's user avatar
  • 183
15 votes
2 answers
23k 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 ...
Sebastião's user avatar
15 votes
2 answers
26k 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?
John La Rooy's user avatar
14 votes
3 answers
57k 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 ...
RPiAwesomeness's user avatar
13 votes
4 answers
28k 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: ...
Gus Smith's user avatar
  • 133
13 votes
2 answers
18k 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 ...
Tomas's user avatar
  • 273
12 votes
4 answers
28k 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 ...
kevin's user avatar
  • 1,284
12 votes
1 answer
1k views

Is it possible to communicate with I²C devices via the GPIO? [duplicate]

Is it possible to communicate with I²C devices via the GPIOs? Also, are there any existing drivers or libraries that make this possible from Python?
Damian Powell's user avatar
10 votes
1 answer
5k 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 ...
Ghanima's user avatar
  • 15.9k
10 votes
2 answers
4k 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 ...
Moshe Katz's user avatar
9 votes
3 answers
412 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 ...
Scolytus's user avatar
  • 434
9 votes
2 answers
24k 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, ...
Ahmed Farid's user avatar
9 votes
1 answer
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.
John La Rooy's user avatar
8 votes
1 answer
10k views

What does raspi-config do when you enable i2c?

Is there any documentation for the raspi-config command that would explain what it actually does when enabling i2c? In the past I have just removed the i2c blacklist, added the modules and made sure ...
rob's user avatar
  • 2,803
8 votes
4 answers
9k views

PoE hat fan activation on OS other than Raspbian

I'm aware that the only officially supported OS that the PoE hat works on is Raspbian. I can confirm that both my hats work, and that the fan does switch on and off if I have Raspbian installed on the ...
Larnu's user avatar
  • 185
8 votes
2 answers
7k views

Adafruit bonnet & adafruit-circuitpython-motorkit return "ValueError: No Hardware I2C on (scl,sda)=(3, 2)"

on the line kit = MotorKit(), the error diagnostic is: ValueError: No Hardware I2C on (scl,sda)=(3, 2) quality standards quality standards quality standards quality standards quality standards ...
Phlip's user avatar
  • 338
8 votes
2 answers
22k 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 ...
user7015's user avatar
  • 183
8 votes
3 answers
26k 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 ...
thommie's user avatar
  • 223
7 votes
1 answer
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 ...
user avatar
7 votes
2 answers
2k 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 ...
Johnny Tordgeman's user avatar
6 votes
2 answers
7k 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?
KMP_a learner's user avatar
6 votes
5 answers
16k 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 ...
Cerin's user avatar
  • 2,261
6 votes
3 answers
3k views

Does the Raspberry Pi I²C bus support clock stretching?

Does the Raspberry Pi 4 (and previous models) support the I²C clock stretching feature? Some I²C devices, e.g., Bosche BNO055, Sensirion SCD-30, require this feature and the communication is likely to ...
KevinJWalters's user avatar
6 votes
2 answers
3k 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 ...
Fantilein1990's user avatar
6 votes
2 answers
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 ------------------...
Jay K's user avatar
  • 248
6 votes
2 answers
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. ...
fabb's user avatar
  • 283
6 votes
1 answer
9k 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 ...
Dennis's user avatar
  • 383
6 votes
1 answer
4k 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 ...
xirt's user avatar
  • 173
6 votes
1 answer
826 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 ...
Thomas's user avatar
  • 61
6 votes
0 answers
304 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 ...
HelpMeImDumb's user avatar
6 votes
2 answers
401 views

MMA845X accelerometer mapped at 1C

I have a MMA845X accelerometer mapped at 1C: 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- 1c -- -- -...
Cosmin Mihai's user avatar
5 votes
4 answers
2k views

Raspberry Pi DPI only works over short distances. Why?

I would like to use the Raspberry Pi 3B+ to operate the rectangular HyperPixel 4.0 touchscreen from Pimoroni. However, I don’t want to plug the touchscreen directly onto the Raspberry Pi, but instead ...
manintree's user avatar
5 votes
3 answers
566 views

What hardware peripherals might be capable of reading 6.144, or better yet, 9.216 megabits/second?

I'm hoping to interface a Raspberry Pi 4 with an 8 channel, 48 kHz ADC. Ideally a 24 bit ADC, which if my math is right means 9.216 megabits per second. But a 16 bit ADC would be acceptable: that ...
Phil Frost's user avatar
5 votes
4 answers
6k 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/...
Brick's user avatar
  • 1,377
5 votes
3 answers
2k 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 ...
fkarlsson's user avatar
5 votes
1 answer
2k 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 ...
Arno Moonen's user avatar
5 votes
1 answer
14k 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 ...
Kolban's user avatar
  • 1,784
5 votes
3 answers
9k 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. ...
EV-O's user avatar
  • 71
5 votes
4 answers
22k 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....
Thomas's user avatar
  • 81
5 votes
2 answers
7k 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?
Darau's user avatar
  • 51
5 votes
4 answers
7k 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 ...
Mero's user avatar
  • 298
5 votes
2 answers
13k 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 ...
shivam's user avatar
  • 205
5 votes
3 answers
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 ...
Mark Brown's user avatar
5 votes
1 answer
4k views

Is there a python library to allow I2C between Pi (master) and Pico (slave)

I want my Raspberry Pi to control my Raspberry Pico. I'm trying to send bytes of data to the pico and then read the data on the pico so that I can take different actions depending on the data sent (e....
pcoates's user avatar
  • 153
5 votes
2 answers
1k views

Changing the baud rate of additional I2C busses

for some project I need 5 sensors. Their I2C address is fixed and can be changed to another fixed value by soldering. So without an I2C multiplexer (which I don't have), I need at least 3 I2C busses. ...
Kilroy's user avatar
  • 91
5 votes
2 answers
2k views

Raspberry PI as I2C slave - problem sending data back

First, I read Raspberry as an I2C SLAVE and followed everything in there. Great thread. However, this thread does not address anything about sending data back. This is the scenario: rPI4 as master, ...
Stephane Bourque's user avatar
5 votes
1 answer
23k 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. ...
King Balloonion's user avatar
5 votes
1 answer
19k 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 ...
Issac Jacob's user avatar

1
2 3 4 5
17