{"id":15538765,"url":"https://github.com/naoto64/piservoctl","last_synced_at":"2025-07-26T00:05:57.478Z","repository":{"id":57453047,"uuid":"304866933","full_name":"naoto64/piServoCtl","owner":"naoto64","description":"This is a servo motor control library for Raspberry Pi.","archived":false,"fork":false,"pushed_at":"2021-01-24T15:33:57.000Z","size":86,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T06:44:12.743Z","etag":null,"topics":["drive","pigpio","pwm","raspberry-pi","raspberrypi","servo","servo-motor"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/naoto64.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-17T11:55:31.000Z","updated_at":"2024-09-30T03:29:45.000Z","dependencies_parsed_at":"2022-08-29T06:51:16.818Z","dependency_job_id":null,"html_url":"https://github.com/naoto64/piServoCtl","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naoto64%2FpiServoCtl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naoto64%2FpiServoCtl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naoto64%2FpiServoCtl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naoto64%2FpiServoCtl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naoto64","download_url":"https://codeload.github.com/naoto64/piServoCtl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250462037,"owners_count":21434520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drive","pigpio","pwm","raspberry-pi","raspberrypi","servo","servo-motor"],"created_at":"2024-10-02T12:06:16.449Z","updated_at":"2025-04-23T15:41:21.709Z","avatar_url":"https://github.com/naoto64.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# piServoCtl\n\n## Overview\nThis is a servo motor control library for Raspberry Pi. In addition to normal servo motors, continuous rotation servo motors can also be controlled.\nIt utilizes hardware PWM. Therefore, the servo motor can be moved smoothly. Since you are using pigpio, you need to install pigpio and start pigpiod. To start pigpiod, you need to press the ````sudo pigpiod```` command or run pigpiod automatically.  \nIn addition, you can easily make an RC car by using two rotation servo motors. Use the Drive class to set the GPIO pin and servo motor. You can easily implement the steering function by using the steering method.  \n\n## Installation\n\n````shell:command.sh\nsudo pip3 install piServoCtl\n````\n\n## Usage\n\nFirst, start pigpiod (if it is not started). Then import the module. The module name is \"piservo\". Please note that it is different from the name when it was installed.  \n\n````shell:command.sh\nsudo pigpiod\n````\n\n### Servo\n\nThe easiest way is to use ````Servo(gpio)```` (where ````gpio```` is the GPIO pin number). Use GPIO that supports hardware PWM.  \nYou can control the servo motor with the ````write```` method.\n\n### Drive\n\nThe easiest way is to use ````Drive(left_gpio, right_gpio)```` (````left_gpio````, ````right_gpio```` enter the GPIO pin number). Use GPIO that supports hardware PWM. You can swap the ````left_gpio```` and ````right_gpio```` to flip the front and back of the car.  \nYou can control the car with the ````steering```` method.  \n\n## Demo\n\n### Servo\n\n````python:example.py\nfrom piservo import Servo\nimport time\n\nmyservo = Servo(12)\n\nmyservo.write(180)\ntime.sleep(3)\nmyservo.write(0)\ntime.sleep(3)\nmyservo.stop()\n````\n\n### Drive\n\n````python:example.py\nfrom piservo import Drive\nimport time\n\nmycar = Drive(12, 13)\n\nmycar.steering(50, 45)\ntime.sleep(1)\nmycar.steering(-50, 0)\ntime.sleep(1)\nmycar.stop()\n````\n\n## Method\n\n### Servo\n\n````python:example.py\nServo(gpio, min_value=0, max_value=180, min_pulse=0.5, max_pulse=2.4, frequency=50)\n````\n\ngpio: The gpio pin number to which the servo motor is connected.  \nmin_value: Minimum angle of servo motor (speed if it is a rotation servo motor).  \nmax_value: Maximum angle of servo motor (speed if it is a rotation servo motor).  \nmin_pulse: Minimum control pulse width of servo motor (millisecond).  \nmax_pulse: Maximum control pulse width of servo motor (millisecond).  \nfrequency: PWM frequency of the servo motor.  \n\nCreate an instance.  \n\n````python:example.py\nServo.write(value)\n````\n\nvalue: Servo motor drive angle (speed if it is a rotation servo motor).  \n\nDrives the servo motor.  \n\n````python:example.py\nServo.read()\n````\n\nRead the current value of the servo motor.\n\n````python:example.py\nServo.start()\n````\n\nStarts control of the servo motor.  \n\n````python:example.py\nServo.stop()\n````\n\nStops control of the servo motor.  \n\n### Drive\n\n````python:example.py\nDrive(left_gpio, right_gpio, min_value=-100, max_value=100, min_pulse=0.5, max_pulse=2.4, frequency=50)\n````\n\nleft_gpio: GPIO pin number to which the left servo motor is connected.  \nright_gpio: GPIO pin number to which the right servo motor is connected.  \nmin_value: Minimum speed of servo motor.  \nmax_value: Maximum speed of servo motor.  \nmin_pulse: Minimum control pulse width of servo motor (millisecond).  \nmax_pulse: Maximum control pulse width of servo motor (millisecond).  \nfrequency: PWM frequency of the servo motor.  \n\nCreate an instance.  \n\n````python:example.py\nDrive.steering(speed=50, direction=0)\n````\n\nspeed: Speed of movement.  \ndirection: Direction of movement.  \n\nIt moves in the specified direction at the specified speed.  \n\n````python:example.py\nDrive.stop()\n````\n\nStop moving.  \n\n````python:example.py\nDrive.start()\n````\n\nStart control.  \n\n````python:example.py\nDrive.set_speed(speed)\n````\n\nspeed: Speed of movement.  \n\nMoves in the previously specified direction and at the specified speed.  \n\n````python:example.py\nDrive.set_direction(direction)\n````\n\ndirection: Direction of movement.  \n\nMoves in the specified direction at the previously specified speed.  \n\n````python:example.py\nDrive.get_speed()\n````\n\nGet the current speed.  \n\n````python:example.py\nDrive.get_direction()\n````\n\nGets the current direction.  \n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaoto64%2Fpiservoctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaoto64%2Fpiservoctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaoto64%2Fpiservoctl/lists"}