Pantilthat does not move with raspberry pi 3

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


pth.servo_enable(1, False)
pth.servo_enable(2, False)

pth.servo_enable(1, True)
pth.servo_enable(2, True)


pan_pos = pth.get_pan()
tilt_pos = pth.get_tilt()
print("pan angle = ", pan_pos)
print("tilt angle = ", tilt_pos)


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.

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 ,

I am using buster and thonny.
I downloaded from

I also ran 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.

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.

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

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.

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.

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.

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?

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.

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.

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

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

from picamera import PiCamera
from time import sleep
import pantilthat


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


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.

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

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

And this is a thread I started here.