I found an error in the last instruction which could not be completed as the specified file is not present in the download, it turns out the correct instruction should be:
sudo ./facetracker.py
However, having now run that I get:
Traceback (most recent call last):
File “./facetracker.py”, line 4, in
from paltile import *
File “/home/pi/PanTiltFacetracker/pantile.py”, line 1, in
from Adafruit_PWM_Servo_Driver import PWM
File “/home/pi/PanTiltFacetracker/Adafruit_PWM_Servo_Driver.py”,
line 5, in
from Adafruit_I2C_import Adafruit_I2C
File “/home/pi/PanTiltFacetracker/Adafruit_I2C.py”, line 3, in
Thank you, just tried this, it installed fine, then ran:
sudo ./facetracker.py
Response now:
Traceback (most recent call last):
File "./facetracker.py", line 4, in <module>
from pantile import *
File "/home/pi/PanTiltFacetracker/pantilt.py", line 1, in <module>
from Adafruit_PWM_Servo_Driver import PWM
File "/home/pi/PanTiltFacetracker/Adafruit_PWM_Servo_Driver.py", line 11, in <module>
class PWM:
File "/home/pi/PanTileFacetracker/Adafruit_PWM_Servo_Driver.py", line 35, in PWM
general_call_i2c = Adafruit_I2C(0x00)
File "/home/pi/PanTiltFacetracker/Adafruit_I2C.py", line 36, in __init__
self.bus = smbus.SMBus(busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
IOError: [Errno 2] No such file or directory
yes, I have the same. The problem is the probe for board revision not being adequate for the Pi 3.
I would simply comment out line 36 and uncomment line 35 in Adafruit_I2C.py, so that the init method reads:
def __init__(self, address, busnum=-1, debug=False):
self.address = address
# By default, the correct I2C bus is auto-detected using /proc/cpuinfo
# Alternatively, you can hard-code the bus version below:
# self.bus = smbus.SMBus(0); # Force I2C0 (early 256MB Pi's)
self.bus = smbus.SMBus(1); # Force I2C1 (512MB Pi's)
# self.bus = smbus.SMBus(busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
self.debug = debug
Thank you, the application now runs, however what should I be seeing ? The camera window is visible and I see myself, but when I move around shouldn’t the arm track me? Nothing is happening, no servo’s are moving.
Yes, that’s very much the idea I believe. But there’s a bunch of reasons that would lead to nothing happening, I think you need to tell us more about how you got to this point, maybe check your wiring too, I guess it can’t hurt.
… that said I’m not the best person to answer from here on as I don’t have the kit, nor a clear idea on testing procedure for simple servo action, bypassing the camera tracking aspect itself (which I suspect is where you’ll find the answer).
I hear you, but checking that your servo board works in a more stripped down environment might be useful as a first step. For example, try the following and see if that shines some light on the matter:
I’m not sure this will help, but I spent an hour assembling a version of the Face Tracker that uses the latest Adafruit libraries.
I still recommend you try the simpletest(.py) mentioned in the Adafruit tutorial, but if that works and you feel so inclined you could try the revision of facetracker.py (or to be more accurate pantilt.py) I knocked together:
note that you must install the adafruit libraries as follows:
well, it’s an unnecessary step if you followed the tutorial I linked to earlier, but if you go straight to my repo to try then you’ll need to install them.
As stated earlier, I don’t have a board to test, so I have no idea if it works at all, but I’m hopeful it would - at the very least - detect the correct bus on your Pi3, and do as much as the current version. YMMV.
I downloaded the updated PanTiltFacetracker from your link and ran ./pantilt.py I got:
Tiny mini Pan/Tilt library
By default, tilt is on channel 1
and pan is on channel 0
: No such file or directory
./pantilt.py: line 7: syntax error near unexpected token ‘(’
./pantilt.py: line 7: ‘servo = PWM.PCA9685()’
pantilt.py does not have an interpreter specified, so you can’t just run it that way… at the very least you’d need to call it as an argument to python. Otherwise it will be treated as a shell script, resulting in what you see.
But anyhow, you should preferably just call facetracker.py as normal, and not pantilt.py, since that is the program you are trying to get running ultimately:
sudo python ./facetracker.py
… I couldn’t access your pictures, they show up as private here.
I think you should be able to upload the pic here. But I’ll check in the morning to be sure you have the right to do so, as I’ve never really looked into it.
Ok, I have a seperate 5V power supply wired as shown in the picture, apart from an initial power on jitter, where the servo’s seem to move randomly for a few milliseconds, there is no other activity, when I start:
sudo python facetracker.py
I get a video image showing what the camera is looking at but no servo activity at all.