firmata-client
A minimal Firmata protocol client for Arduino boards running StandardFirmata.
The only dependency is pyserial.
Requirements
- Python 3.13+
- Arduino flashed with StandardFirmata (included in the Arduino IDE: File → Examples → Firmata → StandardFirmata)
Installation
pip install firmata-client
Quick start
import logging
import sys
import time
from firmata_client import FirmataClient, PinMode
# Enable all firmata messages including serial traffic:
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s [%(name)s] %(levelname)s: %(message)s",
)
# Suppress serial traffic
logging.getLogger("firmata.serial").setLevel(logging.WARNING)
PORT = sys.argv[1] if len(sys.argv) > 1 else "COM8"
print(f"Connecting to {PORT} ...")
client = FirmataClient(PORT)
print("Querying board info ...")
info = client.query_board_info()
print(f" Firmware : {info['firmware']} v{info['version']}")
print(f" Pin count: {len(info['capabilities'])}")
print(f" Analog ch: {info['analog_mapping']}")
print("Read analog A0 ...")
A0_CH = 0
client.set_pin_mode(info["analog_mapping"][A0_CH], PinMode.ANALOG)
client.report_analog(A0_CH, True) # enable reporting
time.sleep(0.2)
print(f" A0 value : {client.analog_read(A0_CH)}")
print("Blink D13 several times ...")
D13 = 13
client.set_pin_mode(D13, PinMode.OUTPUT)
for _ in range(10):
client.digital_write(D13, True)
time.sleep(0.5)
client.digital_write(D13, False)
time.sleep(0.5)
client.close()
print("Done.")
API reference
FirmataClient(port, baudrate=57600, timeout=5.0)
| Method | Description |
|---|---|
close() |
Stop the reader thread and close the port. |
query_board_info() -> dict |
Fetch firmware name, protocol version, pin capabilities, and analog mapping. |
set_pin_mode(pin, mode) |
Set a pin mode (PinMode.INPUT/OUTPUT/ANALOG/PWM/SERVO). |
digital_write(pin, value) |
Write True/False to a digital output pin. |
digital_read(pin) -> int | None |
Read the latest cached digital value (requires report_digital). |
analog_write(pin, value) |
Write a PWM (0–255) or servo (0–180) value. |
analog_read(channel) -> int | None |
Read the latest cached analog value (requires report_analog). |
report_analog(channel, enable) |
Enable/disable streaming analog readings for a channel. |
report_digital(port, enable) |
Enable/disable streaming digital readings for a port. |
License
MIT
Metadata
Release files for firmata-client 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| firmata_client-0.1.1.tar.gz | 9.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| firmata_client-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.4 kB
Release files / firmata_client-0.1.1.tar.gz
| Download URL | firmata_client-0.1.1.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcc0cacb912664dcdbe41458a1ea476d4fd9a02b97d50f09fbfb3fe3798e8ae5
|
|
BLAKE2b-256 checksum How to use checksums |
dcdc30924f18341e2b472aa685851f9c3d79d1c1e5105e0c74be49850f331ad9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 25, 2026.
Transparency logRelease files / firmata_client-0.1.1-py3-none-any.whl
| Download URL | firmata_client-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fb1d973c621444e69d86e203f3ab3fa6cc6b3a31c8f6a745d1367ffbdc1f779
|
|
BLAKE2b-256 checksum How to use checksums |
a90355fbe7e493805851beaf38dddea3c0f5321709b80ff83784a309c8adc325
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 25, 2026.
Transparency log