thinkSRS / srsinst.sr860

Python instrument driver for SRS SR860 series lock-in amplifiers
MIT License
2 stars 2 forks source link

Sr830 compatibility #7

Open earik87 opened 1 month ago

earik87 commented 1 month ago

Hello!

Thanks for this project. I am wondering if I can use these codes to run our sr830 which is connected from its rs232 to usb port in our computer?

srsrga commented 2 weeks ago

This project uses SR860 remote commands to communicate with an SR860. SR860 remote commands are not compatible with SR830 commands.

abergerSRS commented 2 weeks ago

Even though this driver can't be used with an SR830, you can use Python to communicate with an SR830. See examples below.

Serial Communication via RS232

import serial
sr830 = serial.Serial('COM7', baudrate=9600, timeout=5)

# Configure instrument to respond via RS232
sr830.write(b'OUTX 0\n')    

# Identify the instrument to confirm communications
sr830.write(b'*IDN?\n')
print(sr830.read_until(b'\r'))

# Query the X value and store as a float
sr830.write(b'OUTP? 1\n')
x = float(sr830.read_until(b'\r'))

GPIB communication via PyVisa

import pyvisa as visa
rm = visa.ResourceManager()

address = 8
resourceString = ("GPIB::%d::INSTR"%address)
sr830 = rm.open_resource(resourceString)

# Configure interface to send responses via GPIB
sr830.write('OUTX 1')

# Identify the instrument
print(sr830.query('*IDN?'))

# Query X value and convert to float
x_value = float(sr830.query("OUTP? 1"))

If you are so inclined, you could try to re-write the SR860 driver for the SR830 command set and features.