Pantilthat - rotation range


#1

Just got my new PanTilt Hat setup and working. There appears to be a limit of 180 degrees on the pan servo. I am using it on a ‘tank chassis’ where for space reasons it is mounted '‘facing’ one side. I was expecting the pan range to be around 300 degrees which would give decent view when moving forward. The documentation does refer to serverpulse min and max but changing them doesn’t appear to change the rotation range.

So to questions:

  1. Can the pan servo be enabled to travel further than 180 degrees or can its start and end points be moved 90 degrees anti-clockwise.
  2. How/where do I change the settings and can I add additional ones if the range is extended beyond 180 degrees e.g. 45 degrees.

Thanks.


#2

They are 180 degree servos, they can move a little further, but tend to jitter a lot at the extreme ends of their range.


#3

Thanks for the quick reply, I’ll have a look in my ‘stock’ as I may have some that will go almost 360 which for my purpose would be better and avoid having to look at some surgery to turn the whole pantilt unit through 90. Assuming I have will the software allow me to adjust for the greater range?


#4

Lots of how to’s on how to make them rotate 360 degrees.


Assuming you don’t have any wires etc that will get damaged if you do it.

#5

Yes, the PanTilt HAT software lets you set an upper/lower range in milliseconds for the pulse.

At the moment, however, the servo range that the pan and tilt understand is fixed at 0-180, so if you configure the min and max pulse times to suit 360 degrees you’ll have to divide your desired rotation by 2.

IE: If you want to rotate to 360 you would need to send 180, which would be mapped to the maximum pulse time.

You can use servo_pulse_min(servo_index, value_in_ms) and servo_pulse_max(servo_index, value_in_ms) to adjust the min/max pulse times- where servo_index is either 1 or 2.


#6

Great, thanks for your help. I am going to use a web page front end so I will be able to set the relevant range for each direction there once I’ve worked out where the start pint should be.

…and it looked as though it was going to be install and go!!


#7

Replacement servo (fitec fs90r) installed. Now working on a python app which will be integrated into a cambot control script.
I have encountered a couple of difficulties:

  1. on the tilt servo (unchanged) a postive value for n between 40 and 140 to pantilthat.tilt(n) works with 40 looking up and 140 down. I had expected the range to be something like -45 to 45.
  2. and more important is sending any value for n to pantilthat.pan(n) results in the unit spinning until the camera ribbon cable runs out. This seems odd the first go used n=5 and a second n=2… I found a datasheet for the servo which says required pulse between 900 to 2100 mu sec. I tried n=0. 000015 but same result unit spins.
    I’m a novice with all of this whilst one isn’t a problem 2 is and I’m not sure how to solve it - any help would be appreciated.

#8

Since Python gives you access to tweak/overwrite almost anything you could try replacing the min/max values for servos, like so:

pantilthat.pantilthat._servo_min = [900, 2100]
pantilthat.pantilthat._servo_max = [900,2100]