aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2022-01-05 21:42:30 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2022-01-05 21:42:30 -0500
commit5a0acbc09e600a2bbc4e2d35d8b082476b7c04c2 (patch)
tree5318e2ee5a0bb249ebd729543ce486a167dd4551
parentcbd4f3e3a89ed877e96220610c932003b0056718 (diff)
downloadqolab-5a0acbc09e600a2bbc4e2d35d8b082476b7c04c2.tar.gz
qolab-5a0acbc09e600a2bbc4e2d35d8b082476b7c04c2.zip
added temperature aquisition from newport i800 series controller
-rw-r--r--qolab/hardware/i_server/i800.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/qolab/hardware/i_server/i800.py b/qolab/hardware/i_server/i800.py
new file mode 100644
index 0000000..c42b5dd
--- /dev/null
+++ b/qolab/hardware/i_server/i800.py
@@ -0,0 +1,45 @@
+"""
+This unit talks to i-Series controllers sold by Omega and Newport.
+They are often can be connected via iServer interface
+Specifically, i853 units with LAN connection, but should be ok with many others
+"""
+
+from qolab.hardware.basic import BasicInstrument
+import socket
+
+class I800(BasicInstrument):
+ def __init__(self, *args, host='192.168.1.200', port=1000, **kwds):
+ """
+ host - default hostname or IP of the controller unit (192.168.1.200) is factory default
+ port - socket port (1000 by default) which accept HTTP POST requests
+ """
+ BasicInstrument.__init__(self, *args, **kwds)
+ self.host=host
+ self.port=port
+ self.config['Device type']='TemperatureController'
+ self.config['Device model'] = 'i800'
+ self.config['FnamePrefix'] = 'temperature'
+ self.deviceProperties = {'Temerature'}
+
+ @BasicInstrument.tsdb_append
+ def getTemperature(self):
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((self.host, self.port))
+ cmd_start_marker='*'
+ modbus_address='01'
+ command='X01'; # give decimal representation (X) of the temperature (01 address)
+ cmnd=f'POST / HTTP/1.1\r\n\r\n{cmd_start_marker}{modbus_address}{command}\r\n'
+ s.send(cmnd.encode('ascii'))
+ reply=s.recv(100).decode('ascii')
+ if reply[0:5] != '01X01':
+ # check the proper echo response
+ return None
+ t = reply[5:]
+ t = float(t)
+ return t
+
+
+if __name__ == '__main__':
+ tc = I800()
+ tc.getTemperature()
+