This example implements a TCP/IP to serial port service that works with multiple ports. (uses python-avahi and. README.rst pySerial Overview. This module encapsulates the access for the serial port.
Hello community, I have myself a pi and a serial connection to a device, that is outputting data to the pi. When I load up minicom I can see the data on the port coming up just fine so my wiring and 3v3 is all correct.
What I am trying to do with this data is store it in a txt or log file in real time and constantly. So any data coming in is recorded in the text file in real time.
The txt file will be accessed by a PHP, or C script to get the data into the program and outputted to a display.
I want the program to run in a loop, and the data reading to run in a loop. How can I do this.
I run the shell command. yet my text file updates randomly and sometimes doesn't update.
Can anyone help me use the shell to record the data to the text file whenever it comes in.
Latest version
Last released:
Convert serial device to tcp socket.
Project description
Instalation
You can install from pip:
# pip install serial2tcp
or manual:
# git clone git://github.com/mosquito/serial2tcp.git# cd serial2tcp# python setup.py install
Redirect USB-Serial
For redirect /dev/ttyUSB0 with baudrate 9600 bps and 192.168.2.1 can connect to that:
# serial2tcp -p /dev/ttyUSB0 -b 9600 -l 0.0.0.0 –allow-list=‘192.168.2.1’
Help
Usage: serial2tcp [options]
Simple Serial to Network (TCP/IP) redirector.
WARNING: You have to allow connections only from the addresses in the“–allow-list” option. e.g. –allow-list=‘10.0.0.1, 172.16.0.1, 192.168.0.1’NOTICE: This service supports only one tcp connection per instance.
--version | show program’s version number and exit |
-h, --help | show this help message and exit |
-p SERIAL, --port=SERIAL | |
Serial port, a number, defualt = ‘/dev/tty0’ | |
-b BAUDRATE, --baud=BAUDRATE | |
Baudrate, default 115200 | |
-r, --rtscts | Enable RTS/CTS flow control (default off) |
-x, --xonxoff | Enable software flow control (default off) |
-P PORT, --localport=PORT | |
TCP/IP port on which to run the server (default 9100) | |
-l LISTEN, --listen=LISTEN | |
Listen address on which to run the server (default‘127.0.0.1’) | |
--access-list=ACL | |
List of IP addresses e.g ‘127.0.0.1, 192.168.0.2’ |
Thanks to
This is based on http://www.cs.earlham.edu/~charliep/ecoi/serial/pyserial-2.2/examples/tcp_serial_redirect.py
Release historyRelease notifications
0.5.1
0.5
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size serial2tcp-0.5.1.tar.gz (3.3 kB) | File type Source | Python version None | Upload date | Hashes |
Hashes for serial2tcp-0.5.1.tar.gz
Algorithm | Hash digest |
---|---|
SHA256 | dc185a692f4e574d77d46fd17b3dfd9bb15387c054216da8870e1d893ff9db96 |
MD5 | 7e3154a0364d79c179711749c5692a4c |
BLAKE2-256 | e580843a942aee4acf02d506fb495ea83d9aeeeea105af3eef981558761c649b |