# Pantilthat does not move with raspberry pi 3

**URL:** <https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061>\
**Category:** Support\
**Created:** [November 1, 2019, 9:48pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061 "2019-11-01T21:48:39Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![drroboto](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@drroboto](https://forums.pimoroni.com/u/drroboto)\
**Post date:** [November 1, 2019, 9:48pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/1 "2019-11-01T21:48:39Z")

</div>

Here is the code:  
import pantilthat as pth  
import cv2  
import time

pth.clear()

pth.servo\_enable(1, False)  
pth.servo\_enable(2, False)  
time.sleep(2)

pth.servo\_enable(1, True)  
pth.servo\_enable(2, True)

pth.servo\_one(0)  
time.sleep(5)  
pth.servo\_two(0)

pan\_pos = pth.get\_pan()  
tilt\_pos = pth.get\_tilt()  
print("pan angle = ", pan\_pos)  
print("tilt angle = ", tilt\_pos)

pth.servo\_one(-45)  
time.sleep(5)  
pth.servo\_two(45)

pan\_pos = pth.get\_pan()  
tilt\_pos = pth.get\_tilt()  
print("pan angle = ", pan\_pos)  
print("tilt angle = ", tilt\_pos)

output is  
pan angle = 0  
till angle = 0  
pan angle = -45  
tilt angle = 45

BUT there is no movement.  
You can also see that the tilt range is very small. This is as far up as it will go. Downb is horizontal.

 ![tilt-up](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/9/92ad1444296e875b9039c0fd315a86a73cb04b85.jpeg)

---

<div class="post-metadata">

**Author:** ![Caperjack1953](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/caperjack1953/32/7923_2.png) [@Caperjack1953](https://forums.pimoroni.com/u/Caperjack1953)\
**Post date:** [November 1, 2019, 11:00pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/2 "2019-11-01T23:00:06Z")

</div>

hello,and welcome to pimoroni help, a bit new here my self , anyway just wondering if you did the full install of the pan tilt and if you tried any of the available examples on pimoroni Github ,[https://github.com/pimoroni/pantilt-hat](https://github.com/pimoroni/pantilt-hat)

---

<div class="post-metadata">

**Author:** ![drroboto](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@drroboto](https://forums.pimoroni.com/u/drroboto)\
**Post date:** [November 1, 2019, 11:06pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/3 "2019-11-01T23:06:52Z")

</div>

hello  
I am using buster and thonny.  
I downloaded from

> **[pantilthat](https://pypi.org/project/pantilthat/)**
>
> Python library for driving Pimoroni PanTiltHAT!

---

<div class="post-metadata">

**Author:** ![drroboto](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@drroboto](https://forums.pimoroni.com/u/drroboto)\
**Post date:** [November 1, 2019, 11:23pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/4 "2019-11-01T23:23:05Z")

</div>

I also ran timeout.py from examples and no movement. I swapped the cables and I get pan movement but no tilt movement.

As soon as program starts, tilt lowers to bottom (horizontal) position and then does not move.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [November 2, 2019, 8:51am UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/5 "2019-11-02T08:51:16Z")

</div>

Hat firmly pressed down on the GPIO header?  
Double check your servo plugs going to the Hat. If one of more gets flipped the GND and PWM will be reversed. It won’t hurt the servo, it just won’t work.

---

<div class="post-metadata">

**Author:** ![drroboto](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@drroboto](https://forums.pimoroni.com/u/drroboto)\
**Post date:** [November 2, 2019, 6:09pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/6 "2019-11-02T18:09:49Z")

</div>

Yes hat is firmly pressed down, no gap.  
I only attached one servo to servo one plug and left other plug empty.  
I ran mini version of timeout.py with movement of -40, 0, 40.  
Test success with pan servo in servo one plug  
With tilt servo in servo one plug, initial power causes servo to droop down and then no other movement.

With all power off, I can only move the tilt servo a maximum of 90 degrees and it is not binding anywhere. I loosened wing and moved servo. still only 90 degree movement.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [November 2, 2019, 6:47pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/7 "2019-11-02T18:47:34Z")

</div>

Bummer but it sounds like you got a dud servo. The following link will let you contact Pimoroni tech support. I’d put a link to this thread in that support e-mail.  
[https://shop.pimoroni.com/pages/contact-us](https://shop.pimoroni.com/pages/contact-us)

I just today ordered a pan tilt full kit. I have 5 Motion Eye setups, mostly Pi 3A+'s. It will go on one of those setups. Motion Eye now has support built in for the Pan Tilt Hat. I’ll do all my testing from Raspbian first, just to be sure it all works with no issues. Its standard operating procedure for me to test what I can from the get go.

---

<div class="post-metadata">

**Author:** ![drroboto](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@drroboto](https://forums.pimoroni.com/u/drroboto)\
**Post date:** [November 2, 2019, 7:10pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/8 "2019-11-02T19:10:27Z")

</div>

Thanx. I just sent them an email. My goal was to connect the pantilhat with a camera to my PI which is then attached to an arduino robot that I built. I want to teach it to search for an object that I want found.

Of course none of my arduino servos are compatible with the pantilthat servos.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [November 2, 2019, 7:19pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/9 "2019-11-02T19:19:45Z")

</div>

What Arduino servo’s do you have? I thought a servo was a servo? I own a couple of Arduino’s, just FYI. ;) All my servo’s are 5V and PWM controlled. I “don’t think” the servo cares if the PWM pulse is 5V or 3.3V?

EDIT: Unless you mean mini versus another size?

---

<div class="post-metadata">

**Author:** ![drroboto](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@drroboto](https://forums.pimoroni.com/u/drroboto)\
**Post date:** [November 16, 2019, 9:19pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/10 "2019-11-16T21:19:29Z")

</div>

I have received a replacement tilt servo so this topic can be closed. Thanx to pimoroni and this forum for your help.

note: the replacement servo is is a 360 vs 180 and by a different vendor. It does not behave the same during testing. If I have a problem, I shall open a new topic.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [November 17, 2019, 10:06am UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/11 "2019-11-17T10:06:36Z")

</div>

I hope you get it all sorted out. I got my Full Pan tilt Kit the other day. My servos weren’t centered correctly in the Pan Tilt. They weren’t much off but I’m a bit fussy that way so I took a few screws out and centered everything up. They worked flawlessly in python once centered. It was a real PITA to get it to work in Motion Eye OS though. I eventually sorted that out after a few days of sticking with it.

---

<div class="post-metadata">

**Author:** ![calleblyh](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@calleblyh](https://forums.pimoroni.com/u/calleblyh)\
**Post date:** [November 17, 2019, 1:36pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/12 "2019-11-17T13:36:21Z")

</div>

They worked flawlessly in python once centered, you said.

How did you check they were not perfectly centered. It was a mechanical readjustment to center I assume. What type servos are you using ?  
I am about to give “buttons” a go with MotionEye next week  
TIA  
Carl

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [November 17, 2019, 2:06pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/13 "2019-11-17T14:06:37Z")

</div>

I bought the Full Pan Tilt kit from Pimoroni. The servos would be what ever Adafruit installed as I believe they make the Pan tilt part, and Pimoroni makes the Hat.

I used this code to find my viewing positions for Motion Eye

```auto
from picamera import PiCamera
from time import sleep
import pantilthat

pantilthat.pan(0)
pantilthat.tilt(0)

camera = PiCamera()
camera.rotation = 180
camera.resolution = (1280, 720)

camera.start_preview()
sleep(10)
camera.stop_preview()

```

pan(0) and tilt(0) should put the servos in their center position. For me that didn’t center up the Pan Tilt. It was a little to one side and up slightly. Being careful not to move the servos, with the power off, I took a few screws out, and moved the bits that connect to the splined shafts on the servos. I basically reassembled it so it was all centered. Then ran the above again to confirm it was all centered the way I wanted it.

The above code will move the servo to what is entered for pan tilt, then do a 10 second preview of what the camera see’s. I put my Pan Tilt where it was going to be used and set my camera resolution to what i was going to be using. I use 1280 by 720.  
Then I just played with the Pan Tilt values until it was pointing where I wanted, and wrote those values down. Wash rinse and repeat for the three viewing angles I wanted.  
I just opened that file in Idle. I can make a quick edit, save and run. Over and over again.

If your actually wanting the Pan Tilt to move in a specific direction via the Action Button. Thats a bit trickier.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [November 17, 2019, 2:15pm UTC](https://forums.pimoroni.com/t/pantilthat-does-not-move-with-raspberry-pi-3/12061/14 "2019-11-17T14:15:05Z")

</div>

This is a link to my issue on the Motion Eye GitHub page

> <https://github.com/motioneye-project/motioneyeos/issues/2197>
>
> Yes, I confirm that I have read the CONTRIBUTING guide before opening this issue….
> 
> Yes, I confirm that I have read the FAQ before opening this issue.
> 
> motionEyeOS Version is 0.41
> 
> I am running motionEyeOS version: 20190911.
> 
> I am using the following board/model: Raspberry PI 3A+).
> 
> I am using the following type of camera: MMAL, 
> 
> My camera model is: Raspberry Pi V2
> 
> My motionEyeOS unit is connected to the network via: WiFi.
> 
> I am using the following peripherals that I consider relevant to this issue:
> Pimoroni Pant Tilt Hat Full kit.
> 
>  
> I am trying to add my Action Button files to control my Pan tilt Hat to my SD card but can't find the location I'm supposed to save them too? I put my card in a card reader and plugged that into my Pi 4B usb port.
> The guide says /etc/motioneye/ but I cannot find an etc/motioneye folder? And there are several etc folders? Which drive / partition do I look at, and do I have to create the motioneye folder myself? Any help or guidance on this will be greatly appreciated. If its in the FAQ I missed it somehow, I did look there first.
> https://github.com/ccrisan/motioneye/wiki/Action-Buttons

And this is a link I got after I had sorted it all out myself

> <https://github.com/motioneye-project/motioneyeos/pull/2016>
>
> \- Tested only on a raspberry pi 3B
> \- Implementation copied from here: https://s…tackoverflow.com/questions/55660233/how-to-integrate-pimoroni-pan-tilt-hat-with-motioneye
> 
> \### ssh into rpi and run these to create files and set permisions:
> \`\`\`
> mkdir /data/etc/python-scripts/
> cat \<\<EOF \>\>/data/etc/left\_1
> \#!/bin/bash
> /usr/bin/python /data/etc/python-scripts/left.py
> EOF
> cat \<\<EOF \>\>/data/etc/right\_1
> \#!/bin/bash
> /usr/bin/python /data/etc/python-scripts/right.py
> EOF
> cat \<\<EOF \>\>/data/etc/up\_1
> \#!/bin/bash
> /usr/bin/python /data/etc/python-scripts/up.py
> EOF
> cat \<\<EOF \>\>/data/etc/down\_1
> \#!/bin/bash
> /usr/bin/python /data/etc/python-scripts/down.py
> EOF
> cat \<\<EOF \>\>/data/etc/preset1\_1
> \#!/bin/bash
> /usr/bin/python /data/etc/python-scripts/reset.py
> EOF
> chmod +x /data/etc/left\_1 /data/etc/right\_1 /data/etc/up\_1 /data/etc/down\_1 /data/etc/preset1\_1
> cat \<\<EOF \>\>/data/etc/python-scripts/left.py
> \#!/usr/bin/python
> 
> import time
> import pantilthat
> 
> currentPos = pantilthat.get\_servo\_one()
> newPos = currentPos +20
> if newPos \>= 80: newPos = 80
> pantilthat.servo\_one(newPos)
> time.sleep(1)
> EOF
> cat \<\<EOF \>\>/data/etc/python-scripts/right.py
> \#!/usr/bin/python
> 
> import time
> import pantilthat
> 
> currentPos = pantilthat.get\_servo\_one()
> \#print (currentPos)
> newPos = currentPos - 20
> if newPos \<= -80: newPos = -80
> pantilthat.servo\_one(newPos)
> time.sleep (1)
> EOF
> cat \<\<EOF \>\>/data/etc/python-scripts/up.py
> \#!/usr/bin/python
> 
> import time
> import pantilthat
> 
> currentPos = pantilthat.get\_servo\_two()
> \#print (currentPos)
> newPos = currentPos - 20
> if newPos \<= -80: newPos = -80
> pantilthat.servo\_two(newPos)
> time.sleep (1)
> EOF
> cat \<\<EOF \>\>/data/etc/python-scripts/down.py
> \#!/usr/bin/python
> 
> import time
> import pantilthat
> 
> currentPos = pantilthat.get\_servo\_two()
> newPos = currentPos +20
> if newPos \>= 80: newPos = 80
> pantilthat.servo\_two(newPos)
> time.sleep(1)
> EOF
> cat \<\<EOF \>\>/data/etc/python-scripts/reset.py
> \#!/usr/bin/python
> 
> import time
> import pantilthat
> 
> pantilthat.servo\_one(0)
> pantilthat.servo\_two(0)
> time.sleep(1)
> EOF
> \`\`\`

And this is a thread I started here.

> [@Pan Tilt Hat Motion Eye OS action buttons](https://forums.pimoroni.com/t/pan-tilt-hat-motion-eye-os-action-buttons/12186/9):
>
> I’m not sure what is going on? I’m running Motion Eye on a Pi 3A+ which should be more than capable. What I’m seeing now, is when I click a button, the pan tilt moves, but doesn’t move all the way to where I want it to go? How is that possible? If I keep clicking the button it will stutter over and eventually stop at the correct position? I didn’t have this issue when testing it in Raspbian. It did the one quick move to the desired position I had in my python code. I used this code from picam…
