Lakeshore 240
The Lakeshore 240 is a 4-lead meausrement device used for readout of ROXes and Diodes at 1K and above.
usage: python3 agent.py [-h] [--serial-number SERIAL_NUMBER] [--port PORT]
[--mode {idle,init,acq}]
[--sampling-frequency SAMPLING_FREQUENCY]
Agent Options
- --serial-number
Serial number of your Lakeshore240 device
- --port
Path to USB node for the lakeshore
- --mode
Possible choices: idle, init, acq
Starting action for the agent.
- --sampling-frequency
Sampling frequency for data acquisition
Dependencies
The Lakeshore 240 requires USB drivers to be compiled for your machine. A private repository, ls240_drivers, with the required drivers is available on the Simons Observatory Github. This repository provides some other helpful tools, including a set of udev rules for setting the device address automatically when the 240s are connected to the computer.
Note
The 240 drivers are compiled for the specific kernel you are running at installation. If your kernel is updated the drivers will no longer work. The DKMS module provided by the ls24_drivers repository attempts to solve this problem, but does not currently appear to work. Please report any difficulty with the drivers to Brian.
To install the drivers clone the ls240_drivers repository and run make to
build the drivers:
$ git clone https://github.com/simonsobs/ls240-drivers.git
$ make
Update the udev rules file, 50-ls240.rules, adding an entry for your
devices’ serial numbers, then run:
$ make install_udev
If your devices were plugged in already you will need to unplug and replug them for the udev rules to properly recognize the devices and set the path and permissions appropriately. Once you complete this step they will be recongized on reboots, and the udev rules will not need to be reinstalled unless you add a new device.
Configuration File Examples
Below are configuration examples for the ocs config file and for running the Agent in a docker container.
OCS Site Config
To configure your Lakeshore 240 for use with OCS you need to add a Lakeshore240Agent block to your ocs configuration file. Here is an example configuration block that will automatically start data acquisition:
{'agent-class': 'Lakeshore240Agent',
'instance-id': 'LSA22Z2',
'arguments': [['--serial-number', 'LSA22Z2'],
['--mode', 'acq']]},
Each device requires configuration under ‘agent-instances’. See the OCS site configs documentation for more details.
Docker Compose
The Lakeshore 240 Agent can (and probably should) be configured to run in a Docker container. An example configuration is:
ocs-LSA22Z2:
image: simonsobs/socs:latest
devices:
- "/dev/LSA22Z2:/dev/LSA22Z2"
hostname: nuc-docker
environment:
- INSTANCE_ID=LSA22Z2
volumes:
- ${OCS_CONFIG_DIR}:/config:ro
The serial number will need to be updated in your configuration. The hostname should also match your configured host in your OCS configuration file. The site-hub and site-http need to point to your crossbar server, as described in the OCS documentation.
Example Clients
Device Configuration
Out of the box, the Lakeshore 240 channels are not enabled or configured
to correctly measure thermometers. To enable, you can use the
agents.lakeshore240.LS240_agent.LS240_Agent.set_values() Task of the
LS240 Agent to configure a particular channel. Below is an example of a
client that sets Channel 1 of a 240 to read a diode:
from ocs.matched_client import MatchedClient
ls_client = MatchedClient("LSA22Z2")
diode_params = {
'sensor': 1,
'autorange': 1,
'units': 3,
'enabled': 1,
}
ls_client.set_values.start(channel=1, name="CHWP_01", **diode_params)
ls_client.set_values.wait()
Agent API
- class socs.agents.lakeshore240.agent.LS240_Agent(agent, port='/dev/ttyUSB0', f_sample=2.5)[source]
- init_lakeshore(auto_acquire=False)[source]
Task - Perform first time setup of the Lakeshore 240 Module.
- Parameters:
auto_acquire (bool, optional) – Starts data acquisition after initialization if True. Defaults to False.
- set_values(channel, sensor=None, auto_range=None, range=None, current_reversal=None, units=None, enabled=None, name=None)[source]
Task - Set sensor parameters for a Lakeshore240 Channel.
- Parameters:
channel (int) – Channel number to set. Valid choices are 1-8.
sensor (int, optional) – Specifies sensor type. See
socs.Lakeshore.Lakeshore240.Channel.set_values()for possible types.auto_range (int, optional) – Specifies if channel should use autorange. Must be 0 or 1.
range (int, optional) – Specifies range if auto_range is false. Only settable for NTC RTD. See
socs.Lakeshore.Lakeshore240.Channel.set_values()for possible ranges.current_reversal (int, optional) – Specifies if input current reversal is on or off. Always 0 if input is a diode.
units (int, optional) – Specifies preferred units parameter, and sets the units for alarm settings. See
socs.Lakeshore.Lakeshore240.Channel.set_values()for possible units.enabled (int, optional) – Sets if channel is enabled.
name (str, optional) – Sets name of channel.
- get_values(channel)[source]
Task - Get the set values for a particular channel.
- Parameters:
channel (int) – Channel to get the set sensor type, range, auto_range, current_reversal, units, and enabled values for. Valid values for channel are 1-8.
The most recent data collected is stored in session data in the structure:
>>> response.session['data'] {"fields": {"sensor": "Diode", "range": 1000, "auto_range": True, "current_reversal": True, "unit": "K", "enabled": True}, "timestamp":1601925677.6914878}
- upload_cal_curve(channel, filename)[source]
Task - Upload a calibration curve to a channel.
- Parameters:
channel (int) – Channel number, 1-8.
filename (str) – Filename for calibration curve.
- acq(sampling_frequency=2.5)[source]
Process - Start data acquisition.
- Parameters:
sampling_frequency (float) – Sampling frequency for data collection. Defaults to 2.5 Hz
The most recent data collected is stored in session data in the structure:
>>> response.session['data'] {"fields": {"Channel_1": {"T": 99.26, "V": 99.42}, "Channel_2": {"T": 99.54, "V": 101.06}, "Channel_3": {"T": 100.11, "V":100.79}, "Channel_4": {"T": 98.49, "V": 100.77}, "Channel_5": {"T": 97.75, "V": 101.45}, "Channel_6": {"T": 99.58, "V": 101.75}, "Channel_7": {"T": 98.03, "V": 100.82}, "Channel_8": {"T": 101.14, "V":101.01}}, "timestamp":1601925677.6914878}
Supporting APIs
- class socs.Lakeshore.Lakeshore240.Module(port='/dev/tty.SLAB_USBtoUART', baud=115200, timeout=10)[source]
Allows communication to Lakeshore Module. Contains list of inputs which can be read from.
- class socs.Lakeshore.Lakeshore240.Channel(ls, channel_num)[source]
Object for each channel of the lakeshore module
- channel_num
The number of the channel (1-8). This should not be changed once set
- Type:
int
- name
Specifies name of channel
- Type:
str
- sensor
1 = Diode, 2 = PlatRTC, 3 = NTC RTD
- Type:
int
- auto_range
Specifies if channel should use autorange (1,0).
- Type:
int
- range
Specifies range if auto_range is false (0-8). Range is accoriding to Lakeshore docs.
- Type:
int
- current_reversal
Specifies if current reversal should be used (0, 1). Should be 0 for diode.
- Type:
int
- unit
1 = K, 2 = C, 3 = Sensor, 4 = F
- Type:
int
- enabled
Sets whether channel is enabled. (1,0)
- Type:
int
- set_values(sensor=None, auto_range=None, range=None, current_reversal=None, unit=None, enabled=None, name=None)[source]
Sets Channel parameters after validation.
- Parameters:
channel (int) – Channel number to set. Valid choices are 1-8.
sensor (int, optional) –
Specifies sensor type:
1
Diode
2
PlatRTC
3
NTC RTD
auto_range (int, optional) – Specifies if channel should use autorange. Must be 0 or 1.
range (int, optional) –
Specifies range if auto_range is false. Only settable for NTC RTD:
0
10 Ohms (1 mA)
1
30 Ohms (300 uA)
2
100 Ohms (100 uA)
3
300 Ohms (30 uA)
4
1 kOhm (10 uA)
5
3 kOhms (3 uA)
6
10 kOhms (1 uA)
7
30 kOhms (300 nA)
8
100 kOhms (100 nA)
current_reversal (int, optional) – Specifies if input current reversal is on or off. Always 0 if input is a diode.
units (int, optional) –
Specifies preferred units parameter, and sets the units for alarm settings:
1
Kelvin
2
Celsius
3
Sensor
4
Fahrenheit
enabled (int, optional) – Sets if channel is enabled.
name (str, optional) – Sets name of channel.
- get_values()[source]
Returns the values set for this channel.
See set_values for value meanings/interpretations.
- get_reading(unit=None)[source]
Get a reading from the channel in the specified units.
If no unit is provided, use the one determined by the channel settings.
- Parameters:
unit (str) – Units for reading, options are Kelvin (K), Celcius (C), Fahrenheit (F), or Sensor (S)
- class socs.Lakeshore.Lakeshore240.Curve(filename=None, header=None, breakpoints=None)[source]
Header for calibration curve:
:Sensor Model: Name of curve :Serial Number: Serial Number :Data Format: 2 = V:K, 3 = Ohms:K, 4 = log(Ohms):K :SetPoint Limit: Temperature Limit (in K) :Temperature Coefficient: 1 = negative, 2 = positive :Number of Breakpoints: Number of curve points