JoyIT_MotoPi
Python library for controlling the Joy-IT RB-Moto3 motor/servo expansion board on a Raspberry Pi. The board uses a PCA9685 16-channel, 12-bit PWM controller connected via I²C. The library provides access to the PWM channels, a shared frequency setting, raw PWM counter values and microsecond pulse generation.
This implementation communicates directly with the controller through smbus2 and uses gpiozero for the optional board-enable GPIO. It does not require Adafruit CircuitPython PCA9685. The included servo example uses adafruit-circuitpython-motor, which is a separate package.
Requirements
- Raspberry Pi with Python 3.9 or later and the I²C interface enabled.
- Joy-IT RB-Moto3 connected to the appropriate Raspberry Pi GPIO/I²C interface.
- Python packages:
smbus2,gpiozeroandadafruit-circuitpython-motor(declared inpyproject.toml). - The Linux user must have access to the I²C device and the configured GPIO pin.
Enable I²C using sudo raspi-config (Interface Options → I2C), then reboot if prompted.
Installation
You can install this library from PyPI. To install it for the current user on your Raspberry Pi, use the following command:
pip3 install JoyIT_MotoPi
Install library into virtual environment:
python -m venv --system-site-packages env
source env/bin/activate
pip3 install JoyIT_MotoPi
API reference
| API | Description |
|---|---|
MotoPi(...) |
Open the PWM controller and initialize its channels. |
motopi.frequency |
Read or set the frequency shared by all 16 PWM outputs, in Hz. |
motopi.channels[index] |
Get a channel (0 through 15); slices are also supported. |
channel.duty_cycle |
Read/set a 16-bit duty-cycle value, from 0 (off) to 65535 (fully on). |
channel.frequency |
Read-only shared frequency; cannot be changed per channel. |
motopi.set_pwm(channel, on, off) |
Write raw PWM on/off counter values (0–4095; 0x1000 is a special full-on/full-off flag). |
motopi.write_microseconds(channel, duration) |
Set the high pulse duration in µs at the current PWM frequency; 0 turns the channel off. |
motopi.all_off() |
Turn off all outputs. |
motopi.reset() |
Reinitialize the controller and clock selection; turns all channels off. |
motopi.deinit() / motopi.close() |
Turn outputs off and release resources. |
[!Note] Prefer the
with MotoPi(...) as motopi:form: it callsdeinit()when the block ends, including on exceptions. Without a context manager, callmotopi.close()explicitly. When the library opens the I²C bus itself, it closes that bus; when you pass an existing bus object, it leaves ownership of that bus with the caller.
License and attribution
See LICENSE. Portions of the implementation are adapted from the Adafruit CircuitPython PCA9685 library; the corresponding copyright and MIT license notices are retained in the source files.
Metadata
Release files for JoyIT-MotoPi 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| joyit_motopi-1.0.0.tar.gz | 8.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| joyit_motopi-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.7 kB
Release files / joyit_motopi-1.0.0.tar.gz
| Download URL | joyit_motopi-1.0.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d154af3dfffc6536466ac3db76cb5325cc067bc983baff0e365934a604d8b038
|
|
BLAKE2b-256 checksum How to use checksums |
6ba254afbcfc21670d334e1e5a671716203075cfeadb2febbf5c8404d75fbeff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / joyit_motopi-1.0.0-py3-none-any.whl
| Download URL | joyit_motopi-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49d4562dc71ff14b4b23cfd0075ece01b46bd83443e7f24442a54b939199d325
|
|
BLAKE2b-256 checksum How to use checksums |
cd9e20468ac44c6761ac45299a474fd28b5c304921579515e4595dd6f0919202
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|