Ubuntu – Enable i2c on raspberry pi Ubuntu

18.04raspberrypi

I'm trying to enable i2c on my raspberry pi 3B running Ubuntu 18.04 server for arm64. The standard method (using raspi-config) fails because the command cannot be found nor installed (unable to locate package raspi-config). I realize raspi-config is just a convenience feature and theoretically I could edit some files by hand, couldn't find any tutorials for doing this on Ubuntu 18.04. Is there a guide somewhere to enable i2c on a pi 3 running Ubuntu 18.04 server?

Best Answer

  • Here is how I managed to install raspi-config on the Pi 3 B running Ubuntu 18.04 server for ARM64:

    wget https://archive.raspberrypi.org/debian/pool/main/r/raspi-config/raspi-config_20160527_all.deb -P /tmp
    apt-get install libnewt0.52 whiptail parted triggerhappy lua5.1 alsa-utils -y
    apt-get install -fy
    dpkg -i /tmp/raspi-config_20160527_all.deb
    

    After these commands, raspi-config (albeit seemingly an older version) was installed on the Pi. It does give a warning that it's only meant to work on Raspbian, but it seems to have done the job for me. After installing raspi-config, I had to mount the boot partition:

    sudo mount /dev/mmcblk0p1 /boot
    

    And then use sudo raspi-config, following the prompts to enable i2c (in Advanced Settings->i2c). Then ls /dev/i2c* responds with /dev/i2c-1, indicating that i2c is enabled. I then managed to detect my i2C device using sudo i2cdetect -y 1. I found the instructions for installing raspi-config in a script here.

  • Related Question