Your first device
A new workspace has no devices yet, so the dashboard starts empty. To look around first, click Load the demo setup there (simulated instruments, a dashboard and a procedure; remove them whenever you like) and skip to arrange a dashboard. To build your own, read on:


In this step you add a pressure gauge that runs on simulated values. It needs no hardware, and later you replace the simulation with the code for your real instrument.
-
Open the Devices page and scroll to Drivers and click New Python driver….
-
Choose Pressure gauge, name it
vacuum_gauge, and set Connection to how your instrument is connected (here: serial port; the choices are Serial port, Network (TCP), VISA and Other). For a serial port, TCP or VISA the new file already has the code that opens it (withlaborchestra.transport) and its dependencies; it runs on simulated values until you switchsimulateoff: either in the file (the linesimulate = True) or, without touching the file, as an option of the device (the menu ⋯ of the device on the Devices page, Change…). The option wins over the file.

Names are written in
snake_case: lower-case letters, digits and underscores. The name is how scripts reach the device (lab.vacuum_gauge), so pick one that says what it is in your lab. -
Click Create. LabOrchestra writes
devices/vacuum_gauge.pyinto your workspace, prepares a Python environment for it (the first time this takes a minute), and starts it.

-
Click Done. The device is in the list, with the status ready.


Go back to the Dashboard: the gauge is there, with its two pressures changing slowly. The two channels are numbered 0 and 1: channels (and everything else in LabOrchestra that is a list) are counted from zero, in the dashboard, in scripts and in recordings.


What you just made
Section titled “What you just made”devices/vacuum_gauge.py is an ordinary Python file:
from laborchestra import Devicefrom laborchestra.profiles import PressureSensor
class VacuumGauge(Device): profiles = [PressureSensor]
port: str = "" # options: set them on the Devices page baudrate: int = 9600 simulate = True # no hardware: pressures that drift poll_s = 1.0
state = {"simulated": False, "channels": []}
def run(self): while self.running: self.state["channels"] = [{"pressure": p if s == "ok" else None, "status": s} for s, p in self._read()] self.sleep(self.poll_s)- Options are class attributes (
port,baudrate,simulate,poll_s). You set them per device on the Devices page: the menu (⋯) of the device, Change…. stateis what everyone sees. Whatever you put into it appears on the dashboard, in scripts and in recordings, without any further code.profiles = [PressureSensor]says that this is a pressure gauge, so the dashboard offers the widgets for pressures.
The places marked TODO in the file are where the code for your instrument goes. When you save the file, the Devices page shows file changed, and Restart runs the new code.
Devices that already exist
Section titled “Devices that already exist”Add device… on the Devices page adds a device that has already been written. Choose from one list:
- a Python file of the workspace,
- a Python driver that comes with LabOrchestra, such as Elliptec or the SCPI generator. It is used where it is and updated with LabOrchestra. If you need to change one, choose Change… on the device and then Make my own copy to change it…,
- a C# driver built into LabOrchestra, such as the PicoScope oscilloscopes, or one from a plugin.
The form for the options is generated from the device itself. For a Python package (for example from PyPI) or a device on another computer, choose the kind Package or Remote at the top of the dialog. The dialog also has a link to write a new Python driver instead.
Next: arrange a dashboard.
Something wrong or missing on this page? Open a GitHub issue or use the form (no account needed).