pyftdi is a pure Python driver for FTDI devices, providing access to their various functionalities including USB-to-serial, SPI, I2C, and GPIO. It acts as a wrapper around the `libftdi` C library, enabling cross-platform control of FTDI-based hardware. The current version is 0.57.1, with an active development cadence supporting recent Python versions.
pip install pyftdiVerified import paths — ran on the pinned version, not inferred.
This quickstart code demonstrates how to scan and list all detected FTDI devices connected to your system. It is a common first step to verify the `pyftdi` installation and device connectivity without requiring specific device URLs or complex operations. It relies on the underlying `libftdi` C library.
Install `libftdi` via your system's package manager (e.g., `sudo apt-get install libftdi1-dev` on Debian/Ubuntu, `brew install libftdi` on macOS) or build from source.
Create appropriate udev rules (Linux) or ensure the user has permission to access USB devices. Consult `libusb` or `libftdi` documentation for detailed setup. On Linux, temporarily running with `sudo` can confirm permission issues, but proper udev rules are recommended.
Use a tool like Zadig to install the WinUSB driver for your FTDI device. Be aware this may prevent other applications that rely on the standard FTDI drivers from working.
Upgrade your Python environment to Python 3.9 or newer. The current recommended minimum version is Python 3.9.
On Linux, configure udev rules to grant access to the USB device (e.g., `SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", MODE="0666"`, then `sudo udevadm control --reload-rules && sudo udevadm trigger`). On macOS, unload conflicting kernel extensions (e.g., `sudo kextunload -v -bundle com.apple.driver.AppleUSBFTDI` for older macOS versions). On Windows, ensure the correct libusb-based driver (e.g., `libusbK`) is installed using a tool like Zadig, replacing the default FTDI VCOM driver.Ensure that `libusb` is correctly installed and accessible on your system. On Linux, this usually means `libusb-1.0-0-dev` or similar packages. On Windows, copy `libusb-1.0.dll` to a location where Python can find it, such as `C:\Windows\System32` or the Python executable directory, after installing it via Zadig. You might also need to set `LD_LIBRARY_PATH` (Linux) or `DYLD_LIBRARY_PATH` (macOS) if `libusb` is in a non-standard location.
Verify the FTDI device is correctly connected and powered. Use the `ftdi_urls.py` script (shipped with `pyftdi`) to list available devices and their corresponding URLs. Ensure the URL used in your code precisely matches one of the detected devices (e.g., `ftdi:///1` for the first detected device, or `ftdi://ftdi:0x6014/1` using VID/PID). Check for other processes or drivers that might be claiming the device, preventing `pyftdi` from seeing it.
Close any other applications that might be using the FTDI device (e.g., serial terminals, other Python scripts). On some operating systems, you might need to identify and terminate processes holding the USB resource. If using virtual COM port drivers, ensure they are unloaded or replaced with a `libusb`-compatible driver. For multiprocessing scenarios, ensure that only one process attempts to open and control the device at any given time.
No dependency data recorded yet.