FUTEK Device Communication
This module provides communication interfaces for FUTEK serial devices.
Custom Exceptions
- class futek_device_communication.FutekDeviceError
Bases:
ExceptionBase exception for all FUTEK device errors
- class futek_device_communication.FutekConnectionError
Bases:
FutekDeviceErrorRaised when connection/disconnection fails
- class futek_device_communication.FutekCommunicationError
Bases:
FutekDeviceErrorRaised when serial communication fails
- class futek_device_communication.FutekTimeoutError
Bases:
FutekCommunicationErrorRaised when a command times out
- class futek_device_communication.FutekProtocolError
Bases:
FutekDeviceErrorRaised when protocol/checksum validation fails
- class futek_device_communication.FutekInvalidParameterError
Bases:
FutekDeviceErrorRaised when invalid parameters are provided
- class futek_device_communication.FutekDeviceNotFoundError
Bases:
FutekDeviceErrorRaised when device discovery fails
- class futek_device_communication.FutekCalibrationError
Bases:
FutekDeviceErrorRaised when calibration data is invalid or missing
FUTEK Serial Scanner
- class futek_device_communication.FutekSerialScanner
FUTEKSerialScanner handles discovery operations for FUTEK devices.
- classmethod discover_devices(cls, device_models=None, comports=None)
Discovers Futek serial devices.
- Parameters:
device_models – Device model types to search for.
comports – Specific comports to scan.
- Returns:
Futek devices discovered during scan.
FUTEK Device
- class futek_device_communication.FutekDevice(communication_interface, *, _internal_token=None)
Represents a FUTEK device.
Note
Do not instantiate FutekDevice directly. Use FutekSerialScanner.discover_devices() to obtain FutekDevice instances. Direct instantiation is not supported and will raise TypeError.
- Example:
>>> devices = FutekSerialScanner.discover_devices() >>> if devices: ... device = devices[0]
- disconnect(self)
Disconnects from the FUTEK device.
- get_adc_converter(self)
- get_adc_for_profile(self, profile_number)
- get_auto_teds(self)
Check if AutoTEDS is enabled on the device.
Automatically uses correct command version based on firmware version.
- Returns:
True if AutoTEDS enabled, False otherwise
- Raises:
FutekTEDSNotSupportedError – If device doesn’t support TEDS
FutekCommunicationError – If communication fails
- get_board_temperature(self)
Gets the board temperature of the device.
- Returns:
Device Board Temperature in degrees Celsius.
- get_device_channel_selected_profile(self, channel_number=0)
Gets the selected profile number for the specified channel.
- Parameters:
channel_number – Channel number to query.
- Returns:
Selected profile number as integer.
- get_instrument_serial_number(self)
Gets the instrument serial number.
- Returns:
Instrument serial number.
- get_load_of_loading_point(self, point_index, channel_number=0)
Gets the load value at a specific loading point.
- Parameters:
point_index – Index of the loading point.
channel_number – Channel number to query.
- Returns:
Load value as float.
- get_loading_point_value(self, point_index, channel_number=0)
Gets the ADC value at a specific loading point.
- Parameters:
point_index – Index of the loading point.
channel_number – Channel number to query.
- Returns:
ADC value as integer.
- get_model_number(self)
Gets the device model number.
- Returns:
Device model number as string.
- get_ndr(self, channel_number=0)
Returns normal data request for channel number.
- Parameters:
channel_number – Channel number to retrieve data request.
- Returns:
ADC value
- Raises:
FutekCommunicationError – If communication fails
- get_number_of_directions(self, channel_number=0)
Gets the number of load directions for the specified channel.
- Parameters:
channel_number – Channel number to query.
- Returns:
Number of directions.
- get_number_of_loading_points(self, channel_number=0)
Gets the number of loading points for the specified channel.
- Parameters:
channel_number – Channel number to query.
- Returns:
Number of loading points.
- get_reading(self, channel_number=0)
Gets a calibrated reading from the specified channel.
- Parameters:
channel_number – Channel number to read from.
- Returns:
Calibrated load reading as float.
- Raises:
FutekCommunicationError – If communication fails
FutekCalibrationError – If ADC converter is not initialized
- get_sampling_rate(self, channel_number=0)
Gets the current sampling rate for the specified channel.
- Parameters:
channel_number – Channel number to query.
- Returns:
Current sampling rate.
- get_sensor_serial_number(self, channel_number=0)
Gets the sensor serial number for the specified channel.
- Parameters:
channel_number – Channel number to query.
- Returns:
Sensor serial number.
- get_stream_data(self)
Gets raw streaming data from the device buffer.
- Returns:
Raw data buffer as bytearray.
- get_teds_engineering_unit(self)
Get TEDS engineering unit as a string.
- Returns:
Engineering unit string (e.g., “N”, “lb”, “psi”)
- Raises:
FutekTEDSNotConnectedError – If no TEDS sensor connected
FutekCommunicationError – If communication fails
- get_teds_max_capacity(self)
Get TEDS maximum measurement capacity.
- Returns:
Maximum capacity in sensor’s native units
- Raises:
FutekTEDSNotConnectedError – If no TEDS sensor connected
FutekCommunicationError – If communication fails
- get_teds_serial_number(self)
Get TEDS sensor serial number.
- Returns:
Serial number as string
- Raises:
FutekTEDSNotConnectedError – If no TEDS sensor connected
FutekCommunicationError – If communication fails
- get_teds_template(self)
Get TEDS template/type number.
- Returns:
TEDS template number
- Raises:
FutekTEDSNotConnectedError – If no TEDS sensor connected
FutekCommunicationError – If communication fails
- get_unit_of_measure(self, channel_number=0)
Gets the unit of measure for the specified channel.
- Parameters:
channel_number – Channel number to query.
- Returns:
Unit of measure as UnitOfMeasureEnum.
- initialize_teds(self)
Initialize TEDS support during device discovery.
- post_teds_operations(self)
Restore device state after TEDS operations.
Restores cached sampling rate and waits for device to stabilize.
- Raises:
FutekCommunicationError – If communication fails
- pre_teds_operations(self)
Prepare device for TEDS operations.
Caches current sampling rate and sets to lowest rate for reliable TEDS communication.
- Raises:
FutekCommunicationError – If communication fails
- reload_teds_data(self)
Re-read TEDS data from sensor and update calibration.
This is called automatically when enabling AutoTEDS or can be called manually to refresh TEDS data.
- Raises:
FutekTEDSNotSupportedError – If device doesn’t support TEDS
FutekTEDSNotConnectedError – If no TEDS sensor connected
FutekCommunicationError – If communication fails
- set_adc_of_loading_point(self, point_index, adc_value, calibration_direction=None, channel_number=0)
Sets the ADC value for a specific loading point.
- Parameters:
point_index – Index of the loading point.
adc_value – ADC value to set.
calibration_direction – Calibration direction (reserved for future use).
channel_number – Channel number to modify.
- Raises:
FutekCommunicationError – If communication fails
- set_auto_teds(self, enabled)
Enable or disable AutoTEDS on the device.
When enabling: automatically loads TEDS data and updates calibration. When disabling: reverts to manual calibration from EEPROM.
- Parameters:
enabled – True to enable AutoTEDS, False to disable
- Raises:
FutekTEDSNotSupportedError – If device doesn’t support TEDS
FutekCommunicationError – If communication fails
- set_device_channel_selected_profile(self, channel_number, profile_number)
Sets the selected profile number for the specified channel.
- Parameters:
profile_number – Profile number to set.
channel_number – Channel number to modify.
- set_load_of_loading_point(self, point_index, load_value, channel_number=0)
Sets the load value for a specific loading point.
- Parameters:
point_index – Index of the loading point.
load_value – Load value to set.
calibration_direction – Calibration direction (reserved for future use).
channel_number – Channel number to modify.
- Raises:
FutekCommunicationError – If communication fails
- set_number_of_directions(self, number_of_directions, channel_number=0)
Sets the number of load directions for the specified channel.
- Parameters:
number_of_directions – Number of directions to set.
channel_number – Channel number to modify.
- set_sampling_rate(self, samples_per_second: Union['USB225SamplingRateEnum', 'QIA128SamplingRateEnum', 'IDC150SamplingRateEnum', 'IEM100SamplingRateEnum'], int channel_number: int = 0) None
Sets the sampling rate for the specified channel.
- Parameters:
samples_per_second – Sampling rate enum value to set.
channel_number – Channel number to modify.
- Raises:
FutekCommunicationError – If communication fails
- set_sampling_rate_value(self, samples_per_second, channel_number=0)
Sets the sampling rate for the specified channel.
- Parameters:
samples_per_second – Sampling rate value to set.
channel_number – Channel number to modify.
- Raises:
FutekCommunicationError – If communication fails
- set_stream_state(self, stream_enabled)
Sets the streaming state for the device.
- Parameters:
stream_enabled – True to enable streaming, False to disable.
- Raises:
FutekCommunicationError – If communication fails
- set_unit_of_measure(self, unit_of_measure, channel_number=0)
Sets the unit of measure for the specified channel.
- Parameters:
unit_of_measure – Unit of measure enum value to set.
channel_number – Channel number to modify.
- Raises:
FutekCommunicationError – If communication fails
- supports_teds(self)
Check if this device supports TEDS functionality.
- Returns:
True if device supports TEDS, False otherwise
- teds_is_connected(self)
Check if TEDS sensor is physically connected.
- Returns:
True if TEDS sensor is connected, False otherwise
- Raises:
FutekTEDSNotSupportedError – If device doesn’t support TEDS
If communication fails
ADC Converter
- class futek_device_communication.ADCConverter
Converts raw ADC values to calibrated load readings using loading point calibration data.
This class handles the conversion of raw analog-to-digital converter (ADC) values into calibrated engineering units based on device-specific calibration points.
Note
Do not instantiate ADCConverter directly. Use FutekDevice.get_adc_converter() or FutekDevice.get_adc_for_profile() to obtain ADCConverter instances that are properly initialized with calibration data from the device.
TEDS Data
Note
TEDS properties should be accessed through the FutekDevice class methods.
TEDS Initialization Example
The following example demonstrates how to properly initialize TEDS (Transducer Electronic Data Sheet) data and retrieve TEDS information from a device:
1def teds_scaled_reading():
2 futek_devices = FutekSerialScanner.discover_devices()
3 device: FutekDevice = futek_devices[0]
4 device.pre_teds_operations()
5 device.initialize_teds()
6 device.post_teds_operations()
7
8 reading = device.get_reading()
9
10 print(f"teds is connected: {device.teds_is_connected()}")
11 print(f"teds template: {device.get_teds_template()}")
12 print(f"teds serial number: {device.get_teds_serial_number()}")
13 print(f"teds engineering unit: {device.get_teds_engineering_unit()}")
14 print(f"teds max capacity: {device.get_teds_max_capacity()}")
15 print(f"auto teds enbaled {device.get_auto_teds()}")
Key Steps:
Discover devices - Use
FutekSerialScanner.discover_devices()to find connected devicesPre-TEDS operations - Call
device.pre_teds_operations()to prepare the deviceInitialize TEDS - Call
device.initialize_teds()to load TEDS dataPost-TEDS operations - Call
device.post_teds_operations()to complete initializationAccess TEDS data - Use
FutekDevicegetter methods to retrieve TEDS information
Available TEDS Methods on FutekDevice:
device.teds_is_connected()- Check if TEDS is connecteddevice.get_teds_template()- Get template identifierdevice.get_teds_serial_number()- Get TEDS serial numberdevice.get_teds_engineering_unit()- Get engineering unitdevice.get_teds_max_capacity()- Get maximum capacitydevice.get_auto_teds()- Check if auto-TEDS is enabled
Stream Data Converter
- class futek_device_communication.StreamReading(calibrated_value, adc_value)
Single reading from stream data.
- adc_value
adc_value: ‘unsigned long’
- calibrated_value
calibrated_value: ‘double’
- class futek_device_communication.StreamConversionResult(readings, remainder)
Result from stream data conversion.
- readings
readings: list
- remainder
remainder: bytearray
- class futek_device_communication.StreamDataConverter
Utility class for converting raw streaming data into calibrated readings.
Provides methods to parse and validate streaming data packets from FUTEK devices, converting raw byte streams into tuples of (calibrated_reading, adc_value). Implements checksum validation to detect corrupted packets and handles partial data buffers for continuous streaming operations.
- static convert_stream_data_to_reading(data, adc_converter)
Convert stream data with validation and error logging.
- Parameters:
data – Raw stream data
adc_converter – ADC converter instance or callable
- Returns:
StreamConversionResult containing readings and remainder bytes
- static convert_stream_data_to_reading_38_kHz(data, adc_converter)
Convert stream data for USB225 at 38.4kHz with validation and error logging.
- Parameters:
data – Raw stream data
adc_converter – ADC converter instance or callable
- Returns:
StreamConversionResult containing readings and remainder bytes
Unit of Measure Enum
- class futek_device_communication.UnitOfMeasureEnum(*values)
Available units of measure for FUTEK devices.
Supports various measurement units including: - Force: lb, N, kg, oz, gram, dyn, kN, mN - Torque: Nm, Ncm, Nmm, inch_lb, inch_oz, ft_lb, kg_cm, kg_m, kNm - Pressure: psi, bar, Pa, kPa, MPa, atm, mbar, mm_Hg, inch_H2O, ft_H2O - Distance: mm, cm, dm, m, km, inch, ft, yd, mi - Temperature: C, F, K, Ra - Electrical: V, mV, uV, nV, kV, A, mA, uA, mVV, Ohms - Mass: g, mg, ug, kg, MT, ST, LT
Sampling Rate Enums
USB225 Sampling Rates
- class futek_device_communication.USB225SamplingRateEnum(*values)
Sampling rates available for USB225 devices.
Supports rates from 2.5 SPS to 38,400 SPS.
Note: The 38,400 SPS rate (SPS_38400) is only available on USB225 Pro Elite.
Available rates: 2.5, 5, 10, 16.6, 20, 50, 60, 100, 400, 1200, 2400, 4800, 7200, 14000, 19200, 38400 samples per second.
Example Usage:
from futek_device_communication import USB225SamplingRateEnum
# Set sampling rate to 100 SPS
device.set_sampling_rate(USB225SamplingRateEnum.SPS_100)
# Set sampling rate to 2400 SPS
device.set_sampling_rate(USB225SamplingRateEnum.SPS_2400)
QIA128 Sampling Rates
- class futek_device_communication.QIA128SamplingRateEnum(*values)
Sampling rates available for QIA128 devices.
Supports rates from 4 SPS to 1300 SPS.
Available rates: 4, 20, 50, 100, 200, 500, 850, 1300 samples per second.
Example Usage:
from futek_device_communication import QIA128SamplingRateEnum
# Set sampling rate to 100 SPS
device.set_sampling_rate(QIA128SamplingRateEnum.SPS_100)
# Set sampling rate to 500 SPS
device.set_sampling_rate(QIA128SamplingRateEnum.SPS_500)
IDC150 Sampling Rates
- class futek_device_communication.IDC150SamplingRateEnum(*values)
Sampling rates available for IDC150 devices.
Supports rates from 4 SPS to 1300 SPS.
Available rates: 4, 20, 50, 100, 200, 500, 850, 1300 samples per second.
Example Usage:
from futek_device_communication import IDC150SamplingRateEnum
# Set sampling rate to 100 SPS
device.set_sampling_rate(IDC150SamplingRateEnum.SPS_100)
# Set sampling rate to 850 SPS
device.set_sampling_rate(IDC150SamplingRateEnum.SPS_850)
IEM100 Sampling Rates
- class futek_device_communication.IEM100SamplingRateEnum(*values)
Sampling rates available for IEM100 devices.
Supports rates from 4 SPS to 1300 SPS.
Available rates: 4, 20, 50, 100, 200, 500, 850, 1300 samples per second.
Example Usage:
from futek_device_communication import IEM100SamplingRateEnum
# Set sampling rate to 100 SPS
device.set_sampling_rate(IEM100SamplingRateEnum.SPS_100)
# Set sampling rate to 850 SPS
device.set_sampling_rate(IEM150SamplingRateEnum.SPS_850)