Difference between revisions of "I2C"
From Autopilot Wiki
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
This page contains basic information about using I2C devices on the Raspberry Pi | This page contains basic information about using I2C devices on the Raspberry Pi | ||
− | == Enabling I2C == | + | == Enabling I2C on the Raspberry Pi == |
− | See the " | + | See the "[[Depends on::Scripts:I2C]]" script (python -m autopilot.setup.run_script i2c) |
* Uncomment dtparam=i2c_arm=on in /boot/config.txt | * Uncomment dtparam=i2c_arm=on in /boot/config.txt | ||
Line 14: | Line 14: | ||
: <syntaxhighlight lang="bash">sudo dtparam i2c_arm=on | : <syntaxhighlight lang="bash">sudo dtparam i2c_arm=on | ||
sudo modprobe i2c-dev</syntaxhighlight> | sudo modprobe i2c-dev</syntaxhighlight> | ||
− | * | + | * '''Optional:''' Change i2c baudrate, default is 100kHz, can go as high as 400kHz. set i2c_arm_baudrate=100000 in /boot/config.txt |
: <syntaxhighlight lang="bash">sudo sed -i '$s/$/\ni2c_arm_baudrate=100000/' /boot/config.txt </syntaxhighlight> | : <syntaxhighlight lang="bash">sudo sed -i '$s/$/\ni2c_arm_baudrate=100000/' /boot/config.txt </syntaxhighlight> |
Latest revision as of 19:57, 30 November 2021
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