# Pan Tilt HAT Issues

**URL:** <https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508>\
**Category:** Support\
**Created:** [December 6, 2016, 8:47pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508 "2016-12-06T20:47:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 6, 2016, 8:47pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/1 "2016-12-06T20:47:00Z")

</div>

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?

```auto
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!

```

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 6, 2016, 9:30pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/2 "2016-12-06T21:30:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [December 6, 2016, 9:38pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/3 "2016-12-06T21:38:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 6, 2016, 9:42pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/4 "2016-12-06T21:42:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 6, 2016, 10:05pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/5 "2016-12-06T22:05:52Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 7, 2016, 10:10am UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/6 "2016-12-07T10:10:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 7, 2016, 6:01pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/7 "2016-12-07T18:01:51Z")

</div>

Here it is running [smooth.py](http://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](http://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?

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 7, 2016, 8:49pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/9 "2016-12-07T20:49:06Z")

</div>

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:

![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex016/uploads/pimoroni/original/2X/0/02fd332b0c3c3cccf567e4244dc357189fadec11.gif)

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [December 7, 2016, 9:17pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/10 "2016-12-07T21:17:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 7, 2016, 9:18pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/11 "2016-12-07T21:18:08Z")

</div>

Running on a fairly uptodate Pi3.

I’ll give the repo a go.

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

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 7, 2016, 9:38pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/12 "2016-12-07T21:38:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 8, 2016, 7:17pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/13 "2016-12-08T19:17:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [December 9, 2016, 9:59am UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/14 "2016-12-09T09:59:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stuartiannaylor](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@stuartiannaylor](https://forums.pimoroni.com/u/stuartiannaylor)\
**Post date:** [December 9, 2016, 10:32am UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/15 "2016-12-09T10:32:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 9, 2016, 10:45am UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/16 "2016-12-09T10:45:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 9, 2016, 4:46pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/17 "2016-12-09T16:46:29Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [December 9, 2016, 5:00pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/18 "2016-12-09T17:00:49Z")

</div>

> [@major\_tomm](#):
>
> Curiously the timeout stuff does seem to work on the pan servo?

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.

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 9, 2016, 5:12pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/19 "2016-12-09T17:12:21Z")

</div>

Nice one, that works.

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

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [December 9, 2016, 5:28pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/20 "2016-12-09T17:28:09Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [December 9, 2016, 6:03pm UTC](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508/21 "2016-12-09T18:03:13Z")

</div>

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

[Next page](https://forums.pimoroni.com/t/pan-tilt-hat-issues/3508.md?page=2)
