I2C Permissions

Ever tried running a python script as a cron job or as an snmp script that involves I2C access only to get 

Error (13) Permission denied

There are two fixes one temporary and one permanent.

-Temporary
sudo chmod a+rw /dev/i2c-0 for older RPIs
or
sudo chmod a+rw /dev/i2c-1 for newer RPIs (>= B+)

This is however lost after reboot so you might consider the following method

-Permanent
edit /lib/udev/rules.d/60-i2c-tools.rules
and change the i2c line to

KERNEL==”i2c-0″ , GROUP=”i2c”, MODE=”0660″
KERNEL==”i2c-[1-9]*”, GROUP=”i2c”, MODE=”0666″

Reboot and you are ok

Be the first to comment

Leave a Reply

Your email address will not be published.


*