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.
2,274
questions
0
votes
1
answer
33
views
Sending and receiving data over USB using serial
I'm trying to send data from PC to Raspberry Pi Pico. PC code:
import serial
import time
# Define the serial port and baud rate (adjust as needed)
serial_port = 'COM12' # Replace 'X' with the actual ...
-5
votes
1
answer
43
views
Why is Serial not an attribute of the class serial? [closed]
I wanted to connect some external device to my PC (e.g., Arduino) in order to take in some audio data from it, but the serial class isn't working.
Enter image description here
Error description
...
-1
votes
0
answers
26
views
In pyserial, the message I send is transmitted differently than when I send it
In pyserial, the message I send is transmitted differently than when I send it. I have a device running on a serial port. My Python script communicates with the serial port and transfers it to the ...
0
votes
1
answer
7
views
pyserial gets no response from the bootloader in embedded device
I have an embedded device configured to boot in to the bootloader which expects to communicate with the user on the USART1 after reboot.
This works if I open a serial terminal application (cutecom) ...
0
votes
1
answer
15
views
pass memoryview to win32.ReadFile for Pyserial readinto() function
I want to create a proper readinto function for the pyserial package (for windows). pyserial implements readinto() by calling read() which defeats the purpose of readinto. Adapting the existing read() ...
-1
votes
1
answer
29
views
Flask cant access to any COM
I need to develop a website that controlls a dc motor with arduino using flask.
I have this HTML.-----------------------------------------------------------------------
<!DOCTYPE html>
<html&...
0
votes
0
answers
28
views
Lack of response from the device through Python Serial library
I have a device which is configured through an RS-232 port. I want to write my own software in Python which would configure the device through the port. The problem is program writes successfully the ...
0
votes
0
answers
28
views
Trying to emulate a live communication from a micro device usign tty0tty and trying to read data using Pyserial
I am trying to read data from a device and write the data to a file. But I don't have the device with me so I'm trying to emulate the device and then go forward with developing the application further....
0
votes
0
answers
37
views
pyserial cannot convert string to float ''
Here is some code I am working on. The idea is to use a remote serial terminal to send servo angles to it and have it report the current position of the servo at regular intervals.
#!/usr/bin/python3
...
1
vote
0
answers
26
views
Trying to read the serial output of a SIKO MA502 with pyserial, but getting empty lines
I use the Siko MA502 measurement system that is connected via an USB to UART cable from FTDI, to be more specific the TTL-234X-5V. I want to read the distance out the serial output from the ...
0
votes
0
answers
24
views
Pyserial dirty data when reading
I wrote this function to run a separate thread, so I can read from an Arduino continuously. It's supposed to be flexible, so I wanted to make it work for any length of message.
def _readserial(...
0
votes
1
answer
47
views
I get the problem in python 3.9 : " serial' has no attribue 'Serial' "
i'm learning python. And in a serial stuff :
serial_port = serial.Serial(port = "COM3", baudrate = 9600)
i get the "attribute serial" error
"module serial has no attribute '...
0
votes
0
answers
9
views
Python pyserial threading feature behavior [duplicate]
I am trying to get the python pyserial module threading feature to start a parallel thread that reads serial console messages and returns them. While that thread runs, I would like to do other things ...
0
votes
0
answers
31
views
read files on teensy via python on windows
I am working on a project to send data which is on an sdcard in a teensy 4.1, via the micro-usb port to a computer with pyton.
Now I have my procedure can't of working but see that when the files ...
0
votes
1
answer
32
views
Python while loop reading serial data not exiting after pressing Ctrl + C
I have the following Python 3.9 while True loop that reads data coming from a Teensy 4.1 that does not exit after pressing "Ctrl + C".
Only "Ctrl + \" and "Ctrl + Z" stop/...
0
votes
0
answers
12
views
Iterating through ports to determine which devices are connected with PySerial
I'm trying to create a function using pySerial (on Linux Mint) that will iterate through all serial ports and determine which devices are connected to which ports. Each device has a "...
0
votes
0
answers
34
views
Pylibftdi versus PyFtdi - what is the difference?
What's the difference between pylibftdi and PyFtdi? I have used PySerial before. But have not been able to use it on my current device that has an ftdi cable. That's how I stumbled across pylibftdi ...
0
votes
1
answer
23
views
minicom is openning port but pyserial is saying 'Device or resource busy''
I want to send a sms message via Quectel EG25-G, I've already connected to LTE with ModemManager
I've managed to connect to the device via minicom and I can send AT commands
I wanted to use PySerial ...
0
votes
0
answers
16
views
SerialException from existing connection while starting a new serial connection
I have two devices connected to a raspberry Pi on ports /dev/ttyACM0 and /dev/ttyUSB0 respectively.
I am communicating with the ACM0 device using a C++ serialPort instance on one program. On another ...
0
votes
1
answer
47
views
Python pyserial use a lot of CPU for simple task on Celery
I'm using Pyserial inside a Celery worker to write every 150ms a packet of max 20 bytes on the serial
Literally the celery worker does nothing except send data on the serial with ser.write(packet) ...
0
votes
1
answer
80
views
How to send a byte string from PC to Raspberry Pi Pico?
Using PySerial I was successful in sending data from Raspberry Pi Pico to Windows PC but not the other way around.
Windows PC code:
import serial
# Configure the serial connection
port = "COM5&...
0
votes
0
answers
95
views
Sending and receiving RS422 data from a device
I have a device that uses the RS-422 communication protocol. I am struggling to connect to it to either send or read data.
There are 6 pins:
VCC
GND
Serial Data out A
Serial Data out B
Serial Data in ...
0
votes
0
answers
44
views
Docker cannot read Serial device
I've got the following Python code running in a docker image:
import serial
ser = serial.Serial('/dev/ttyS1', 19200)
while True:
line = ser.readline()
print(line, flush=True)
I've used the ...
2
votes
1
answer
82
views
Stopping multiple threads on demand (e.g., with key input)
I have two serial devices that need to run at the same time: one counts particles in a water sample and the other measures the flow rate of the water sample. I need to acquire data from these serial ...
0
votes
0
answers
19
views
How to prevent other programs from connecting to the COM-port I'm using
I am using python pymodbus library to read data from a COM port. When launched, the program reads data on the COM port, but if I connect to the same port by some other program, it intercepts the port ...
0
votes
0
answers
19
views
Serial communication problem with Python/Arduino
`The functions that should communicate with Arduino aren't working. Serial connection opens, but the logic (turning diodes on/off does not work). I think that it has to do something with signals that ...
0
votes
0
answers
35
views
GUI PySide6 and Arduino Uno
I have problem implementing thread logic in my GUI. I created 2 different apps that are used to control the RGB diodes on one port (COM3) . Now I need to add them to my main GUI app, and I need to use ...
0
votes
0
answers
14
views
Multithreaded or asynchronous serial communication with several hardware units?
I have to interface a few identical hardware units that each communicate via RS232 serial communication on Windows using Python. Each hardware unit is connected via USB through a USB/Serial interface ...
0
votes
1
answer
120
views
Writing to file in a Popen subprocess
I am attempting to log the simultaneous serial outputs of 3 GPS receivers to compare their performance on a single computer.
Following the structure outlined in this post, I created a main file which ...
0
votes
1
answer
21
views
Pyserial Import Errors Despite Correct Package Installed
See the following. "import serial" gives error and I have taken care to import the correct package (pyserial 3.5). I have no idea what the issue is, and other packages have worked fine on ...
0
votes
0
answers
30
views
Why does my electric meter not read anything?
I have a ZMG405CR4.060b.37 Landis+Gyr electric meter. This meter uses the IEC62053-22 communication protocol. In the device it also says "Landis+Gyr E550", I don't know what that is but ...
0
votes
0
answers
44
views
Problem with serial communication between Python and a Totalstation (laser distance measurement)
I am working on a python script (Python 3.11.3 on windows 11) that through serial communication with a laser distance/angle finder (a Totalstation South NTS-362R4L), can write and activate the laser ...
0
votes
0
answers
16
views
How to log everything from serial while paralell response parsing?
I got stuck with pyserial paralell logging and command processing.
I would like to achieve that I can save everything that is coming from serial port, but I also want to send command to my embedded ...
0
votes
0
answers
157
views
Python Serial Port PermissionError 13
serial.serialutil.SerialException: Cannot configure port, something went wrong. Original message: PermissionError(13, '�ý��ۿ� ������ ��ġ�� �۵����� �ʽ��ϴ�.', None, 31)
The code works well without any ...
0
votes
0
answers
16
views
why does my threading doesn't want to decrypt a byte while having a tkinter interface
I have a tkinter interface to manage a project with an arduino mega, and i want my program to communicate with the arduino. actually i can send data and have a response without problem. but when i ...
0
votes
0
answers
37
views
serial.serialutil.SerialTimeoutException: Write timeout Pico with linux
I have a Pico Microcontroller that is connected to a stepper motor driver, and I just want to rotate the motor on command.
My code is able to do that when it is connected to a Mac system, but whenever ...
0
votes
1
answer
34
views
Trouble generating new data, plotting with matplotlib, and simultaneously sending the data over a serial connection
I'm sending data over serial from Python to an Arduino, and I have two chunks of code that work fine separately:
The first piece generates new data and plots it using matplotlib every time I press ...
0
votes
0
answers
46
views
Improve speed during Serial transfer
I'm using Serial to transfer scapy packets between two NanoPi (almost identical as Raspberry Pi).
For that, I'm using the following Python code:
import time
import serial
import threading
from scapy....
1
vote
0
answers
35
views
How to communicate with a serial io device
I am trying to communicate with a serial io device through python. The example code is:
import serial
ser = serial.Serial('/dev/ttyUSB0')
My question is how do you get the /dev/tyyUSB0 equivalent for ...
0
votes
1
answer
48
views
Rasberry Pi 4 USB serial port pyserial timing issue
I have a setup where Raspberry Pi 4 is connected to USB hub with 5 USB-Serial converters (https://www.dfrobot.com/product-104.html)
Each converter in connected to STM32 based device. The devices are ...
0
votes
0
answers
119
views
Pyserial with pip
I am trying to install pyserial on my computer, I am on Python 3.11.3
I successfull installed pyserial with pip
But When I import it on a py script it tells : Import "pyserial" could not be ...
1
vote
0
answers
194
views
Pyserial not finding ports in Ubuntu 22.04
I am trying to communicate with a device using Python 3.10.6 in Ubuntu 22.04 but can't. I have been using this device for years with previous Ubuntu versions, so I know how to use it.
Test code:
...
0
votes
1
answer
144
views
unable to open port with pySerial - serial.Serial
I have a few serial ports that I am trying to open with python (ipython in particular). Running python 3.8.8 in Scientific Linu 7.9. I run it with the lines
import serial
ser = serial.Serial('/dev/...
0
votes
0
answers
35
views
How can I send serial commands to a CSZ 570i temperature chamber in python?
I'm trying to send serial commands to a test chamber in our lab in order to set the temperature from our connected PC. Let's say for example I want to send the command "01 06 00 3C 00 C8 48 50&...
0
votes
0
answers
21
views
Read output from command line using pyserial
import serial
def main():
print("\nInitializing serial connection")
console = serial.Serial(
port='COM14',
baudrate=115200,
parity="N",
...
0
votes
1
answer
58
views
pySerial decode function returns error 'utf-8 codec can't decode byte 0xff ...'
I set up an Arduino to give this kind of input:
3.30x530.00x2.59x1325.0x28.70x1013.14x0.91x23.41
3.50x531.00x2.60x1327.5x28.70x1013.11x1.17x23.41
3.60x531.00x2.60x1327.5x28.70x1013.14x0.89x23.41
I ...
1
vote
0
answers
28
views
Sending data to moisture meter through USB Host Shield from Arduino
Im working on a moisture meter that has RS232 output with integrated PL2303 to USB cable.
I can read 0x10 from and send 0x20 to the meter to get the measurement data on Python from PC.
But with ...
0
votes
1
answer
64
views
hidraw* access through serial terminal (raspberry pi)
So I've been trying to communicate with an inverter that uses the usb port to communicate. The device shows up as hidraw0 I've had no luck using the hidapi library, so far the only successful form of ...
0
votes
0
answers
14
views
independent devices (Threads)
Which is the est way to manage device from code in python?
My Device object should:
regularly and indepenedent send query to devices to check stack of errors,
detecting connection lost,
allows other ...
0
votes
0
answers
43
views
Reading from a serial port - database only getting data to first column
I reading data from a serial port and trying to print the data onto the database, whenever I try and print the data to my DB it is only printing the data to the first column instead of being spread ...