-
Notifications
You must be signed in to change notification settings - Fork 0
Sylphium
Markus Grönholm edited this page Jun 15, 2026
·
3 revisions
python -mpip install pyserial alshain
- Connect usb data cable to Data in or Data out port
- Connect power adapter to Sylphium
- Make sure that interlock connections are set correctly
import alshain
import serial
# replace "COM3" with corresponding port on your computer
com = serial.Serial( "COM3", 460800, timeout = 10.0 )
# Connect to laser driver with address = 1 (default)
laser = alshain.Sylphium( com, address = 1 )
# Set driver operating range to 3A
laser.write( alshain.Sylphium.Parameters.IRANGE, alshain.Sylphium.Options.IRANGE_3A )
# Set laser diode drive voltage to 12 V
laser.write( alshain.Sylphium.Parameters.V_SET, 12.0 )
# Set diode current limit to 250mA
laser.write( alshain.Sylphium.Parameters.I_LIMIT, 250e-3 )
# Enable laser output
laser.enable_output( True )
# Use either external or internal modulation to drive the diode
# Disable laser
laser.enable_output( False )# Set limits and diode supply voltage
laser.write( alshain.Sylphium.Parameters.I_LIMIT, 0.2) # Set current limit to 0.2A
laser.write( alshain.Sylphium.Parameters.V_SET, 5.0 ) # Set diode supply voltage to 5V
laser.write( alshain.Sylphium.Parameters.TRIG_LVL, 0.025 ) # Set internal trigger level to 25mA
# Set operating range to 300mA
laser.write( alshain.Sylphium.Parameters.IRANGE, alshain.Sylphium.Options.IRANGE_300mA )
# Enable main power supply
laser.enable_main_power( True ) # enables main power supply but not the drive circuitry
# Enables both main power supply and the drive circuitry
# (OBS! enable works only if interlock is ok)
laser.enable_output( True )
laser.enable_main_power( False ) # Disables main power supply
laser.enable_output( False ) # Disables diode drive circuitry
# Modulation
laser.constant_current( 0.1 ) # Drive the diode with 0.1A constant current
laser.modulation( True ) # Turn on internal modulation
laser.modulation( False ) # Turn off the internal modulation
# Turn on the modulation for one modulation buffer round
laser.modulation( True, single_shot = True )
# note: Waveform buffer is 1000 samples long
# Fill waveform buffer with sine wave
# generate_sine( amplitude, offset, frequency, phase = 0, sample_period = 1000 )
# amplitude = amplitude of the sine wave (in amps)
# offset = dc current offset for the wave (in amps)
# frequency = how many periods will be generate to the waveform buffer
# phase = phase offset of the sine wave (in radians)
# sample_period = duration of each sample (in µs)
laser.generate_sine( 0.1, 0.05, 1.0, sample_period = 1 )
# Fill waveform buffer with pulse wave
# generate_pulse( amplitude, offset, duty_cycle, sample_period = 1000 )
# amplitude = amplitude of the pulse (in amps)
# offset = dc current offset of the pulse (in amps)
# duty_cycle = relative pulse on time (0...1)
# sample_period = duration of each sample (in µs)
laser.generate_pulse( 0.1, 0.05, 0.15 )
### Examples
# 80µs pulses with 25Hz repeat rate (100mA amplitude, 25mA DC offset)
laser.generate_pulse( 0.1, 0.025, 0.002, sample_period = 40 )
# 100µs pulses with 50Hz repeat rate (100mA amplitude, 25mA DC offset)
laser.generate_pulse( 0.1, 0.025, 0.005, sample_period = 20 )
# 10µs pulses with 1kHz repeat rate (100mA amplitude, 25mA DC offset)
laser.generate_pulse( 0.1, 0.025, 0.01, sample_period = 1 )
# 25ms pulses with 1Hz repeat rate (100mA amplitude, 25mA DC offset)
laser.generate_pulse( 0.1, 0.025, 0.025, sample_period = 1000 )
## Generating pulses with >1kHz repeat rate:
# Waveform buffer length needs to be adjusted to increase repeat rate.
# (Default length for the waveform buffer is 1000 samples)
# 10µs pulse (100mA amplitude, 25mA DC offset) with 5kHz repeat rate
laser.generate_pulse( 0.1, 0.025, 0.01, sample_period = 1 )
laser.write( alshain.Sylphium.Parameters.MOD_LENGTH, 200 ) # 1/(200*1µs) = 5kHz
# 10µs pulse (100mA amplitude, 25mA DC offset) with 10kHz repeat rate
laser.generate_pulse( 0.1, 0.025, 0.01, sample_period = 1 )
laser.write( alshain.Sylphium.Parameters.MOD_LENGTH, 100 ) # 1/(100*1µs) = 10kHz
# 10µs pulse (100mA amplitude, 25mA DC offset) with ~15.2kHz repeat rate
laser.generate_pulse( 0.1, 0.025, 0.01, sample_period = 1 )
laser.write( alshain.Sylphium.Parameters.MOD_LENGTH, 66 ) # 1/(66*1µs) = 15.152kHzlaser.read( alshain.Sylphium.Parameters.I_MEAS ) # Measured current [A]
laser.read( alshain.Sylphium.Parameters.VIN ) # Power supply input voltage [V]
laser.read( alshain.Sylphium.Parameters.V_MON_LP ) # Diode high side voltage [V]
laser.read( alshain.Sylphium.Parameters.V_MON_LM ) # Diode low side voltage [V]
laser.read( alshain.Sylphium.Parameters.EXT_PD ) # External photodiode control voltage [V]
laser.read( alshain.Sylphium.Parameters.EXT_MOD ) # External modulation control voltage [V]
laser.read( alshain.Sylphium.Parameters.PD_SIGNAL ) # Photodiode current [A]
laser.read( alshain.Sylphium.Parameters.OUTPUT_EN ) # 0 -> output disabled, 1 -> output enabled
laser.read( alshain.Sylphium.Parameters.POWER_OK ) # 0 -> main power not ok, 1 -> main power is ok
laser.read( alshain.Sylphium.Parameters.TEMP_0 ) # Internal temperature sensor reading [C]
laser.read( alshain.Sylphium.Parameters.TEMP_1 ) # Internal temperature sensor reading [C]
laser.read( alshain.Sylphium.Parameters.TEMP_2 ) # Internal temperature sensor reading [C]
# 0 -> interlock is not ok, 1 -> interlock is ok
laser.read( alshain.Sylphium.Parameters.INTERLOCK_OK )
# 0 -> laser cannot be enabled, 1 -> laser can be enabled
laser.read( alshain.Sylphium.Parameters.LASER_OK )
laser.read( alshain.Sylphium.Parameters.TRIGGER_CNT ) # Counter for trigger events
laser.write( alshain.Sylphium.Parameters.V_SET, 10.0 ) # Set diode drive voltage, 3 .. Vin - 4 [V]
laser.write( alshain.Sylphium.Parameters.I_LIMIT 0.1 ) # Set current limit [A]
laser.write( alshain.Sylphium.Parameters.TRIG_LVL 0.025 ) # Set trigger level [A]
laser.write( alshain.Sylphium.Parameters.PD_THOLD, 1e-5 ) # Set photodiode control current threshold [A]
# set trigger output polarity
# TRIGGER_POL_POS = positive
# TRIGGER_POL_NEG = inverted
laser.write( alshain.Sylphium.Parameters.TRIG_POL, alshain.Sylphium.Options.TRIGGER_POL_POS )
# Set operating range ( IRANGE_3A or IRANGE_300mA )
laser.write( alshain.Sylphium.Parameters.IRANGE, alshain.Sylphium.Options.IRANGE_3A )
# 0 -> photodiode amplifier is disabled, 1 -> amplifier is enabled
laser.write( alshain.Sylphium.Parameters.PD_EN, 0 )
# Set photodiode amplifier gain
# PD_GAIN_1k
# PD_GAIN_10k
# PD_GAIN_100k
# PD_GAIN_1M
laser.write( alshain.Sylphium.Parameters.PD_GAIN, alshain.Sylphium.Options.PD_GAIN_10k )
# Set photodiode bias voltage (PD_BIAS_0V or PD_BIAS_5V)
laser.write( alshain.Sylphium.Parameters.PD_BIAS, alshain.Sylphium.Options.PD_BIAS_0V )
# 0 -> main power is not enabled, 1 -> main power is enabled
laser.read( alshain.Sylphium.Parameters.POWER_EN )
laser.read( alshain.Sylphium.Parameters.PD_AVG ) # Average photodiode current [A]
laser.read( alshain.Sylphium.Parameters.PD_RMS ) # Photodiode RMS current [A]
laser.read( alshain.Sylphium.Parameters.I_AVG ) # Average drive current [A]
laser.read( alshain.Sylphium.Parameters.I_RMS ) # RMS drive current [A]
laser.read( alshain.Sylphium.Parameters.VD_AVG ) # Average voltage drop over diode [V]
laser.read( alshain.Sylphium.Parameters.VD_RMS ) # RMS voltage drop over diode [V]
laser.read( alshain.Sylphium.Parameters.P_AVG ) # Average electrical power delivered to diode [W]
laser.read( alshain.Sylphium.Parameters.P_RMS ) # RMS electrical power delivered to diode [W]
laser.read( alshain.Sylphium.Parameters.VDROP ) # Current voltage drop over diode [V]
# 0 -> disable photodiode regulation, 1 -> enable photodiode regulation
laser.write( alshain.Sylphium.Parameters.PD_CTRL, 0 )
# State of the digital input signal (secondary interlock input)
laser.read( alshain.Sylphium.Parameters.IO_IN )
# State of the optocoupled input signal (primary interlock input )
laser.read( alshain.Sylphium.Parameters.OPTO_IN )
laser.write( alshain.Sylphium.Parameters.IO_OUT, 0 ) # Set state of the digial output signal
laser.write( alshain.Sylphium.Parameters.OPTO_OUT, 0 ) # Set state of the optocoupler output signal
# Select interlock strategy
# INTERLOCK_NORMAL = only primary
# INTERLOCK_SECONDARY = require both primary and secondary interlock inputs,
# INTERLOCK_SECONDARY_INV, same as INTERLOCK_SECONDARY but secondary input is inverted )
laser.write( alshain.Sylphium.Parameters.INTERLOCK_STRATEGY, alshain.Sylphium.Options.INTERLOCK_NORMAL )
laser.write( alshain.Sylphium.Parameters.INTERLOCK_DELAY, 2000 ) # Interlock delay [ms]
laser.read( alshain.Sylphium.Parameters.SERIAL_NUMBER ) # Serial number of the device
laser.read( alshain.Sylphium.Parameters.FIRMWARE_VER ) # Firmware version of the device
laser.read( alshain.Sylphium.Parameters.UPTIME ) # Device uptime [ms]