Skip to main content

I2C Usage

  • Use the I2C interface on the 40PIN up board
  • This tutorial uses FLY-PI V2LM75's I2C sensor with I2C2 as an example!!!
  • Please note that I2C1 cannot be used if it is already occupied by other devices!!!
  • Please ensure that the wiring is secure and stable!!!

Open I2C through FLY Tools

  • Find Overlays and select i2c2 and i2c0 at the back
  • Please note that I2C1 cannot be used if it is already occupied by other devices!!!
  • Save and restart
  • This tutorial uses PI V2 as a reference
  • After connecting to the FLY up board via SSH, enter the following command which will output the following content
  • If using I2C0, replace the 2 in the following command with 0
sudo i2cdetect -y -r 2
  • Please note that under normal circumstances, after pressing Enter, the above content will immediately appear with an address
  • Please note that the address is random
  • Please note that if the wiring is incorrect, the wires are reversed, the configuration is not open, or the module is damaged, the output will be abnormal
  • The address needs to be converted from hexadecimal to decimal and filled in after i2c_address: in the configuration
  • You can use a browser search for an online base converter to convert

Configuration

[mcu host]
serial: /tmp/klipper_host_mcu

[temperature_sensor my_sensor]
sensor_type: LM75
i2c_address:72
# # Default is 72 (0x48). Normal range is 72-79 (0x48-0x4F) and the 3
# # low bits of the address are configured via pins on the chip
# # (usually with jumpers or hard wired).
i2c_mcu:host
i2c_bus:i2c.2
# i2c_software_scl