A simple USB to servo adapter that works.
Project description
A Simple USB to Servo Adapter that works.
The Servo Adapter allows python programs to connect to RC Servos using off the shelf low cost boards such the Raspberry Pico or SparkFun Pro Micro - RP2040. The Servo Adapter appears on the computer as a serial port (no device installation required) and acts as a USB to Servo bridge, with the servo_adapter
Python package providing an easy to use API.
For example, the diagram below shows the wiring of a servo to one of the 8 servo outputs of the Servo adapter.
Highlights
- Support up to 8 independent servo channels.
- Hardware based 1us resolution servo PWM timing generation.
- Supports Windows/Mac/Linux.
- Uses low cost low cost off-the-shelf boards as adapters.
- Does not require driver installation (it appears on the computer as standard a serial port).
- Comes with an easy to use Python API.
- Easy to modify/extend and to adapt to new hardware.
- Permissive open source license. Comercial use OK, sharing and attribution not required.
- Provides additional 8 general purpose auxilary input/output signals.
Python API Example
Package installation
pip install servo-adapter --upgrade
In the example below, we use an Servo Adapter that control a servo that is connected to servo output 0.
import time
from random import randrange
from servo_adaptr import ServoAdapter
# Serial port name. Adapt to your system.
port = "/dev/tty.usbmodem1101"
# Connect to adapter and enable PWM servo out 0.
adapter = ServoAdapter(port=port)
adapter.set_servo_state(0, True)
while True:
# Random pulse width in the range 1000us to 2000us.
pw_us = 1000 + randrange(1000 + 1)
adapter.set_servo_pulse_width(0, pw_us)
time.sleep(1.0)
Documentation
Full documentation is available at https://servo-adapter.readthedocs.io/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file servo_adapter-0.0.3.tar.gz
.
File metadata
- Download URL: servo_adapter-0.0.3.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79e3813d966e88f94d51382a337807335a12a911c27c6d43f8a6e74354997884 |
|
MD5 | db4cbe72a5214296b9dfd7e386fc6819 |
|
BLAKE2b-256 | 2868dc1e12ade69d37355ffd8fac7d42dae6ae48fd3f4d2c8fe5e83fe64426e1 |
File details
Details for the file servo_adapter-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: servo_adapter-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c61a03c094092871ebf3070a084dfd0ccf2ef469f9c8e0a99710ca0277ea5d58 |
|
MD5 | f3b55d34f73d45c6c316ed761420050b |
|
BLAKE2b-256 | 7bc92bcfdd704b392c84ef95e48706f7fea42756595ce77482aea15a3617b3d0 |