Skip to main content

PyFirmata2 turns your Arduino into a data acquisition card controlled by Python.

Up to 1kHz precise sampling at the analogue ports for digital filtering.

Just upload the default firmata sketch into your Arduino and you are all set.

pyFirmata2 is an updated version of pyFirmata which replaces loops with callbacks. Instead of unreliable “sleep” commands in a loop the Python application registers callbacks which are then called every time after new data has arrived. This means for the analogue channels the callbacks are called at the specified sampling rate while the digital ports call the callback functions after a state change at the port (from 0 to 1 or 1 to 0).

This API has been used in my Digital Signal Processing (DSP) class to practise realtime filtering of analogue sensor data. Examples can be viewed on the YouTube channel of the class: https://www.youtube.com/user/DSPcourse

Installation

Upload firmata

Install the Arduino IDE on your computer: https://www.arduino.cc/en/Main/Software

Start the IDE and upload the standard firmata sketch into your Arduino with:

File -> Examples -> Firmata -> Standard Firmata

Install pyfirmata2

The preferred way to install is with pip / pip3. Under Linux:

pip3 install pyfirmata2 [--user] [--upgrade]

and under Windows/Mac type:

pip install pyfirmata2 [--user] [--upgrade]

You can also install from source with:

git clone https://github.com/berndporr/pyFirmata2
cd pyFirmata2

Under Linux type:

python3 setup.py install

Under Windows / Mac:

python setup.py install

Usage

Please go to https://github.com/berndporr/pyFirmata2 for the documentation and in particular the example code.

Example code

It’s strongly recommended to check out the example code at https://github.com/berndporr/pyFirmata2/tree/master/examples to see how the callbacks work.

Credits

The original pyFirmata was written by Tino de Bruijn. The realtime sampling / callback has been added by Bernd Porr.

Metadata

Release files for pyFirmata2 2.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyFirmata2 2.5.1
File Size Uploaded
pyFirmata2-2.5.1.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyFirmata2 2.5.1
File Interpreter ABI Platform
pyFirmata2-2.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.2 kB

Release files / pyFirmata2-2.5.1.tar.gz

Download URL pyFirmata2-2.5.1.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5ef8fc5caec084e72c6b7f199362a743854c9bd63a93cacbaa0c7bbb99efef75
BLAKE2b-256 checksum
How to use checksums
e21660f33d9b37dccffeeabdc46c4ea751ddeb585fc72ac47243eecfdf718079
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / pyFirmata2-2.5.1-py3-none-any.whl

Download URL pyFirmata2-2.5.1-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b5479b152afb6902b5c7c458d4fd496957776db98287e4b317c21269ebe908e
BLAKE2b-256 checksum
How to use checksums
2b3bfca22decea624feffb82f5feb3e898a167b0b0e9f93614faec86a2a13e66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

2.5.1 This release

2 release files

2.5.0

2 release files

2.4.5

2 release files

2.4.4

1 release file

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

3 release files

2.2.0

3 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.1

1 release file

2.0.0

1 release file

1.1.9

1 release file

1.1.8

1 release file

1.1.7

1 release file

1.1.6

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.9.9

3 release files

0.9.8

3 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

3 release files

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page