I2C

From Autopilot Wiki
Jump to: navigation, search

This page is a stub!

This page contains basic information about using I2C devices on the Raspberry Pi

Enabling I2C on the Raspberry Pi

See the "Scripts:I2C" script (python -m autopilot.setup.run_script i2c)

  • Uncomment dtparam=i2c_arm=on in /boot/config.txt
sudo sed -i 's/^#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt'
  • Add i2c-dev to /etc/modules
sudo sed -i '$s/$/\ni2c-dev/' /etc/modules
  • Enable i2c with d2param and modprobe
sudo dtparam i2c_arm=on
sudo modprobe i2c-dev
  • Optional: Change i2c baudrate, default is 100kHz, can go as high as 400kHz. set i2c_arm_baudrate=100000 in /boot/config.txt
sudo sed -i '$s/$/\ni2c_arm_baudrate=100000/' /boot/config.txt