PySerial
PySerialDocs

PySerial Docs

Cross-platform Python library for serial port communication. Works with Arduino, Raspberry Pi, and industrial devices on Windows, Linux, and macOS.

PySerial lets Python talk to anything connected over a serial port: Arduino boards, GPS modules, industrial sensors, barcode scanners, CNC controllers, Modbus devices. It works on Windows, Linux, macOS, and Raspberry Pi with the same API.

import serial

ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
ser.write(b'Hello\n')
print(ser.readline().decode().strip())
ser.close()

Get Started

Platforms & Devices

Go Deeper

Community & Support

Join the Discord community for help, discussions, and to connect with other developers using PySerial.

On this page

Deploy your PySerial test scripts with TofuPilot

Trusted by Lyft, Cobot, Pacific Defense, and more.

TofuPilot provides dashboards and analytics to track serial device testing at scale.

TofuPilot
Get Started