Python wrapper for the Keithley 6485 picoammeter (example code and convenience functions).
This repository contains a small instrument wrapper around the Keithley 6485 used to simplify simple current measurements, buffering, and averaging. It includes a ready-to-run example script: picometer_6485/examplePicometer6485.py.
- Connect to a Keithley 6485 via a serial/COM port
- Take buffered time-series measurements
- Compute mean values from several buffered readings
- Small, dependency-light codebase intended for quick measurements and experimentation
- Python 3.8+ (3.10 or newer recommended)
- pyserial
- numpy
- matplotlib (optional, used by the example script)
Install dependencies with pip:
pip install pyserial numpy matplotlib- Connect the Keithley 6485 to your PC and note the COM port (Device Manager → Ports (COM & LPT)).
- Edit
picometer_6485/examplePicometer6485.pyand set the correct port (for exampleCOM3orCOM14). - Run the example script:
python .\picometer_6485\examplePicometer6485.pyThe example script demonstrates creating a PM6485 instance, taking a buffered reading (time and values), plotting results with matplotlib, computing a mean, and closing the connection.
From the example examplePicometer6485.py:
- Create instrument object:
from KeithleyInstruments import PM6485
pm = PM6485(port='COM14')- Take a buffered reading (returns two arrays: time and measured current values):
time, values = pm.buffer(count=100, buffer_delay=0.1, buffer_itime=20e-3)- Compute a mean value (single averaged current):
mean_value = pm.getMeanValue(count=10, buffer_delay=0.02, buffer_itime=10e-3)- Close the connection when finished:
pm.close()Notes: the exact method names and parameter meanings are implemented in src/KeithleyInstruments.py. If you need additional features (range control, integration time presets, trigger configuration), add them there or open an issue.
- Parameter names in the example (such as
buffer_delayandbuffer_itime) are time-related. Before relying on a specific numeric scale (seconds vs milliseconds), check the docstrings insrc/KeithleyInstruments.pyto confirm units used by the wrapper. The example uses SI-style floats (e.g.0.1for 100 ms,20e-3for 20 ms) but older code sometimes uses millisecond integers — verify for your installed version.
- Permission / access errors: ensure no other program (or another Python process) has the COM port open.
- Wrong COM port: verify the correct COM port in Device Manager and update the example.
- No measurements / NANs: check instrument front-panel settings (range, zero check) and cabling.
- If
pyserialraises issues, upgrade or reinstall it:pip install --upgrade pyserial.
If you run into problems, inspect src/KeithleyInstruments.py for implementation details and adjust settings there.
This project doesn't include automated hardware tests. If you add unit tests, keep them separate from tests that require hardware; mock the serial port where possible.
Small PRs are welcome. Typical improvements:
- Add explicit unit tests (mocked serial) for parsing and buffering logic
- Add documentation for each method in
src/KeithleyInstruments.py - Add a LICENSE file (MIT recommended) if you want permissive reuse
MIT License
Copyright (c) 2025 Lars Jelschen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.