# F.W. Bell 5080

Control the F.W. Bell 5080 multimeter from Python with the `FWBell5080` driver.

**Driver:** [pymeasure](https://pymeasure.readthedocs.io)  
**Type:** [Multimeters and source meters](https://dev.nominal.io/instro/instruments/type/dmm.md)  
**Manufacturer:** [F.W. Bell](https://dev.nominal.io/instro/instruments/manufacturer/f-w-bell.md)

Represents the F.W. Bell 5080 Handheld Gaussmeter and provides a high-level interface for interacting with the instrument.

## Publishing through instro

instro publishes the commands you send to a FWBell5080 and the values you read from it, through any [publisher](https://dev.nominal.io/instro/library/publishers.md). It takes two forms, both described in the [pymeasure guide](https://dev.nominal.io/instro/library/pymeasure.md). Install with `uv add "instro[pymeasure]"`.

### With a PymeasureInstrument

[`PymeasureInstrument`](https://dev.nominal.io/instro/library/pymeasure.md#write-new-instro-code) wraps the driver in an instro instrument, with tags and background polling. The instrument is created inside the `with` block, and `.device` is the pymeasure instrument.

```python
from pymeasure.instruments.fwbell import FWBell5080
from instro.pymeasure import PymeasureInstrument

with PymeasureInstrument(
    name="meter",
    instrument=FWBell5080('/dev/ttyUSB0'),
    dataset_rid="<dataset rid>",
) as meter:

    meter.device.units = 'gauss'               # Sets the measurement units to Gauss
    meter.device.range = 1                     # Sets the range to 3 kG
    print(meter.device.field)                  # Reads and prints a field measurement in G

    fields = meter.device.fields(100)          # Samples 100 field measurements
    print(fields.mean(), fields.std())  # Prints the mean and standard deviation of the samples
```

### With existing pymeasure code (`attach()`)

[`attach()`](https://dev.nominal.io/instro/library/pymeasure.md#publish-from-existing-code) adds publishing to pymeasure code you already have. The imports, the `attach()` call after the instrument is created, and `recorder.close()` are all that instro adds.

```python
from pymeasure.instruments.fwbell import FWBell5080
from instro.lib import NominalCorePublisher
from instro.pymeasure import attach

meter = FWBell5080('/dev/ttyUSB0')  # Connects over serial port /dev/ttyUSB0 (Linux)
recorder = attach(meter, "meter", [NominalCorePublisher(dataset_rid="<dataset rid>")])

meter.units = 'gauss'               # Sets the measurement units to Gauss
meter.range = 1                     # Sets the range to 3 kG
print(meter.field)                  # Reads and prints a field measurement in G

fields = meter.fields(100)          # Samples 100 field measurements
print(fields.mean(), fields.std())  # Prints the mean and standard deviation of the samples

recorder.close()  # flush and close the publishers
```

The examples are adapted from the [pymeasure documentation for `FWBell5080`](https://pymeasure.readthedocs.io/en/latest/api/instruments/fwbell/fwbell5080.html#pymeasure.instruments.fwbell.fwbell5080.FWBell5080), which lists every property and method.
