[Eric, Eleonora]
Today we installed the new 1550nm thorlabs laser in green lab. We connected it to the interlock connecting the red cable to a power strip under the optical bench where the power supplies of both lasers are currently connected.
How to turn the laser ON/OFF
Open the Command Prompt
>python
>>import serial
Verify to which COM port the device is connected (it might change after the PC restarts)
>>ser = serial.Serial('COM8', baudrate=9600)
>>ser.write(b'laser on\r')
Now the laser is on and it is emitting 100mW.
To turn it off
>>ser.write(b'laser off\r')
How to read the quieries with pyserial
>>> import serial
>>> ser = serial.Serial('COM8', baudrate = 9600)
>>> ser.write(b'laser on\r')
9
>>> ser.write(b'read_param laser_state\r')
23
>>> out = ''
>>> while ser.inWaiting() > 0:
... out += ser.read(1).decode()
...
>>> print(out)
000: OK
000: OK:60,0x0000
>>> ser.write(b'read_param laser.current\r')
25
>>> while ser.inWaiting() > 0:
... out += ser.read(1).decode() --- NB press tab before out
...
>>> print(out)
000: OK
000: OK:60,0x0000
000: OK:0.550000,0x0000
>>> ser.write(b'read_param laser_tec_ctrl.temperature\r')
38
>>> while ser.inWaiting() > 0:
... out += ser.read(1).decode()
...
>>> print(out)
000: OK
000: OK:60,0x0000
000: OK:0.550000,0x0000
000: OK:24.999786,0x0000
>>> ser.write(b'read_param fbg_tec_ctrl.temperature\r')
36
>>> while ser.inWaiting() > 0:
... out += ser.read(1).decode()
...
>>> print(out)
000: OK
000: OK:60,0x0000
000: OK:0.550000,0x0000
000: OK:24.999786,0x0000
000: OK:27.999939,0x0000