I want to use other pins which are not default SCL,SDA unlike code that Adfruit they wrote. How can I use pin 5,6 or others that active as pin scl sda ?


enter image description here

Thank you for watching my question.

1 Answer 1


You can create a software I2C bus on any pair of spare GPIO. Note that you will need to add pull-ups to 3V3 on these GPIO for them to properly work as an I2C bus (1k8 resistors are suggested).

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

See /boot/overlays/README for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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