PTH's embedded Raspberrypi tools and tweaks: Difference between revisions
Jump to navigation
Jump to search
(Created page with "= I2C = Enable I2C support by configuring the interface with <syntaxhighlight lang="bash" inline>raspi-config</syntaxhighlight>. Then, install the following packages: <synta...") |
|||
| (7 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
= I2C = | = I2C = | ||
== Config == | |||
Enable I2C support by configuring the interface with <syntaxhighlight lang="bash" inline>raspi-config</syntaxhighlight> and do a reboot to load the kernel drivers. | |||
Check if the kernel drivers were loaded at startup: | |||
<syntaxhighlight lang="bash"> | |||
lsmod | grep i2c | |||
</syntaxhighlight> | |||
Then, install the following packages: | For a Raspi 3B the result should look something like this: | ||
<syntaxhighlight lang="bash"> | |||
i2c_bcm2835 16384 0 | |||
i2c_dev 20480 0 | |||
</syntaxhighlight> | |||
== CMD Line Tools == | |||
Then, install the following packages to do some basic i2c tinkering: | |||
<syntaxhighlight lang="bash"> | |||
sudo aptitude -y install i2c-tools | |||
</syntaxhighlight> | |||
The i2cdetect tool can be used to search the bus for nodes. But Obacht, not all nodes are detected this way. | |||
<syntaxhighlight lang="bash"> | |||
sudo i2cdetect -y 1 | |||
</syntaxhighlight> | |||
== Snake charming: Python programming == | |||
Then, install the following package(s) for i2c support in python: | |||
<syntaxhighlight lang="bash"> | |||
sudo aptitude -y install python3-smbus | |||
</syntaxhighlight> | |||
or smbus2 for some extended features: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo | sudo pip3 install smbus2 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 14:14, 5 November 2021
I2C
Config
Enable I2C support by configuring the interface with raspi-config and do a reboot to load the kernel drivers.
Check if the kernel drivers were loaded at startup:
lsmod | grep i2c
For a Raspi 3B the result should look something like this:
i2c_bcm2835 16384 0
i2c_dev 20480 0
CMD Line Tools
Then, install the following packages to do some basic i2c tinkering:
sudo aptitude -y install i2c-tools
The i2cdetect tool can be used to search the bus for nodes. But Obacht, not all nodes are detected this way.
sudo i2cdetect -y 1
Snake charming: Python programming
Then, install the following package(s) for i2c support in python:
sudo aptitude -y install python3-smbus
or smbus2 for some extended features:
sudo pip3 install smbus2