I am working on the Raspberry Pi Compute Module 4. I would like to implement the 2 I2C ports for the 2 different types of sensors. (must be accessed within a single application)

I am using the I2C Library Wiring Pi for example test cases.

Will you please help me to know, How do I am able to open multiple I2C ports in a single application?

  • 1
    I don't remember any problems with that. Where is your code?
    – joan
    Jul 8 '21 at 7:36
  • @joan I am using the sample example.
    – shiv patil
    Jul 12 '21 at 4:26

I2C sensors have address and in many devices these addresses can be changed. Different types of I2C devices can be on the Same I2C bus. Be sure you are careful with the pull up resistors (required), if more then one resistor be sure the combined resistance is not to low. Note the pull up resistors go to the 3.3V power supply not between SCL and SDA.

  • As I mentioned above, I would like to use multiple I2C ports, not multiple slave devices on a single I2C bus. My application requires a dedicated I2C port for the gesture detection module & else sensors must be placed on another I2C port. Will you please help me to know, how can I manage this in a single application so my I2C port will work parallelly.
    – shiv patil
    Jul 12 '21 at 4:34
  • 1
    I found this, I think it will resolve your problem. medium.com/cemac/… Let us know how you make out with this, it explains it much better than i can in the amount of allocated space here.
    – Gil
    Jul 12 '21 at 19:54

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.