On a RPi 3, default SDA-I2C and SCL-I2C are assigned to pins 3 and 5 (same as GPIO02 and GPIO03).

Is possible to change to another pins? How can I do this?


You can implement a software I2C bus on any pair of spare GPIO. You will need to add resistor pull-ups to 3V3 on any spare GPIO you use. For reference pins 3 and 5 have 1k8 pull-ups to 3V3.

You create the software bus by adding a configuration entry in /boot/config.txt. For details see i2c-gpio in /boot/overlays/README.

Name:   i2c-gpio
Info:   Adds support for software i2c controller on gpio pins
Load:   dtoverlay=i2c-gpio,<param>=<val>
Params: i2c_gpio_sda            GPIO used for I2C data (default "23")

        i2c_gpio_scl            GPIO used for I2C clock (default "24")

        i2c_gpio_delay_us       Clock delay in microseconds
                                (default "2" = ~100kHz)

        bus                     Set to a unique, non-zero value if wanting
                                multiple i2c-gpio busses. If set, will be used
                                as the preferred bus number (/dev/i2c-<n>). If
                                not set, the default value is 0, but the bus
                                number will be dynamically assigned - probably

E.g. to create a software bus on (Broadcom numbered) GPIO 5 and 6 add the following line to /boot/config.txt. You will need to reboot for the change to take effect.


A new bus /dev/i2c-3 will be created. You may use all the standard I2C calls to use the bus.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.