Cannot import Explorerhat pro

Hi, thanks for any help in advance - go easy I`m new to RPi and Linux in general

I have seen other people with the exact same problem but have never seen a solution on a forum so far

I can turn on the 4 leds and make them flash on the explorerhat, but when I came to set the outputs it wouldn`t work. I quickly realised I needed to do some things first to import explorer hat into python, but whatever instructionsI follow, it seems that I can never find i2c, although it is supposed to be ready.

using:

sudo i2cdetect -y 1

it just shows a message like Error: Could not open file /dev/i2c-1’ or/dev/i2c/1’: No such file or directory

I tried to enable i2c using raspi-config and it appears to work.

I have done:

curl get.pimoroni.com/i2c | bash
sudo apt-get install python-smbus
sudo apt-get install python-pip
sudo pip install explorerhat

everything appears to be ok but trying to imprt explorerhat brings up

Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python2.7/dist-packages/explorerhat.py”, line 624, in
_cap1208 = captouch.Cap1208()
File “/usr/local/lib/python2.7/dist-packages/captouch.py”, line 187, in init
self.i2c = SMBus(i2c_bus)
IOError: [Errno 2] No such file or directory

I have disabled device tree I think,

device-tree=

in config.txt I have
dtparam=i2c_arm=on

in /etc/modules I have
i2c-dev
i2c-bcm2708

lsmod shows
Module Size Used by
i2c_dev 6027 0
i2c_bcm2708 4990 0

whatever I do there is never i2c in dev.

Sorry for lack of clarity or any ridiculous noob errors, but this is my first day with the RPi I am an absolute beginner.

Thanks.

G.

This is another one of those instances of Raspbian just not wanting to enable I2C that I’ve never managed to diagnose. Have you tried a fresh reinstall of Raspbian to see if it fares any better?

It looks like you’ve tried basically everything else, do you see any devices when you:

ls /dev/i2c*

Hi, thanks for the help.

ls /dev/i2c*

it say something like

cannot access /dev/i2c*: No such file or directory

this is despite everything seeming to work properly up to this point.

If I can`t enable i2c, does this restrict me from using all the lovely HATs that are available?

I find it strange that I can still make the 4 LEDs on the explorer pro turn on or flash using python without importing explorerhat.

I have not tried a fresh install of Raspbian yet no - it was a pre-installed versionon the SD card, should I just download a new copy from somewhere and try that?

The LEDs on Explorer Pro are just connected to regular GPIO pins- so they’re easy enough to control without the library itself.

Before doing a full reinstall, have you tried also updating your Raspbian card to the latest version? You can do this by running:

sudo apt-get update
sudo apt-get upgrade

And then rebooting- this will take a while!

If all else fails, to reinstall Raspbian grab the image from here: https://www.raspberrypi.org/downloads/raspbian/

And follow the steps here that are relevant to your desktop/laptop operating system: https://www.raspberrypi.org/documentation/installation/installing-images/README.md

Thanks so much for your help, I will try this next chance I get to have a play.

Remove the ‘dtparam=’ from config.txt (in other words enable device tree)
The dtparam=i2c_arm=on should then load the i2c-bcm2708 module and enable i2c at boot.
To get the /dev/i2c* entry you will still have to load the i2c-dev module.
You already have i2c-dev in /etc/modules.
Make sure i2c-dev is not in the blacklist (file /etc/modprobe.d/raspi-blacklist.conf).
If not loaded, you can still load it manually: ‘sudo modprobe i2c-dev’.