Pantilthat import error?


#1

Hi I have a RPi3 with Jessie installed and updated to the latest version. A pan-tilt hat with camera has also be added to the RPi.

I’ve tried to install pantilthat using the instructions (full installation) on https://github.com/pimoroni/pantilt-hat

I get the following errors when running smooth.py:

sudo python ./Pimoroni/pantilthat/examples/smooth.py
Traceback (most recent call last):
File “./Pimoroni/pantilthat/examples/smooth.py”, line 6, in
import pantilthat
File “/usr/lib/python2.7/dist-packages/pantilthat/init.py”, line 15, in
pantilthat = PanTilt(i2c_bus=SMBus(1))
File “/usr/lib/python2.7/dist-packages/pantilthat/pantilt.py”, line 51, in init
self._set_config()
File “/usr/lib/python2.7/dist-packages/pantilthat/pantilt.py”, line 63, in _set_config
self._i2c_write_byte(self.REG_CONFIG, config)
File “/usr/lib/python2.7/dist-packages/pantilthat/pantilt.py”, line 131, in _i2c_write_byte
raise IOError(“Failed to write byte”)
IOError: Failed to write byte

Does anyone know how to solve this issue?


#2

it seems to be a failure to communicate with the PIC chip over I2C… what do you get with:

i2cdetect -y 1

#3

I get:

sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --


#4

Solved - pantilthat board touching HDMI socket!

basic error - apologies and thank you for helping


#5

doh! no problem, glad it’s working… I have made that error before, now I have a bit of velcro covering the HDMI connector on all my Pis!


#6

Good tip - thank you


#7

Hi,
I’ve got a similar problem. Same traceback error as above but I detect the I2C addresses.
Any idea what might be causing this?
Thanks in Advance

sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40:40-- – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: 70 – – – – – – –