Pan Tilt HAT Issues


#1

Just tried to install my Pan Tilt HAT using the one liner, the library installs fine, but none of the examples appear where they should.

Here’s the output from my terminal if that helps.

Looking at it, it seems to have failed to create the folder, do I need to run it as sudo?

This script will install everything needed to use
the Pimoroni Pan-Tilt HAT

Always be careful when running scripts and commands
copied from the internet. Ensure they are from a
trusted source.

If you want to see what this script does before
running it, you should run:
\curl -sS https://get.pimoroni.com/pantilthat

Note: Pan-Tilt HAT requires I2C communication

Do you wish to continue? [y/N] y

Checking environment...
Updating apt indexes...
.........
Reading package lists...
.........

Checking hardware requirements...

I2C already enabled

Checking packages required by I2C interface...
smbus installed and up-to-date


Pan-Tilt HAT comes with examples and documentation that you may wish to install.
Performing a full install will ensure those resources are installed,
along with all required dependencies. It may however take a while!

Do you wish to perform a full install? [y/N] y
mkdir: cannot create directory ‘/home/pi/Pimoroni/pantilthat’: Permission denied
Checking install requirements...

Checking for dependencies...

Installing python-pantilthat_0.0.1_all.deb...
dpkg: error processing archive /tmp/pimoroni.bw2KMu/python-pantilthat_0.0.1_all.deb (--install):
 cannot access archive: No such file or directory
Errors were encountered while processing:
 /tmp/pimoroni.bw2KMu/python-pantilthat_0.0.1_all.deb

python-pantilthat_0.0.1_all.deb is required
Installing python3-pantilthat_0.0.1_all.deb...
dpkg: error processing archive /tmp/pimoroni.DOcDMN/python3-pantilthat_0.0.1_all.deb (--install):
 cannot access archive: No such file or directory
Errors were encountered while processing:
 /tmp/pimoroni.DOcDMN/python3-pantilthat_0.0.1_all.deb

python3-pantilthat_0.0.1_all.deb is required

Installing Pan-Tilt HAT library for Python 2...

Requirement already up-to-date: pantilthat in /usr/local/lib/python2.7/dist-packages
Cleaning up...

Installing Pan-Tilt HAT library for Python 3...

Requirement already up-to-date: pantilthat in /usr/local/lib/python3.4/dist-packages
Cleaning up...

Checking for additional software...


Downloading examples and documentation...

Cloning into 'pantilt-hat'...
remote: Counting objects: 49, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 49 (delta 4), reused 35 (delta 2), pack-reused 0
Unpacking objects: 100% (49/49), done.
Checking connectivity... done.
bash: line 897: cd: /home/pi/Pimoroni/pantilthat: No such file or directory

Resources for your Pan-Tilt HAT were copied to
/home/pi/Pimoroni/pantilthat

All done!

Enjoy your Pan-Tilt HAT!

#2

Ok, so I deleted the “Pimoroni” folder and retried, seemed to work fine. Maybe something screwy happened with folder permissions?


#3

possibly. Could it be you passed it to bash with sudo at an earlier time (this one or another script)? this would have created the parent directory with restricted permissions with subsequent failure to populate it.


#4

Yeah, I have a Pi setup script which does a lot of installing, pulling of git repos and Pimoroni one-liners. I suspect I ran that with sudo at some point. Cheers for the help.


#5

@RogueM My next question is then, how smooth should the motion be? Running the smooth example the movement seems very jittery?

Upon further inspection, tilting in 1 degree increments back and forth seems ok, but panning in 1 degree increments, there seems to be big ‘skips’. Especially when it moves through the 45 degree point, it pauses, then skips forward to catch up. :S


#6

I’ll try and get some videos this evening that show the ‘problem’.


#7

Here it is running smooth.py

Things seem to have improved now I’m using a 2.5A official supply instead of my supposed 3A USB hub ports.

Still getting the occassional judder when panning through 45 degrees (-90 is far left). Tho’ running a script which just has it panning to random positions it seems OK, so might just be an oddity with smooth.py. Would be interesting to know what other people’s experience has been?

Tho it does appear that tilting to -90 causes it to sit there vibrating, I imagine it’s going a little bit too far?


#9

Cheers for that, think I got to the bottom of the folder issues.

Just trying to figure out if I can get it to move as smooth as it appears here:


#10

My test setup also moves buttery smooth, what version of the Pi are you running it on?

I’ve made some changes to the lib in GitHub that time-out the servo drive signal by default, so no more jitter when you hit the extremes of the servo range. It also includes tweaks to the range thanks to @stuartiannaylor.

Are you comfortable grabbing and installing a library from GitHub?


#11

Running on a fairly uptodate Pi3.

I’ll give the repo a go.

Edit: Just ran smooth.py from the repo, it seemed to made a big difference! Will do a bit more testing and report back!


#12

Tilting anything past -65 causes it to sit there vibrating :S


#13

@Gadgetoid is there a fix/calibration I can apply to stop it doing that?


#14

I think I need to make some changes to the range of the pan servo, the practical limit of its range is perhaps -80 to +80 but since these servos vary slightly it’s difficult to pin down.

I’m not sure if yours is a case of a faulty servo, or just being driven into the top of the Pan servo and being physically unable to move further.

With the code in GitHub, by default it shoudn’t sit vibrating for more than 2 seconds before the servo is shut off.


#15

dunno why but the updates on github we got the idle_timeout python script but the changes to the lib didn’t come through.

I tried a pip… --upgrade just never got round to git clone or just pasting.


#16

Thanks. Will take another look at it tonight and see whether it does indeed shut off. Physically it goes from pointing directly up to directly down so that’s fine - I’ll just have to remember that my tilt range is more like -65 to 90.

I wonder where 0 would put it? I will investigate.


#17

Can’t seem to see any noticeable difference with the timeout stuff. It sits there vibrating regardless of what I do.

I tweaked servo_pulse_min to 800 for servo 2 (tilt) and that lets me enter tilt(-90) without any of the vibrations. Curiously it seems I can go a up to about 2450 at the other end. That puts tilt(0) at perfectly vertical.

Is this the sign of a defective servo?

Curiously the timeout stuff does seem to work on the pan servo?


#18

Yup, that’s a bug! I just came across it today and thought it was odd, but didn’t make the leap to “Oh dear, bug!” Found and fixing.


#19

Nice one, that works.

Is the fact I have to trim my tilt servo min to 800 a sign of a dodgy servo?


#20

It could well be! Does it now give you a smooth range of motion?

I’ve also now pushed up some support for various pixel types into this experimental branch: https://github.com/pimoroni/pantilt-hat/tree/pixel-types

This is better than the old approach which didn’t make much sense and didn’t support GRB or RGBW types.


#21

Tilting is smooth, but panning is still seems judder-y, especially as it moves through the 45 degrees position.