Skip to main content

I2C Usage

  • Use the I2C interface on the 40-pin header of the host computer
  • 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!!!
  • Make sure 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

Wiring and Scanning

  • After connecting to the FLY host computer via SSH, enter the command below to output the following content
  • 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 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 open, or the module is damaged, the output will be abnormal
  • Convert the address from hexadecimal to decimal and fill it into the i2c_address: field in the configuration
  • You can use an online base converter found through a browser search to convert it

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