Pan tilt hat : pan OK , tilt a bit lazzy

Hi,
i am using pan tilt hat + camera on a PI3A+, inside a bird cage to monitor nests.
i drive it through a wifi vnc connection on an ipad or PC.

works …almots great.
i defined 4 zones for the various nests
and use pantilt to go directly from one nest to another to view and takes pictures.
or i can move the camera step by step using arrows keys.

input is done through keyboard touches ( pygames). works great also.

a classic code allow to go slowly (so as not to frigthen birds) to a specific coordinate (X,Y) X and Y being pantilt angles.
always works great for the pan moves but not often for the tilt one ( same code …).

to have tilt actually goes the the Y coordinate i allways need to stimulate it again using up and/or arrows ( that moves 1 angle up or down).

same again , just using arrows (moves by one increment) . pan allways moves left or right just after i pressed the arrow key. tilt is very capricious. will not move for few strokes, then, at some point, with no pattern, skip to the angle…

is that tilt behavior a problem for some of you also ? what can be the problem ?

here is the code to move to a specific coodinate ( very classic)

def vers_coordonnees(zone):
global anglehor
global anglevert
# se dirige vers les nouvelles coorodonnées lentement
(hor,vert) = zone

#  vers la coordonnée horizontale
if hor < anglehor:
    while anglehor != hor :
        anglehor -=1
        mypantilt.pan(anglehor)
        sleep(0.1)
elif hor > anglehor:
     while anglehor != hor :
        anglehor +=1
        mypantilt.pan(anglehor)
        sleep(0.1)
mypantilt.servo_enable(1,False)

# vers la coordonnée verticale
 if vert < anglevert:
    while anglevert != vert :
        anglevert -=1
        mypantilt.tilt(anglevert)
        sleep(0.1)
elif vert > anglevert:
     while anglevert != vert :
        anglevert +=1
        mypantilt.tilt(anglevert)
        sleep(0.1)

any idea ?
thanks

I have two Pan Tilt setups. The Pimoroni hat works great, the Adafruit pan tilt part not so much. Both of mine had one or more servo’s that were not centered correctly. This caused them to hit the stops and actually damaged one of my servo’s. All is fine after rebuilding it following Adafruits assembly guide. I’d check to see if that servo is binding or something?
I have run the smooth.py example on mine and it worked as advertised. Right now I’m doing it via action buttons in Motion Eye OS, at normal speed. I get a little jitter sometimes when they stop but that’s about it.

pantilt-hat/smooth.py at master · pimoroni/pantilt-hat · GitHub

thanks ! i did buy the pantilt and the hat separatly ( i didn’t know when i bought the pantilt that it needed a hat ! :-)
the hat is from pimoroni.
it is possible then, as you mentionned, that i need to get back to recheck it. i hoped for a code bug or a misuse/misconfiguration that would allow me to correct "soft"ly without taking the Pi out of the cage ( not so easy).
I ll try the smooth.py before taking it out.

also, as i do not use those servos heavily, they are powered through the Pi. That works fine but i get a low energy warning on the screen. i guess it doesn’t help.
thanks for your help

You can run them without the hat using PWM. The Hat makes it a whole lot easier though, IMHO, and provides a nice base to mount the Pan tilt on.
Mine are on a Pi 3A+ using the official Micro USB 2.5A power supply. No undervolt warnings.
If you have extended the cord on your power supply, that’s likely why your getting the undervolt warning. Too much of a voltage drop through the cable.