Skip to main content
16 votes

Raspberry as an I2C SLAVE

Since this topic is very poorly covered and Sebastião's snippet and helped me to solve this problem I want add a complete solution on how to setup a RaspberryPi right here (tested on a RPi 3 and Zero ...
LinusCDE's user avatar
  • 161
13 votes

Can we use other GPIO pins as I2C

The whole point of I2C is it is a bus. You can therefore connect multiple I2C devices to the same GPIO provided they have different I2C device addresses. If the devices share an address which can't ...
joan's user avatar
  • 71.5k
13 votes

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

The preliminary Raspberry Pi 4 Model B datasheet, section "5.1.1 GPIO Pin Assignments" says: As well as being able to be used as straightforward software controlled input and output (with ...
Ghanima's user avatar
  • 15.9k
12 votes

Raspberry Pi DPI only works over short distances. Why?

All cables have a length limit. When you exceed that length limit, the signals in the cable attenuate due to resistance of the cable, get deformed due to capacitance and inductance in the cable, and ...
user10489's user avatar
  • 991
11 votes
Accepted

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

The fix is to use raspi-config to activate the I2C port. I'm documenting this because the interthing had no link from that misleading error message to this fix, because nobody except me forgot to ...
Phlip's user avatar
  • 338
9 votes
Accepted

How to use Adafruit TCA9548A 1-to-8 I2C Multiplexer Breakout in C#?

A code sample is right there on Adafruit website (in Python, but it's very simple). The TCA9548A multiplexer is interesting in that it has an I2C address (0x70 by default) - and you basically send ...
Dmitry Grigoryev's user avatar
9 votes
Accepted

PoE hat fan activation on OS other than Raspbian

I'm using Ubuntu Server 20.04 LTS. The dtparams setting does not work, instead you need a udev rule. The fan config is in /sys/class/thermal/cooling_device0/, if you cat /sys/class/thermal/...
Luke Channings's user avatar
8 votes
Accepted

How to Read I2C Address

The active address is 0x65. The row indicates the 16's place and the column indicates the one's place. So the answer is 0x60 + 0x05 = 0x65.
NomadMaker's user avatar
  • 1,560
7 votes
Accepted

How to setup a MCP79410 real time clock?

In order to set up a MCP79410 real time clock (RTC, see manual), one needs to start by connecting it to one's RPi and a quartz crystal. The following is supposed to be a rough sketch on how to connect ...
Fantilein1990's user avatar
7 votes
Accepted

Raspberry as an I2C SLAVE

This is almost identical to your previous question. You probably should have edited that rather than asking a new question. You need the bscXfer to be within the while loop. That is how the xfer ...
joan's user avatar
  • 71.5k
7 votes

What is Rpi's I2C Maximum Speed?

As a side note to anyone experimenting with the i2c baudrate, you don't have to set the baudrate via config.txt, which requires a reboot. You can do it at runtime by configuring the kernel module with ...
Dmitry Grigoryev's user avatar
6 votes

I2C Bus voltage

Some of the other comments are true, but not totally clear. You can use the Pi I²C to connect to another I²C device, even if it is powered by 5V provided there are no pull-up resistors to 5V. I ...
Milliways's user avatar
  • 61k
6 votes
Accepted

rPi3 I2C-LCD, do i need a logic level converter?

You can't just write to an I2C bus. The SCL line is an output from the master (Pi) but the SDA line is an input and an output. The LCD should not have pull-ups to 5V on board but many do. Perhaps ...
joan's user avatar
  • 71.5k
6 votes
Accepted

I2C bus 0 not working, I2C bus 1 is

After searching around I have found the problem. Simple solution is that the config menu only enabled i2c-1 bus, not the i2c busses in general. Opening the file /boot/config.txt and then adding the ...
Puffafish's user avatar
  • 181
6 votes
Accepted

/dev/mem vs /dev/i2c-1

Disadvantages using /dev/mem for accessing the I²C hardware of the Raspberry Pi directly: It's not portable to other hardware platforms. It's not portable to additional USB I²C adapters. It's not ...
Janka's user avatar
  • 1,728
6 votes
Accepted

What is Rpi's I2C Maximum Speed?

Answer I have confirmed that Rpi4B 4GB v1.2 buster 2020feb13 I2C #1 can set speed other than 100kHz. Figures Appendices Appendix A - /boot/config.txt tlfong01 2020mar04 # /boot/config.txt ...
tlfong01's user avatar
  • 4,767
6 votes
Accepted

How to connect multiple sensors to an rpi with the I2C?

I2C is a bus system and allows you to connect multiple sensors to the same pins. The master system (the Pi) lets the sensors know who should respond by placing that sensor's address on the bus. In ...
joan's user avatar
  • 71.5k
5 votes

I2C not working on RPi 2 B

Initially Enable the I2C protocol feature in raspberry pi: sudo raspi-config Enable the I2C Reboot your system Connect the I2C device to its SDA and SCL pin respectively refer the pin out of ...
MVA's user avatar
  • 76
5 votes
Accepted

Prevent wake-from-halt

Yes there is a way to disable GPIO3 (physical pin 5) pulled low to boot. In /boot/config.txt add the line dtoverlay=gpio-poweroff See the documentation for overlays in /boot/overlays/README. The ...
Philip Cook's user avatar
5 votes

Enable i2c on Ubuntu Mate Raspberry Pi 3

Add the following line to /boot/config.txt dtparam=i2c_arm=on Add the following line to /etc/modules i2c-dev Reboot
joan's user avatar
  • 71.5k
5 votes
Accepted

Does the Pi4 have pullups on SDA/SCL?

I²C requires pullup to work. The unreferenced discussion seems to be misinformed. All Pi models have on-board 1.8kΩ pullups on I²C pins 3,5. I have not used I²C on a Pi4, but assume it is unchanged. ...
Milliways's user avatar
  • 61k
5 votes
Accepted

Pi locking up trying to use rising/falling edge detection

Solution: Add: dtoverlay=gpio-no-irq to /boot/config.txt. Previously the kernel would automatically disable interrupts when you set one of rising/falling edge detection methods but that apparently ...
Nick's user avatar
  • 195
5 votes
Accepted

How to connect two BME280 sensors via I2C to a Raspberry Pi 3B+

In general, every I2C device has its own address, and one can connect many devices to the same port e.g. of the PI. Individual communication is possible via those addresses. (This is something you set ...
sweber's user avatar
  • 516
5 votes

Pi Zero W: Second i2c Bus

Setting up a software I2C bus is very simple with device tree. For I2C bus 3 using GPIO 5 as SDA and GPIO 6 as SCL add the following entry to /boot/config.txt and then reboot. dtoverlay=i2c-gpio,...
joan's user avatar
  • 71.5k
5 votes

What is Rpi's I2C Maximum Speed?

The maximum supported speed is 400 Kb/s. I am not aware of any difference in the I2C implementation between Pi models. The Broadcom Serial Controller (BSC) controller is a master, fast-mode (...
joan's user avatar
  • 71.5k
5 votes

What is Rpi's I2C Maximum Speed?

WIth an RPi 4: Using i2cdetect program to make the lines wiggle. Using an oscilloscope, if I just enable i2c in the config.txt with no other lines in the file, I see 10usec SCL periods (100kHz). ...
Larry Klein's user avatar
5 votes
Accepted

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

The Pi 4 appears to support clock stretching on the software I2C bus: dtoverlay=i2c-gpio,bus=3 The hardware I2C bus is affected by the same bug as earlier models which makes it incompatible with ...
Dmitry Grigoryev's user avatar
5 votes

Raspberry Pi DPI only works over short distances. Why?

Your Hyperpixel has a resolution of 800 x 480 x 60fps, so the data rate is 23,040,000 pixels per second, plus some gaps for synchronisation. You can't send such a fast signal over an arbitrarily long ...
jayben's user avatar
  • 597
4 votes

Cannot perform echo command to load driver for rtc module

The problem with your original echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device command is that only root can write to the /sys/class.. file. Normally prefixing a command with sudo will ...
js441's user avatar
  • 321
4 votes

Meaning of cmd param in write_i2c_block_data

When you issue a block write/read from the Pi with: bus.write_i2c_block_data(i2c_address, register, list of bytes) Example: bus.write_i2c_block_data(80, 0, [49, 50, 51]) or bus.read_i2c_block_data(...
deltatango's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible