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
Filter by
Sorted by
Tagged with
1 vote
1 answer
70 views

pyserial not replenish to input buffer immediately after received data?

I want to use pyserial module to read serial data sent by Arduino, the data update rate is about 250Hz, one data consists of 29 bytes and the baud rate is 230400. When my code is running, I found that ...
Adam's user avatar
  • 11
0 votes
1 answer
60 views

Python splitting text into two lines instead of printing one

I'm reading sensor data with a RedBoard QWIIC. The program outputs data which looks like this: 408 10 45.47 98760.30 23.33 413 19.17 400 7 45.45 98758.38 23.33 414 19.17 ...
czar1249's user avatar
0 votes
0 answers
75 views

How to use a function multiple time with single thread

I have a Button in gui to take data from serial port. here is my code: def takeRead(): ser = serial.Serial() ser.baudrate = 115200 ser.port = "COM7" # "COM#" this must ...
IMI's user avatar
  • 13
1 vote
2 answers
2k views

Read and write to same serial port with Windows

Is it possible to write and then read the same serial port in one python file? Or with 2 different threads? I've tried it both ways. With 2 different threads, I get "access denied". In the ...
Kaz's user avatar
  • 11
3 votes
0 answers
858 views

PySerial package is reading serial data before writing?

I am trying to send one byte (128) to a device through serial port and expect to receive back 81 in Hex[space]. Note: The device is automatically transmitting the data it has. Before running Python ...
Joe's user avatar
  • 597
0 votes
1 answer
1k views

No data is being read from a serial port using Python

I am trying to read and store data in a csv file in packets saved every 5 seconds from a rs232 serial port using Python. An example of a packet to be stored, in each row, is: 308 921 q53 246 133 137 ...
Joe's user avatar
  • 597
1 vote
0 answers
733 views

pyserial write and read data RS232

I have a cable with RS232 serial port and I connect the heads to my pc by USB serial adaptor. I want to send a data from one comport and receive the data from another comport. but I have problem with ...
Arian P's user avatar
  • 11
0 votes
1 answer
415 views

Test if a given bit is set in a byte

I have an EasyDAQ relay board. To turn on relay 1, you send it one byte, relay 2, two bytes, relay 3, four bytes and relay 4, eight bytes. All the relays on = 15 bytes. To turn off a relay you have to ...
bob_the_bob's user avatar
0 votes
0 answers
367 views

PySerial seems to have a read() limit

I'm trying to send a large stream of data via serial, and using the PySerial library for my purposes. However, the program freezes whenever I need to read more than somewhere between 10,000 and 15,000 ...
shanearthur's user avatar
0 votes
0 answers
570 views

Can't import pyserial (ImportError No module named pyserial)

I have a script that currently requires Python2 to run. I have a fresh Ubuntu install setup by my IT this morning. I get this error message when attempting the script: "ImportError: No module ...
jfwork's user avatar
  • 15
0 votes
1 answer
568 views

not able to get the output back from serial console using pyserial

I can send my command over serial port and it runs fine. I want my out put back to main program on host so that I can print it there. But its not working. def send_to_console(ser: serial.Serial, ...
Kamal Singhal's user avatar
0 votes
0 answers
21 views

Let Apache2 fire a Script located on a Client

lets say I have a Webserver (apache2) running, on this server runs my Website (HTML, PHP, JS, CSS). This site calculates and displays data. On a ButtonClickevent I want to execute a python script, ...
alb's user avatar
  • 47
0 votes
1 answer
80 views

python3 -m switch files

If I run this on my (Linux) command line. python3 -m serial.tools.list_ports I get the result: /dev/ttyUSB0 1 ports found. What files (or sequence of files) are run by this -m switch? I have ...
Micklos's user avatar
  • 135
1 vote
2 answers
647 views

Using USB port data in PyQt

The aim of my code is to create a window with labels, each representing a sensor. The data comes from the USB port in a table of 0s&1s and depending on the value it colours the labels accordingly. ...
wonderfuloceans's user avatar
2 votes
0 answers
184 views

Reading thermocouple data with pyserial/Configure DAQ device

I am new to Python in general and data acquisition/instrumentation. I am trying to get a temperature reading from a thermocouple connected to a Measurement Computing USB-204 DAQ. I want to output the ...
Liam Warren's user avatar
0 votes
0 answers
897 views

Cannot open serial port via pyserial

I'm trying to read strings from a USB/Serial barcode scanner from a python script in Linux environment. The device is named /dev/ttyUSB0 by the O.S. I can read the "special file" from the shell. This ...
Ferdinando Ceci's user avatar
0 votes
1 answer
1k views

How to read data from computer using Raspberry Pi Pico?

How do I read data from my computer to Raspberry Pi Pico using MicroPython with pyserial?
user19482675's user avatar
2 votes
3 answers
99 views

Bytes Command Function Not Working for PySerial

I have a function which takes a set of values and converts it into a bytes string. For example, I need: input_array = ['E9', '01','06','57','4A','01','F4','01','01','EF'] ## needs to become b'\xE9\x01\...
Dr. Ernesto Chinchilla's user avatar
0 votes
0 answers
185 views

Serial Communication with a Love TS2/3 Temperature controller using Modbus over RS232

I am attempting to read data off of a Love Temperature Controller either Model TS2 or TS3. The devices have a 4 wire port on the back that I am attempting to communicate. I have been informed by the ...
user1415699's user avatar
0 votes
2 answers
232 views

PySerial not able to read LoRa E5 Mini responses

When I try to read data off of a microcontroller using PySerial, I get no response with the following code (a LoRa-E5 mini is atttached to my UART COM5 Port) import serial import time print("...
UltraScienceGuy's user avatar
0 votes
0 answers
42 views

Unable to convert bytes to hex

I have a serial device (loadcell) connected to pc which is constantly sending data in a fixed format. It has 2 stop bits (0x40 and 0x0b). I am trying to read until 1 stop bit so I can start reading ...
bmw-m8's user avatar
  • 1
0 votes
0 answers
50 views

PySerial to Connect a Pump

I am trying to send commands a pump listed here (page 12): https://drifton.dk/upload_dir/shop/OEM-pumps/Manualer/T100-S300-series-operating-manual-2019-7.pdf The hardware is connected properly, and ...
Dr. Ernesto Chinchilla's user avatar
1 vote
1 answer
2k views

Use pySerial to list open serial ports *from python script*, not from the command line

So I've got a serial device, however the serial port changes most times I reconnect it. What I want to do is to list all serial ports, iterate over them until I find the correct one, and then connect ...
beyarkay's user avatar
  • 680
0 votes
1 answer
268 views

How can I open multiple popups in succession?

I'm currently working on an application written in Kivy in python. I have 2 multiprocessing.Processes running: One is a process for the RFID-reader, I open a popup that lets me choose a screen to go ...
hoek rand's user avatar
  • 329
0 votes
0 answers
84 views

Make readline() blocking until a new non-empty value arrives

I'm reading data from USB serial with: s = serial.Serial(port="COM1", baudrate=115200, write_timeout=0.010, timeout=0.010) while polling: r = s.readline().decode("ascii") ...
Basj's user avatar
  • 44.1k
2 votes
1 answer
403 views

Speed is reduced substantially when writing to serial port

Using pygame to read info from controller, but when I add arduinoData.write(str.encode(ALL_DATA)) it reduces the speed a lot, what can I do? The line is added almost at the bottom. Is it the placement ...
Some Student's user avatar
0 votes
2 answers
650 views

No response from pyserial connection to android on serial port

Trying to communicate with an android device on a serial port. I can establish a connection through pyserial, but I don't understand how the flow of information works and why I can't get any output (...
blaughli's user avatar
  • 161
1 vote
1 answer
505 views

Read and write to port with unit8 format?

I have Matlab code that communicates over serial port, and I am trying to translate the code into python, however I am not getting the same "read" messages. Here is the matlab code: s = ...
Leo's user avatar
  • 1,068
0 votes
1 answer
492 views

Trying to read data from sensor over serial port and then plot - cannot convert string to float

I'm using pyserial to read data from a sensor on COM6. I used Serial.println() in the Arduino module of the embedded chip that hosts the sensor to push the data to the serial port. When I monitor the ...
Monty's user avatar
  • 1,241
0 votes
1 answer
116 views

converting the python queue module from python2 to python3

I have a logging script that will log serial output from multiple devices in a queue of serial terms into stdout. In python 2.7 the script worked as intended. However upon converting the script to ...
Manus's user avatar
  • 1
0 votes
1 answer
3k views

WriteFile failed (PermissionError(13, 'the device does not recognize the command.', None, 22)), pyserial and Arduino

I'm controlling the position of a servo with Python and an Arduino. I type in the angle in python and it sends to the Arduino which then moves the servo to that specific angle. Arduino code: #include &...
LUGG4S's user avatar
  • 35
1 vote
0 answers
555 views

I can't import serial package in pycharm

I am trying do receive data from arduino serial port. I write code like this when i run this code in cmd (after write python) this work properly. but i am try do this in pycharm AttributeError: module ...
Fərhad Heydərov's user avatar
2 votes
1 answer
931 views

How to open the serial device exclusively in pyserial?

I want to open the serial device exclusively by pyserial in ubuntu 20.04. I tried the following two approaches. To use the exclusive flag in pyserial. ser = Serial(port=serialdevice, baudrate=115200,...
yyuankm's user avatar
  • 335
0 votes
0 answers
371 views

Python Serial Write: Sending list of mixed data

I have a program on my Arduino Due that receives lists of data, parsed by one of this solutions https://forum.arduino.cc/t/serial-input-basics-updated/382007 and it is working fine! I am sending this ...
AndrewFFL's user avatar
0 votes
0 answers
1k views

pyserial read variable byte array

I am writing a code that can flexibly read a mutable array (4 byte array and 7 byte array). I don't think it's a good idea to read 7 bytes continuously and judge it by the number of bytes sent in the ...
unstable.ver's user avatar
0 votes
1 answer
49 views

tkinter executes one more time the function after using after_cancel()

So I have a button that in a cyle way execute a function as soon as the buttom is pressed down. Once released the function stops its execution. Now, for some reason, once I released the button, the ...
NicoCaldo's user avatar
  • 1,363
0 votes
1 answer
38 views

pressing button tkinter blocks execution of a part of the software

I've a program in python that reads my serial port for data. I'm writing a new part where, with the click of a button, on the same serial port, I send specific data. Below part of the code I'm using ...
NicoCaldo's user avatar
  • 1,363
0 votes
1 answer
8k views

pySerial read_until() reads only the first byte

So I'm receiving data from a serial port using pySerial. I've a very simple code that reads the first byte, check if it's the start byte ( 0x02 in my case) and then read until it finds the end byte ( ...
NicoCaldo's user avatar
  • 1,363
0 votes
2 answers
1k views

Keep reading data while updating GUI tkinter in a non blocking way

I'm new to asyncio, threading, subrocess and I'm trying to build an app that reads data from the serial continuesly, put them inot a queue used by another process/thread/asyncio function to consume ...
NicoCaldo's user avatar
  • 1,363
0 votes
1 answer
235 views

Write separate lines python serial

I try to write few serial commands , each one of the commands should be send separately I tried to add \n at the end of the line but according to the serial monitor on the computer the lines are not ...
Idan Hershko's user avatar
0 votes
0 answers
189 views

io.UnsupportedOperation: fileno even in PowerShell with Administration permissions

So I'm trying to read data from a serial port using asyncio. I have a function called start_receiver as below. def start_receiver(ser, exit_queue, msg_queue): loop = asyncio.new_event_loop() ...
NicoCaldo's user avatar
  • 1,363
0 votes
1 answer
341 views

why does pyserial write() show me as output the number of characters of the string I want to send?

The whole program works except for this, instead of showing me in the console b'N', I get a 1 as output, if I change the N to something longer the output shows me its number of characters. Previously ...
Laura's user avatar
  • 1
0 votes
1 answer
355 views

How to dynamically connect to a serial port based on `lsusb` so that the devices connect to the right thing

stack overflow, I've spent a good part of today trying to dynamically connect different USB peripherals based on the response from 'lsusb' in python. The goal is to allow a device to be unplugged and ...
Jiggly's user avatar
  • 23
0 votes
1 answer
141 views

Can't read serial response using pyserial

Trying to use pyserial to talk to a Korad KD3005P power supply. (Using Python 3.6) import serial ser = serial.Serial('/dev/ttyACM0', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1) ser....
Ti7mq's user avatar
  • 3
0 votes
1 answer
213 views

pyserial read qr code and take action on arduino

I'm reading qr code using opencv and pyzbar, i'm communicating with an arduino uno using pyserial. my python code from pyzbar.pyzbar import decode import cv2 import serial import time arduino = ...
Omar Diaa's user avatar
0 votes
0 answers
457 views

SerialPort not detected on Linux but on Windows

I will develop a Software which need to detect a Serial Device via a USB Port, on Windows everything work fine, but on Linux it will not detect my device as a Serial Interface, if i make dmesg i can ...
patrickhobb's user avatar
1 vote
0 answers
196 views

Sending serial commands to a Kangaroo motion controller with pyserial

Hi everybody, I need help with following problem please: I try to drive a Dimension Engineering Kangaroo/Sabertooth motor controller from a Python script using pyserial. Everything works so far except ...
Bergison's user avatar
0 votes
1 answer
43 views

keyboard events are logged by the python script and powershell which runs the python script at the same time

I am running into an issue where I am trying to read/write to serial port from windows, its similar to teraterm/putty but trying to customize it for personal use. I am using powershell and using ...
Vasanth's user avatar
  • 128
0 votes
2 answers
837 views

pyserial says TypeError: unicode strings are not supported, please encode to bytes

I am using a program to track peoples faces through my webcam and move servo motors in the direction the person is. Source. But when running the software, and the camera detects a face it crashes and ...
user avatar

1
4 5
6
7 8
47