PivotPi on RPi Zero W - Outdated Platform.py Problem

I am bringing up a new R-Pi Zero W that will interface to some servo motors using PivotPi. I started with a new raspbian stretch img and went through PivotPi installation. After starting the system with the PivotPi and motors attached, I made the basic test:

import pivotpi
pp = pivotpi.PivotPi()

This error occurred: RuntimeError: Could not determine default I2C bus for platform.

The stack trace included this line:
File “/usr/local/lib/python3.5/dist-packages/Adafruit-0.0.0-py3.5.egg/I2C.py”, line 65, in get_i2c_device

I cracked Adafruit-0.0.0-py3.5.egg open and learned that it includes Platform.py that is outdated. It does not identify a BCM2835 chip as a valid chip to run on. It should!

Out of curiousity I looked inside pivotpi-0.0.0-py3.5.egg and found that it has an updated version of Platform.py that allows for BCM2835, and this code should be used instead of the one in the Adafruit egg. The pivotpi egg contained a superset of the files in the Adafruit egg, so it seemed like it could replace the Adafruit egg.

I renamed Adafruit-0.0.0-py3.5.egg to Adafruit-0.0.0-py3.5.egg.rotten to prevent Python3 from loading it. Presumably the pivotpi egg would be used instead.

When I repeated my test, the error was corrected and now I can use the pivotpi controller.

I believe that if a customer tries to use a Pi Zero W with a BCM2835 chip, they will have the problem I had. My workaround, getting rid of Adafruit-0.0.0-py3.5.egg, should be made permanent.

Hi @ssh751,

Yes, we know of this problem - actually before this the PivotPi did not work on the RPi Zero W at all so we added this updated version of Platform to it.

What we haven’t done is remove the old Platform module. That’s because the Adafruit package gets installed in multiple places (if my memory serves me well) and we’d need to remove it multiple times.

So, for the time being, we decided that anyone that uses Raspbian For Robots and tries out the PivotPi on a RPI Zero W would come to the forum and tell us their problem so we can solve it - and there aren’t that many that fit this description, so this can be addressed on a case-by-case basis.

With that being said, I’m gonna put this in our backlog and have a look at it when we’ll improve the installing/updating mechanism of our robots.

Thank you for your report!

Robert

Thanks for the reply, Robert. I wondered if my Pi Zero use case for the Pivot Pi might be an unusual one. I see now that it is!

I made a cat toy to wave stuff around with a gimbal powered by two servos, and I did not want to tear apart any of my Pi 3 projects. A Pi Zero drew the short straw and has to play with the cat.

It turns out that the cat either completely destroys this ‘toy’, or she ignores it completely. So I guess I will recycle it into the parts bin. The toy, not the cat.

Thanks again for your response!

Steve H.