Reputation: 21
I have a fermentor (NBS BioFlo 3000) connected to a PC (Windows XP) via a RS232 cable. I have downloaded a free software (http://www.foxylogic.com) to monitor the fermentor.
It works, so I know for a fact, that the hardware, cable, etc, are good.
The free software is not open source, and is very old. I'd like to use pySerial to monitor the fermentor. I know the port is COM1, 8 bit data, even parity, baudrate=9600. A paper I saw (http://dx.doi.org/10.1371/journal.pone.0092108, supplement S1, page 2) says that I should be using the "AFS communication protocol" and that the string requesting information looks like:
(MD#)RA(CR)
where (MD#) is the number of the reactor (0 in my case) and (CR) is carriage return.
So based on that, I did, in iPython terminal:
import serial
ser = serial.Serial(0)
ser.parity = serial.PARITY_EVEN
ser.timeout = 1
print ser
I get: Serial<id=0x1976cb0, open=True>(port='COM1', baudrate=9600, bytesize=8, parity='E', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)
ser.write('0RA\r')
print ser.read(9999)
..., and I get nothing at all - just an empty string. I tried to change the timeout (up to 15 s, and I know it cannot take longer that that), I also tried readline() and read(1), but I did not change any of the other parameters. I also tried to alter the string:
b'0RA\r'
'0RA\r'.encode()
'00RA\r'
'0RA\r\n'
'0RA\n'
'MD0RA\r'
'(0)RA\r'
'0ra\r'
and many others, I don't remember them all. Nothing works, I always get an empty string. No errors.The serial device is just completely silent.
The only time I get something else than an empty string is, when I ser.read(1)
in a loop, no writing, and I physically turn the fermentor either off or on. I get one space.
I googled this extensively, but it appears I am dealing with quite a unique problem, so I don't expect to find a simple answer here. I can't test all the combinations of the strings and all the settings, so my question rather is:
Where do I start troubleshooting?
(my python is 2.7)
Thanks!
Upvotes: 2
Views: 116
Reputation: 35986
You start troubleshooting by checking if anything is actually being communicated. In Windows, utilities capable of this include PortMon from the Sysinternals suite and SerialMon.
Upvotes: 1