1

I am looking for some advice on using the python (2.7) library "minimalmodbus" (version 0.7) to communicate with a Test Equity Modela 115a-F4T thermal chamber.

I am pretty new to using python to program hardware, so I am not quite sure if my approach is missing some basic initialization commands. Here is my code:

instrument = minimalmodbus.Instrument('/dev/ttyUSB1',1)
print instrument 
print minimalmodbus.BAUDRATE
minimalmodbus.BAUDRATE = 9600
print minimalmodbus.BAUDRATE
print minimalmodbus.__version__
instrument.read_register(0,1)

Here is my output:

minimalmodbus.Instrument<id=0x7fb5fd2136c8, address=1, mode=rtu, 
close_port_after_each_call=False, precalculate_read_size=True, 
debug=False, serial=Serial<id=0x7fb5fc71a890, open=True>
(port='/dev/ttyUSB1', baudrate=19200, bytesize=8, parity='N', 
stopbits=1, timeout=0.05, xonxoff=False, rtscts=False, dsrdtr=False)>
19200
9600
0.7

Traceback (most recent call last):
File "/usr/local/google/home/mimartin/Documents/test-equity/model-
115a.py", line 13, in <module>
instrument.read_register(0,1)
File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 
258, in read_register
return self._genericCommand(functioncode, registeraddress, 
numberOfDecimals=numberOfDecimals, signed=signed)
File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 
697, in _genericCommand
payloadFromSlave = self._performCommand(functioncode, payloadToSlave)
File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 
795, in _performCommand
response = self._communicate(request, number_of_bytes_to_read)
File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 
930, in _communicate
raise IOError('No communication with the instrument (no answer)')
IOError: No communication with the instrument (no answer)*

The thermal chamber is powered on. And I am connected to it over a serial to USB cable. I have also placed a null modem adapter to the serial end (on the chamber) of the cable, as indicated is necessary in the Chamber Manual. I have assumed that my first line of code is what initializes the chamber for control. However, my error message indicates otherwise.

Looking for some help or guidance here. Thank you.

2 Answers2

0

I am troubleshooting a very similar issue and it looks to me like minimalmodbus was created for RS-485 which does not use the DTR and DSR status pins (from your debug line dsrdtr=False). My hardware connection works using the free utility "Simplymodbus" so I know it is hooked up correctly. The minimalmodbus python code I am using, which is very similar to yours, looks identical to the simplymodbus request on the receive pin of the slave device when looking on an oscilloscope. However the DTR and DSR pins are behaving differently, the simplymodbus receives a response while the python minimalmodbus code does not.

I have not found any way to enable dsrdtr in the minimalmodbus code or using the RS-232 to USB converter's utility, but there seems to be options in pyserial's library. One option I will be exploring is switching to an RS-485 connection which does not use these status pins.

Alex
  • 1
0

Minimalmodbus works fine over RS-232. The Watlow F4 and F4T only use TX, RX and GND for comms with RS-232. TestEquity chambers use the RS-232 pins for both controllers (both can support 232 or 485).

The F4 only uses 16-bit integers. The F4T in map 1 mode uses floating point, 32-bit and 16-bit integers, and a "string" type. So you need different functions to read those values. Map 2 or 3 mode is F4 backwards compatibility for the common F4 registers.

Contact TestEquity at below link and they will provide Python samples for you. www.testequity.com/chambers-technical-support

On an F4T, see the modbus-rtu settings in Menu -> Settings -> Network -> Modbus

assuming 9600, none, data map 1

instrument = open_port('/dev/ttyUSB1', 1) # comport, modbus address

instrument.serial.baudrate = 9600

instrument.serial.timeout = 0.1

value = instrument.read_register(14092,0) # modbus-rtu word order in map 1 mode

print value

value should equal 1330 (High Low) or 1331 (Low High)

xerics
  • 1