# Robot Hat for Raspberry Pi and continuous rotation servos

**URL:** <https://forum.sunfounder.com/t/robot-hat-for-raspberry-pi-and-continuous-rotation-servos/1074>\
**Category:** Robotic kit for Raspberry Pi\
**Created:** [May 3, 2024, 7:07pm UTC](https://forum.sunfounder.com/t/robot-hat-for-raspberry-pi-and-continuous-rotation-servos/1074 "2024-05-03T19:07:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![djmanning](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.sunfounder.com/djmanning/32/623_2.png) [@djmanning](https://forum.sunfounder.com/u/djmanning)\
**Post date:** [May 3, 2024, 7:07pm UTC](https://forum.sunfounder.com/t/robot-hat-for-raspberry-pi-and-continuous-rotation-servos/1074/1 "2024-05-03T19:07:59Z")

</div>

I have a Robot Hat for Raspberry Pi attached to an RPi v4 running latest RaspiOS. The hat functions correctly, including the speaker, except for continuous rotation servos. No matter what the setting that I use with the examples, I cannot send a command to get them to stop once they’ve started. I’ve read through the forums and nothing similar has been posted. The examples are all for fixed position.  
From other forum posts for other servo Hats (like Adafruit), I know it’s possible but I’m not sure the Servo library for this hat has that function built in.

Thanks,

DJ

---

<div class="post-metadata">

**Author:** ![SunFounder\_Moderator](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SunFounder\_Moderator](https://forum.sunfounder.com/u/SunFounder_Moderator)\
**Post date:** [May 6, 2024, 8:57am UTC](https://forum.sunfounder.com/t/robot-hat-for-raspberry-pi-and-continuous-rotation-servos/1074/2 "2024-05-06T08:57:58Z")

</div>

Please provide us with the problem video to [service@sunfounder.com](mailto:service@sunfounder.com) so that we can analyze and resolve the issue.  
Our robot hat servo library does not have this functionality built-in. You need to run the example code to make the servo work.  
We suggest reinstalling the Raspberry Pi system and then reinstalling the robot hat library. After that, check if the servo starts working automatically upon startup.

---

<div class="post-metadata">

**Author:** ![djmanning](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.sunfounder.com/djmanning/32/623_2.png) [@djmanning](https://forum.sunfounder.com/u/djmanning)\
**Post date:** [May 10, 2024, 7:59pm UTC](https://forum.sunfounder.com/t/robot-hat-for-raspberry-pi-and-continuous-rotation-servos/1074/3 "2024-05-10T19:59:57Z")

</div>

I think you answered the question by saying “Our robot hat servo library does not have this functionality built-in.” I’m curious though because even by sending a 1500 msec pulse should stop the continuous rotation servo. I’ve not been able to get the servo to stop moving no matter how much I adjust the nulling potentiometer on the servo. My example for two servos attached is:

from robot\_hat import Servo

# Create Servo object with PWM object

servo0 = Servo(“P0”)  
servo1 = Servo(“P1”)

servo0.pulse\_width\_time(2500)  
servo1.pulse\_width\_time(2500)

This is pulled from the example in: [https://docs.sunfounder.com/projects/robot-hat-v4/en/latest/api\_servo.html](https://docs.sunfounder.com/projects/robot-hat-v4/en/latest/api_servo.html)

Could there be a way possibly using the PWM class instead?

Thanks,

DJ

---

<div class="post-metadata">

**Author:** ![SunFounder\_Moderator](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SunFounder\_Moderator](https://forum.sunfounder.com/u/SunFounder_Moderator)\
**Post date:** [May 14, 2024, 7:53am UTC](https://forum.sunfounder.com/t/robot-hat-for-raspberry-pi-and-continuous-rotation-servos/1074/4 "2024-05-14T07:53:24Z")

</div>

Do you have other Raspberry Pi board? If so, you can try replacing the current one with a different Raspberry Pi and see if the same issue occurs. If the problem persists, it’s possible that there might be an issue with the Robot HAT pins.

---

<div class="post-metadata">

**Author:** ![danfagerburg](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@danfagerburg](https://forum.sunfounder.com/u/danfagerburg)\
**Post date:** [April 2, 2025, 6:41pm UTC](https://forum.sunfounder.com/t/robot-hat-for-raspberry-pi-and-continuous-rotation-servos/1074/5 "2025-04-02T18:41:58Z")

</div>

Do you know what a continuous servo motor is? Your replies indicate that you do not.

?

---

<div class="post-metadata">

**Author:** ![SunFounder\_Moderator](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SunFounder\_Moderator](https://forum.sunfounder.com/u/SunFounder_Moderator)\
**Post date:** [April 3, 2025, 6:37am UTC](https://forum.sunfounder.com/t/robot-hat-for-raspberry-pi-and-continuous-rotation-servos/1074/6 "2025-04-03T06:37:02Z")

</div>

It appears the default PWM frequency calculated by robot\_hat may not be precise enough. To improve accuracy, please try manually configuring the PWM timer’s prescaler and period values according to the example provided in the attached image.

 ![screenshot_2025-04-03_14-17-49](https://canada1.discourse-cdn.com/flex029/uploads/sunfounder/original/2X/9/96e7c90e0db34decff7887168bab6eadd22946d5.png)
