PyAR488
PyAR488 is a Python package to interact with AR488 GPIB-USB
interface boards.
It provides a thin abstraction layer over the serial interface to
simplify communication with GPIB instruments.
Installation
pip install PyAR488
Requirements
- Python 3.6+
pyserial(installed automatically as a dependency)
Quickstart
from PyAR488.PyAR488 import AR488
# Open the interface (replace COM5 with your serial port)
interface = AR488("COM5")
# Set GPIB address and read
interface.address(22)
print(interface.read())
Using PyAR488 in Custom Instrument Classes
A recommended pattern is to inject the AR488 interface into your instrument classes:
from PyAR488.PyAR488 import AR488
class HP3468A:
def __init__(self, gpib_address: int, interface: AR488):
self.address = gpib_address
self.interface = interface
def read_measurement(self):
self.interface.address(self.address)
return self.interface.read()
interface = AR488("COM5")
meter = HP3468A(22, interface)
reading = meter.read_measurement()
print(reading)
Safer Pattern: Enforcing Address Before Each Operation
If multiple instruments share the same interface, ensure the GPIB address is set before every read/write:
class MyInstrument:
def __init__(self, interface: AR488, address: int):
self.interface = interface
self.address = address
def read(self, message: str = ""):
self.interface.address(self.address)
return self.interface.read(message)
This prevents accidental cross-talk when the interface address is changed elsewhere in your code.
Debugging
Enable debug mode to print communication traffic:
interface = AR488("COM5", debug=True)
Support
- Source code: https://github.com/Minu-IU3IRR/PyAR488
- Issue tracker: https://github.com/Minu-IU3IRR/PyAR488/issues
Release files for PyAR488 1.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyar488-1.7.2.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyar488-1.7.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.4 kB
Release files / pyar488-1.7.2.tar.gz
| Download URL | pyar488-1.7.2.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c822cdea87174adcaf8f8b3f401e9958516b48ae790f0fbede4fb91f97fb5988
|
|
BLAKE2b-256 checksum How to use checksums |
1146a86c75a708c2d88f5eaa0d76d84965661f8551f1501e7660ff9085a104fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / pyar488-1.7.2-py3-none-any.whl
| Download URL | pyar488-1.7.2-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f71c7880a95c155f7d2e23558aec33e1110a6a679f409f1ba81cb9533682eeb2
|
|
BLAKE2b-256 checksum How to use checksums |
43aa3c1cc2c7840512c9dc649804b90d09545a255a8f0c5228261ce28a358bbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|