[SOLVED] PivotPi Getting Started issue

Hello all,

I’m running a standard Raspbian Raspberry Pi 3 B+.

I did the “sudo bash install.sh” command, and everything seemed to install correctly.

I then tried to follow the simple Quick Start Python example and entered “from pivotpi import *” and “my_pivot = PivotPi()”.

I immediately received what looks like an I2C error:


my_pivot = PivotPi()
Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/smbus_cffi-0.5.1-py3.5-linux-armv7l.egg/smbus/smbus.py”, line 81, in open
self._fd = os.open(path, os.O_RDWR, 0)
FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/i2c-1’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/pivotpi-0.0.0-py3.5.egg/pivotpi.py”, line 46, in init
self.servo_controller = PCA9685.PCA9685(address=addr)
File “/usr/local/lib/python3.5/dist-packages/pivotpi-0.0.0-py3.5.egg/PCA9685.py”, line 74, in init
self._device = i2c.get_i2c_device(address, **kwargs)
File “/usr/local/lib/python3.5/dist-packages/pivotpi-0.0.0-py3.5.egg/I2C.py”, line 66, in get_i2c_device
return Device(address, busnum, **kwargs)
File “/usr/local/lib/python3.5/dist-packages/pivotpi-0.0.0-py3.5.egg/I2C.py”, line 95, in init
self._bus = smbus.SMBus(busnum)
File “/usr/local/lib/python3.5/dist-packages/smbus_cffi-0.5.1-py3.5-linux-armv7l.egg/smbus/smbus.py”, line 56, in init
self.open(bus)
File “/usr/local/lib/python3.5/dist-packages/smbus_cffi-0.5.1-py3.5-linux-armv7l.egg/smbus/smbus.py”, line 83, in open
raise IOError(e.errno)
OSError: 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “<pyshell#1>”, line 1, in
my_pivot = PivotPi()
File “/usr/local/lib/python3.5/dist-packages/pivotpi-0.0.0-py3.5.egg/pivotpi.py”, line 53, in init
raise IOError(“PivotPi not connected”)
OSError: PivotPi not connected


Oh yeah, I also rebooted my Pi…

Please help!

@stefane.lemay,
at first glance it seems I2C hasn’t been activated.

Start raspi-config by entering sudo raspi-config
Go to Interfacing Options, select I2C, and select Yes.

Does that help?
Cleo

Hello!

Oops. I forgot that I2C was something that needed activation in the Pi itself.

Thanks!

@stefane.lemay

In theory our install scripts are activating I2C for you but we’ve seen them fail once in a while. #blackmagic

Sorry about that.