# PanTilt HAT with SG90 servo (MIN and MAX values)

**URL:** <https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747>\
**Category:** Support\
**Created:** [January 14, 2020, 6:21pm UTC](https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747 "2020-01-14T18:21:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cypresstwist](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/cypresstwist/32/6093_2.png) [@cypresstwist](https://forums.pimoroni.com/u/cypresstwist)\
**Post date:** [January 14, 2020, 6:21pm UTC](https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747/1 "2020-01-14T18:21:15Z")

</div>

Hi. I bought the PanTilt HAT (module only) and one of my sevos is a SG90. Does anyone have the MIN and MAX values for this servo to use in my pantilt.py?

Thank you.

---

<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:** [January 14, 2020, 6:31pm UTC](https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747/2 "2020-01-14T18:31:38Z")

</div>

If its a 180 degree of motion servo its -90 to +90, 0 is centered. I do believe those are the ones Adafruit uses in the pan tilt kit and those ones are 180 degree servo’s.  
If your building one of the Adafruit pan tilts make sure you center the servo’s before you put it all together.

---

<div class="post-metadata">

**Author:** ![cypresstwist](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/cypresstwist/32/6093_2.png) [@cypresstwist](https://forums.pimoroni.com/u/cypresstwist)\
**Post date:** [January 14, 2020, 6:40pm UTC](https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747/3 "2020-01-14T18:40:27Z")

</div>

I have a Waveshare PanTilt HAT and it didn’t to what I needed it to do so I’ve bought this PanTilt Hat. The module only. One of the Waveshare servos is a SG90. The other one works as expected but i would need the values for it in the pantilt.py file:

```
def __init__ (self,
             enable_lights=True,
             idle_timeout=2, # Idle timeout in seconds
             light_mode=WS2812,
             light_type=RGB,
             servo1_min=575, # works fine
             servo1_max=2325, # works fine
             servo2_min=800, # this is a SG90 
             servo2_max=2400, # does not work as expected
             address=0x15,
```

---

<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:** [January 14, 2020, 6:56pm UTC](https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747/4 "2020-01-14T18:56:59Z")

</div>

Ah, OK, I didn’t do it that way. I used the pan and tilt commands. To center my two servo’s I do this.

```auto
import pantilthat

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

```

From here, [http://docs.pimoroni.com/pantilthat/](http://docs.pimoroni.com/pantilthat/)

# Pan

`pantilthat.` `pan` ( _angle_ )

Set position of servo 1 in degrees.

Parameters: **angle** – Angle in degrees from -90 to 90

---

<div class="post-metadata">

**Author:** ![cypresstwist](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/cypresstwist/32/6093_2.png) [@cypresstwist](https://forums.pimoroni.com/u/cypresstwist)\
**Post date:** [January 14, 2020, 7:00pm UTC](https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747/5 "2020-01-14T19:00:46Z")

</div>

My servo is not the one that comes with the Pimoroni kit. Therefore its pulse values are not

```auto
servo_min=575,
servo_max=2325

```

which you later translate to degrees.

---

<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:** [January 14, 2020, 7:58pm UTC](https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747/6 "2020-01-14T19:58:00Z")

</div>

SG90’s are what came with mine. Anyway, it looks like I don’t have the info you need. You may have to wait for someone else to reply or play with the values.

---

<div class="post-metadata">

**Author:** ![cypresstwist](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/cypresstwist/32/6093_2.png) [@cypresstwist](https://forums.pimoroni.com/u/cypresstwist)\
**Post date:** [January 14, 2020, 8:22pm UTC](https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747/7 "2020-01-14T20:22:10Z")

</div>

Weird. Are you sure they’re not MG90S?

---

<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:** [January 14, 2020, 9:21pm UTC](https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747/8 "2020-01-14T21:21:37Z")

</div>

Yes, I have a Pan Tilt I just recently bought from Adafruit. It arrived broken and I have one servo removed. It’s marked SG90. If you go to the Adafruit product page it states, It also comes fully assembled with two Micro Servos (SG-90 or SG-92 type) included.

> **[Mini Pan-Tilt Kit - Assembled with Micro Servos](https://www.adafruit.com/product/1967)**
>
> This fully-assembled pan-tilt kit is the perfect way to give your project full range motion with two micro servos. The pan-tilt can rotate roughly 180° from side-to-side and can ...

I didn’t give it much thought and just used the pan tilt commands, and it worked out very well for me. I usually just try the easy route first. I’m using mine in Motion Eye OS. I’ll be getting a second one at some point to replace the defective one I got from Adafruit.

I have one already in service that I bought here. Just FYI.

---

<div class="post-metadata">

**Author:** ![cypresstwist](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/cypresstwist/32/6093_2.png) [@cypresstwist](https://forums.pimoroni.com/u/cypresstwist)\
**Post date:** [January 14, 2020, 9:53pm UTC](https://forums.pimoroni.com/t/pantilt-hat-with-sg90-servo-min-and-max-values/12747/9 "2020-01-14T21:53:50Z")

</div>

Thank you for letting me know.
