Skip to main content

I2C Usage

  • Use the I2C interface of the 40PIN PC
  • This tutorial uses the FLY-PI V2LM75 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 via 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 PC via SSH, enter the following command to output the content below
  • If using I2C0, replace the 2 in the command below with 0
sudo i2cdetect -y -r 2
  • Please note that if everything is normal, the content above will appear immediately after pressing Enter, including 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 opened, or the module is damaged, the output will be abnormal
  • The address needs to be converted from hexadecimal to decimal before filling it into the i2c_address: field in the configuration
  • You can use an online base converter in a browser to perform the conversion

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