Questions tagged [pyserial]

pySerial is a Python module that encapsulates the access for the serial port. It provides backends for different platforms and Python implementations.

pySerial encapsulates the access for the serial port. It provides backends for Python running on Windows, Linux, BSD (possibly any POSIX compliant system), Jython and IronPython (.NET and Mono). The module named serial automatically selects the appropriate backend.

This is an example extracted from the introduction of the documentation:

>>> import serial
>>> ser = serial.Serial(0)  # open first serial port
>>> print(ser.portstr)      # check which port was really used
>>> ser.write("hello")      # write a string
>>> ser.close()             # close port

References:

2268 questions
0
votes
1 answer

Reading serial interface with Python returns distorted data

I am trying to read binary serial port using Python. Each source message consists of 3 floating point values, 12 bytes in total. Using the Python code shown below, I was expecting to get a 12-byte bytearray message. However, running the code I found…
stardust
  • 343
  • 3
  • 17
0
votes
3 answers

Using Serial on Python / Win7

I am trying to interface with a serial WWAN modem (for diagnostics /signal strength measurement purposes). This is via the onboard COM1 (115200-8-n-1) on my desktop, the connection works via PuTTY. I can script the AT commands using Python, but I am…
Tony Laidig
  • 1,048
  • 2
  • 11
  • 33
0
votes
1 answer

Continuosly Read/Monitor Serial Port(if port not opened continuously run script) using python

Im newbie for python and serial port. I want to monitor serial port continuously. If port not opened or access denied, need to run the python script without stop. I had done something, But that script has stopped when the PORT not opened or access…
0
votes
1 answer

How to read highspeed Serial-data using Python?

I am working on a project to display sensor data on Python GUI. Sensor data is coming at a rate of 2kHz on serial port using Arduino. I was using pyserial (using readline()) to read the sensor data on my laptop. After hours of debugging I found that…
0
votes
1 answer

python serial port reading won't work in batch file

I have written a python script which reads data from serial port.This script is running on a windows machine. On the other side of serial link there is a micro-controller with a camera connected to it. Micro-controller after taking picture saves it…
0
votes
1 answer

pyserial thread hangs on serial.in_waiting() statement

I have a pyserial thread that hangs in an unexpected place; checking the serial port for queued bytes. All serial input is done in this thread; main is primarily the display manager. The init executes fine, once in the run subroutine it hangs at…
0
votes
1 answer

testing usb to serial to usb using pyserial has no output

I'm trying to test writing messages to serial port using pyserial and reading it again using two usb to serial adapters connected back to vack "USB-Serial --> Serial-USB" to verify it is writing to the serial port as it is meant for communication…
Aly Hosny
  • 827
  • 5
  • 13
0
votes
1 answer

Python cannot import serial

Having Python 3.7.6 and having already installed pyserial, pip install pyserial --user Requirement already satisfied: pyserial in c:\users\myusername\appdata\local\programs\python\python37\lib\site-packages (3.4) pip install pyserial Requirement…
hadoop
  • 85
  • 1
  • 1
  • 9
0
votes
1 answer

Protocol for Serial Communication in binary - getting unexpected response

I'm trying to use Python3 on Raspberry to communicate with a serial device. The protocol is as follows: Host sends command byte (contains address and data type) Device echos command byte Host sends operand byte (more data type info) Device echos…
0
votes
0 answers

serial port getting engaged after reading single command in python

I am making a connection with python using pyserial with a UART port. As I send the command using serial.write my output is received but my serial port does not break connection. As I need to send a second command also to receive the output. Please…
nishant
  • 1
  • 2
0
votes
1 answer

Reading form a serial input does not work in Python3

I can not make a simple script working fine in Python2.7 work in Python3. The script: enter code here{ #!/usr/bin/env python # simple test program to test serial I/O data from gps # # Dec 2019 HRK import Adafruit_BBIO.UART as UART import…
Harke Smits
  • 13
  • 1
  • 7
0
votes
1 answer

What is the "send" button on the Arduino serial monitor doing?

This has been resolved!! I have to wait a few seconds after opening serial port. I want to execute the python program that is being done with the send button on the Arduino serial monitor. if (Serial.available() > 0){ Serial.print(hoge); } is…
sattyorin
  • 1
  • 2
0
votes
1 answer

How to read COMport data and write in the txt?

I want to use pyserial to control Ubuntu OS reboot and I need to get and read the information until to the login in the txt. I use this code: logging.basicConfig(filename='onoff.txt',format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S…
Lu儒
  • 3
  • 4
0
votes
0 answers

Send my converted base64 output from Python ,to the Arduino?

I am a beginner in programming. I write a code to convert images into base64. I attached that python script bellow. Then I need to send that output data of base64 to my Arduino board. But it shows some problems and nothing going happen on the…
0
votes
1 answer

Loop through all serial addresses to locate hardware

I'm new to python and I'm trying to loop through all 255 addresses to locate a specific bit of hardware over RS485. The hardware is attached, and it's address is supposed to be 0x25, but this is not the case, so I need to find what its address is.…
laminatefish
  • 5,197
  • 5
  • 38
  • 70
1 2 3
99
100