pyserial

pyqt4 and pyserial

I want to do an app constantly watching the serial port and changing the user interface according to the input received from the port. I've managed to read lines from the port with pyserial under Linux, but I'm not sure how to do this in a regular fashion: create a separate thread and check for input on a timer event? How do i make sure ...

Python PySerial readline function wrong use

I'm using a script importing PySerial to read from COM4 messages I would like to intercept end with a couple of # so I tried to use bus.readline(eol='##') where bus is my connection. I expected to read like: *#*3## *#*3## *#*3## Unfortunalyy I found also *#*1##*1*1*99## that I expected to read spleetted into 2 lines *#*1...

python monitoring over serial port

Good afternoon, I would ask some suggestion about the best way to monitor events over the serial port. I'm using PySerial to write "commands" over the serial port towards some devices and I would like to receive feedback about the status of this devices. Wich is the best way: 1) fullfill a pipe and read into, 2) a new thread delegate...

Getting an input/output error from python with pyserial

I have a python script that writes data packets to an arduino board through pyserial. Sometimes while writing the code to the board pyserial raises an input/output error with errno 5 Some research says that this indicates an error while writing in the file representing the connection to the arduino board. The code that sends, sends on...

pyserial - How to Read Last Line Sent from Serial Device

So I have an Arduino connected to my Windows XP computer. It's just running a loop, sending a value over the serial port back to the computer every 100ms. I want to make a Python script that will read from the serial port only every few seconds, so I want it to just see the last thing sent from the Arduino. How do you do this in Pys...

Python/PySerial and CPU usage

Hi folks, I've created a script to monitor the output of a serial port that receives 3-4 lines of data every half hour - the script runs fine and grabs everything that comes off the port which at the end of the day is what matters... What bugs me, however, is that the cpu usage seems rather high for a program that's just monitoring a s...

How to get direction from TDCM3 (Digital compass) with pySerial?

I have a digital compass TDCM3, its manual is here TDCM3 Manual I want to read direction from TDCM3 on PC or embedded PC(wince), I use pySerial to open a com port and read data from TDCM3: import serial # Open COM port device = serial.Serial(0) device.setRTS(True) print device while True: data = device.read() print repr(data...

Can I use the xmodem protocol with PySerial?

Hi, I have a working connection with my serial device via PySerial, but I also want to transfer files via the xmodem protocol as part of my program. Which would be the most platform-neutral way to do this? Worst case, I could close() my serial.Serial object in Python and use subprocess to call upon /usr/bin/sb, but that seems inelegan...

Trying to open a serial port with pyserial on WinXP -> "Access denied"

I'm trying to send data to an hplc pump via the serial port using python and pyserial. I tested the cable and the pump under linux (a gentoo derivative), where it worked perfectly, albeit as root. Now i have to use the code on a WinXP machine, where i always get an "Access denied" error when trying to open the port (i adjusted the parame...

pyserial- sending in parameters at runtime- input vs. raw_input - security flaw?

Hello, I am writing a program that opens and records data sent through a serial port into a text file. I am currently adding functionality to allow reconfiguring the serial port during run-time. I prompt the user to choose which variable to change one at a time, so as to keep it simple for myself (i would appreciate elegant solutions as...

How to send file to serial port using kermit protocol in python

I have device connected through serial port to PC. Using c-kermit I can send commands to device and read output. I can also send files using kermit protocol. In python we have pretty nice library - pySerial. I can use it to send/receive data from device. But is there some nice solution to send files using kermit protocol? ...

Virtual Serial Device in Python?

I know that I can use e.g. pySerial to talk to serial devices, but what if I don't have a device right now but still need to write a client for it? How can I write a "virtual serial device" in Python and have pySerial talk to it, like I would, say, run a local web server? Maybe I'm just not searching well, but I've been unable to find an...

PySerial App runs in shell, by not py script

I have a very simple python script that uses pySerial to send data over the serial port to my arduino. When I execute this line-by-line in the python shell, it works just fine, but when I put it in a ".py" file, and try to run it, nothing happens. Though the Serial lights on my UART do flash. So something is getting through, but it's ...

Echo Program in between Arduino and Python

I want to send some data to an Arduino through pyserial in Python. All I want to the Arduino to do is read the variable length string data from the serial port, and write it back so that Python can read it. Since I've been unable to do that, the code below only has Python sending on character. Here's the Python code: import serial impor...

how can i use COM & USB ports within cygwin

hi, i want to send/receive data from my arduino board with a python script. I would like to do it using python and its pySerial module which seems to fit my needs. So i installed python and pySerial within cygwin (windows XP behind)) the python script is rather straight forward : $ cat example.py #print "testing my COM26 port using p...

Pyserial : How to send data to drive SIPO

Dear All .. I'm learning to drive a stepper motor with Python. It's hard now to find a PC with paralel port. So My plan is using a USB-Serial .. and a SIPO (serial in parallel out) shift register circuit. As you know with this circuit we need to send a binary data in series and this data will be stored in it's register. Next we need to...

PySerial and IronPython - get strange error

I have a device connected to COM31. And the code that I need to create a serial connection looks very simple port = 31 trex_serial = serial.Serial(port - 1, baudrate=19200, stopbits=serial.STOPBITS_ONE, timeout=1) The foollowing code works when I run it using Python2.6, but when executed by IronPython2.6.1, this is what I get: Traceb...

How can I fix "[Error 6] The handle is invalid." with PySerial

I'm trying to connect to my phone from my Windows 7 PC using PySerial with the following code: import wmi import serial c = wmi.WMI() modem = c.query("SELECT * FROM Win32_POTSModem").pop() ser = serial.Serial(modem.AttachedTo, modem.MaxBaudRateToSerialPort) try: ser.write('at \r\n') print ser.readline() finally: ser.close(...

Problems with sending commands over pySerial

Hi. I'm trying to talk to a home made card over a serial port, and is therefor using pySerial. In Hyperterminal, everything works fine. I can write: $ audio on and the audio is enabled, but if I use ser = serial.Serial("COM1", 38400) ser.write("audio on\r\n") nothing happens. I can read incoming data however, so it's not something...

Using pySerial to connect to a non-COM port

In Hyperterminal I am able to connect to a serial port called "X64-CL_iPro_1_Serial_0" where I am able to send/receive ASCII text to a camera. However when I try to connect to the same port with pySerial, it throws an exception: SerialException: could not open port X64-CL_iPro_1_Serial_0: [Error 2] The system cannot find the file specif...