Device

Serial communication with a MultispeQ device to take measurements using protocols and send commands.

Serial Connection

Establish serial communication with MultispeQ device.

connect(port=None, baudrate=115200, timeout=None)[source]

Connect a MultspeQ device to a serial port.

Parameters:
  • port (str) – Port the MultisepQ is connected to.

  • baudrate (int) – Set the baudrate. Default is 115,200.

  • timeout (float) – Set the timeout. Derault is 0.01

Returns:

Serial connection or None if connection fails.

Return type:

serial

Raises:
  • ValueError – if port is not defined

  • ValueError – if port is not provided as a string

  • ValueError – if baudrate is not defined or provided as an integer

  • ValueError – if timeout is not provided as a float

  • SerialExeption – if device is not connected

disconnect(connection=None)[source]

Disconnect device from serial port.

Parameters:

connection (serial) – Connection to the MultispeQ.

Returns:

None

get_ports()[source]

List available serial ports.

Returns:

None

Commands

Commands are raw communication with the MultispeQ device.

is_connected(connection=None)[source]

Test the connection to a MultispeQ.

Parameters:

connection (serial) – Connection to the MultispeQ.

Returns:

True if a MultispeQ is connected, otherwise False

Return type:

bool

Raises:

ValueError – if no connection is defined

info(connection=None, verbose=True, include_config=False)[source]

Get the MultispeQ instrument information.

Parameters:
  • connection (serial) – Connection to the MultispeQ.

  • verbose (bool) – Print out data (default: True)

  • include_config (bool) – Include device config in printed information (default: False)

Returns:

Instrument Information

Return type:

dict

Raises:
  • ValueError – if verbose is not a boolean

  • ValueError – if baudrate is not a boolean

get_memory(connection=None, verbose=False)[source]

Get the MultispeQ setting saved in its memory (EEPROM).

Parameters:
  • connection (serial) – Connection to the MultispeQ.

  • verbose (bool) – Print out data (default: False)

Returns:

Instrument memory

Return type:

dict

send_command(connection=None, command='', verbose=False, is_silent=False)[source]

Send a command to a MultispeQ device.

Parameters:
  • connection (serial) – Connection to the MultispeQ.

  • command (str) – Command

  • verbose (bool) – Print output (default: False)

  • is_silent (bool) – Command will not return a response (default: False)

Returns:

Instrument output

Return type:

str

Raises:
  • ValueError – if no connection is defined

  • ValueError – if command is not provided as a string

  • Exception – if connection is not open or device connected

Settings

Settings for the MultispeQ device.

Most of the MultispeQ settings can be accessed and changed using the jii_multispeq.device.command.send_command() function. For convenience and to make some of the more frequenetly used settings more accessible through the functions below.

Example:

import jii_multispeq.device as _device
import jii_multispeq.device.settings as _settings

## Establish connection
_connection = _device.connect( "/com1" )

## Settings without a parameter
_settings.clamp_closed( _connection )

## Settings with a parameter
_settings.pilot_blink( _connection, "off" )
set_clamp_open(connection)[source]

Calibrate the open leaf clamp position. Hold the clamp open at approximately ~4mm and run the function to set the position.

Parameters:

connection (serial) – Connection to the MultispeQ.

Returns:

None

set_clamp_closed(connection)[source]

Calibrate the closed leaf clamp position. Hold the clamp open at approximately ~2mm and run the function to set the position.

Parameters:

connection (serial) – Connection to the MultispeQ.

Returns:

None

calibrate_compass(connection)[source]

Calibrate the Instruments compass. Hold the device and move it in a steady spherical motion to calibrate the internal compass after starting the calibration.

Parameters:

connection (serial) – Connection to the MultispeQ.

Returns:

None

set_shutdown_time(connection, seconds=1800)[source]

Shut down time to power down the device. It automatically shuts down after 30 minutes by default. Hold the button for ~10s to restart it after shutdown. Adjust this timing by selecting a different shutdown interval.

Time in Minutes

Setting (seconds)

10 min

600 (minimum)

30 min

1800

60 min

3600

2 hr

7200

Parameters:
  • connection (serial) – Connection to the MultispeQ.

  • seconds (int) – Shutdown time in seconds.

Returns:

None

Raises:

ValueError – if baudrate is not defined or provided as an integer

Example:

# Set shut down time to 30 min
set_shutdown_time( _connection, 1800 )

Device active. Blink the indicator light every 10 seconds to show that the device remains active.

Parameters:
  • connection (serial) – Connection to the MultispeQ.

  • state (int or string) – On/Off (on, 1) (off,0).

Returns:

None

Raises:

ValueError – if state is not on, 1 or off, 0

Example:

# Keep device powered while connected to USB
set_pilot_blink( _connection, "on" )
set_usb_on(connection, state='on')[source]

USB connection. The device stays powered while connected via USB and will only shut down automatically after disconnection based on the configured shutdown time.

Parameters:
  • connection (serial) – Connection to the MultispeQ.

  • state (int or string) – On/Off (on, 1) (off,0).

Returns:

None

Example:

# Turn on pilot blink
set_usb_on( _connection, "on" )
power_off(connection)[source]

Turn off the Instrument completely.

Parameters:

connection (serial) – Connection to the MultispeQ.

Returns:

None

check_caliq_connection(connection)[source]

Check if the CaliQ and Instrument are properly communicating.

Parameters:

connection (serial) – Connection to the MultispeQ.

Returns:

None