Skip to main content

Provide a bidirectional connection to a serial interface via zeroMQ

Project description

PySoMQ: Python bindings for serial over ØMQ

This package utilizes the Python bindings of ØMQ in order to provide a lightweight and fast serial bidirectional PySerial communication interface.

Getting started

Run as permanent streaming service

If you want to run the SerialServer as a permanent streamer, please start the module with our specific parameters by

$ python -m pysomq --serial-port=YourSerialPort --serial-baudrate=YourBaudrate --timeout=1 --streaming-socket=tcp://*:5555 --listening-socket=tcp://*:5556

Stream from script

If you want to utilize the SerialServer within your own scripts, start streaming by using the following snippet with our parameters

import pysomq

serial_port = '/dev/ttyS0'
baudrate = 9600
stream_socket = 'tcp://*:5555'
listen_socket = 'tcp://*:5556'
timeout = 1
serial_server = pysomq.SerialServer(port='/dev/ttyS0', baudrate=baudrate,
                                    streaming_socket=stream_socket, listening_socket=listen_socket,

Receive streaming data

If you want to utilize the SerialServer within your own scripts, start receiving by using the following snippet with our parameters

import pysomq

stream_socket = 'tcp://localhost:5555'
listen_socket = 'tcp://localhost:5556'
timeout = 1

serial_client = pysomq.SerialClient(streaming_socket=stream_socket, listening_socket=listen_socket,
serial_client.write(b'my first line')
answer = serial_client.readline()    

Default values

The default values for calling the module or instantiating the classes are

  • --serial-port / port: /dev/ttyS0 for Linux and COM1 for Windows

  • --serial-baudrate / baudrate: 9600

  • --timeout / timeout: 1 second

  • --streaming-socket / streaming_socket: tcp://*:5555 respectively tcp://localhost:5555

  • --listening-socket / listening_socket: tcp://*:5556 respectively tcp://localhost:5556


You can get the latest source code from my Gitlab repository. For extension or bugfixes, please create a new branch with final merge request. Any contribution is appreciated!

Currently, the Linux and Windows versions are tested and verified. OSX and cygwin support has to be tested.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pysomq, version 0.12
Filename, size File type Python version Upload date Hashes
Filename, size pysomq-0.12-py3-none-any.whl (7.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pysomq-0.12.tar.gz (7.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page