Arduino-style motor control using Firmata
Project description
motor-like-arduino
Arduino-style DC motor control for Python.
Control motors connected to an Arduino running StandardFirmata using simple, intuitive commands inspired by the Arduino ecosystem.
from motor_like_arduino import Board
board = Board("/dev/ttyUSB0")
motor = board.attach_motor(2, 4, 11)
motor.forward(100)
Why motor-like-arduino?
Most Python motor libraries expose low-level motor driver details.
motor-like-arduino focuses on simplicity:
motor.forward(100)
motor.backward(50)
motor.stop()
motor.brake()
No PWM calculations.
No complicated setup.
Just simple motor control.
Installation
pip install motor-like-arduino
Quick Start
from motor_like_arduino import Board
import time
board = Board("/dev/ttyUSB0")
motor = board.attach_motor(
2, # Direction Pin 1
4, # Direction Pin 2
11 # PWM Pin
)
motor.forward(100)
time.sleep(2)
motor.stop()
board.close()
Multiple Motors
from motor_like_arduino import Board
board = Board("/dev/ttyUSB0")
left_motor = board.attach_motor(
2,
4,
11
)
right_motor = board.attach_motor(
5,
3,
10
)
left_motor.forward(50)
right_motor.forward(100)
Features
- Simple Arduino-inspired API
- Percentage-based speed control (0-100)
- Forward and backward movement
- Stop and brake support
- Multiple motors per board
- Optional TB6612FNG standby support
- Automatic speed validation
- Safe board shutdown
- Context manager support
- Custom exceptions
- Built on top of pyFirmata2
Supported Motor Drivers
Any motor driver that uses:
- 2 direction pins
- 1 PWM pin
Including:
- TB6612FNG
- L293D
- L298N
- MX1508
Optional TB6612FNG Standby Support
board = Board(
"/dev/ttyUSB0",
stby=6
)
board.sleep()
board.wake()
Included Examples
The repository includes ready-to-run examples:
- Single Motor Control
- Dual Motor Control
- Tank Drive
- Keyboard Control
Documentation
Complete documentation, API reference, guides, and examples are available in the project wiki.
Requirements
- Python 3.8+
- Arduino running StandardFirmata
Author
Vihaan Parlikar
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file motor_like_arduino-0.1.0.tar.gz.
File metadata
- Download URL: motor_like_arduino-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8400b04e35060d1bd9ee5b0aa0120b1e60cb5dd98c0fb6a50e7b04550112249
|
|
| MD5 |
139a09544c9f603d8fe8c9006b0e0c7b
|
|
| BLAKE2b-256 |
a3ad118a6ca9320d36822e45b9f0eda12212d3eb927be2f05cbeaa97c1d27773
|
Provenance
The following attestation bundles were made for motor_like_arduino-0.1.0.tar.gz:
Publisher:
publish.yml on vihaanvp/motor-like-arduino
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
motor_like_arduino-0.1.0.tar.gz -
Subject digest:
a8400b04e35060d1bd9ee5b0aa0120b1e60cb5dd98c0fb6a50e7b04550112249 - Sigstore transparency entry: 1822483857
- Sigstore integration time:
-
Permalink:
vihaanvp/motor-like-arduino@915fa5f7825e90b656158aa73c09de42990e45e5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/vihaanvp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@915fa5f7825e90b656158aa73c09de42990e45e5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file motor_like_arduino-0.1.0-py3-none-any.whl.
File metadata
- Download URL: motor_like_arduino-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5812141c54566bd9e0ba86405c6360d5ed01fda4c78714c111c10943a35de932
|
|
| MD5 |
317efdb88349af4fd934fa1bc792b2d3
|
|
| BLAKE2b-256 |
16cb64c339783c2ab2f8c3fa60bf2e271c98c401118151ad3dc8e88d0c0cba49
|
Provenance
The following attestation bundles were made for motor_like_arduino-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on vihaanvp/motor-like-arduino
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
motor_like_arduino-0.1.0-py3-none-any.whl -
Subject digest:
5812141c54566bd9e0ba86405c6360d5ed01fda4c78714c111c10943a35de932 - Sigstore transparency entry: 1822483890
- Sigstore integration time:
-
Permalink:
vihaanvp/motor-like-arduino@915fa5f7825e90b656158aa73c09de42990e45e5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/vihaanvp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@915fa5f7825e90b656158aa73c09de42990e45e5 -
Trigger Event:
release
-
Statement type: