Skip to main content

Class Spm1x

Represents a Temco Controls SPM1-X Single Phase Current/Voltage sensor that communicates via Modbus RTU protocol. This sensor provides real-time monitoring of electrical current and voltage measurements.

Assembly: Spm1x.dll​
View Source​
Declaration
public class Spm1x : ISpm1x, ICurrentSensor, ISensor<Current>, IVoltageSensor, ISensor<Voltage>, ISensor

Implements:
Meadow.Foundation.Sensors.Power.ISpm1x, Meadow.Peripherals.Sensors.ICurrentSensor, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>, Meadow.Peripherals.Sensors.IVoltageSensor, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Voltage>, Meadow.Peripherals.Sensors.ISensor

Properties​

ModbusAddress​

Gets the Modbus address of the sensor device

View Source​
Declaration
public byte ModbusAddress { get; }

SerialNumber​

Gets the serial number of the sensor device

View Source​
Declaration
public int SerialNumber { get; }

SoftwareVersion​

Gets the software/firmware version of the sensor

View Source​
Declaration
public int SoftwareVersion { get; }

ProductModel​

Gets the product model identifier of the sensor

View Source​
Declaration
public byte ProductModel { get; }

HardwareRevision​

Gets the hardware revision of the sensor

View Source​
Declaration
public byte HardwareRevision { get; }

Current​

Gets the current measurement from the sensor (synchronous property)

View Source​
Declaration
public Current? Current { get; }

Voltage​

Gets the voltage measurement from the sensor (synchronous property)

View Source​
Declaration
public Voltage? Voltage { get; }

Methods​

ReadCurrent()​

Asynchronously reads the current measurement from the sensor

View Source​
Declaration
public ValueTask<Current> ReadCurrent()
Returns​

System.Threading.Tasks.ValueTask<Meadow.Units.Current>: A task containing the current measurement in Amps

Exceptions​

Meadow.Modbus.ModbusException
Thrown when communication with the sensor fails System.TimeoutException
Thrown when the sensor does not respond within the timeout period

ReadVoltage()​

Asynchronously reads the voltage measurement from the sensor

View Source​
Declaration
public ValueTask<Voltage> ReadVoltage()
Returns​

System.Threading.Tasks.ValueTask<Meadow.Units.Voltage>: A task containing the voltage measurement in Volts

Exceptions​

Meadow.Modbus.ModbusException
Thrown when communication with the sensor fails System.TimeoutException
Thrown when the sensor does not respond within the timeout period

GetBaudRate()​

Gets the Modbus communication bitrate the sensor is configured to use

View Source​
Declaration
public Task<int> GetBaudRate()
Returns​

System.Threading.Tasks.Task<System.Int32>: A task containing the bitrate in bits per second

SetBaudRate(int)​

Sets the Modbus communication bitrate the sensor is configured to use

View Source​
Declaration
public Task SetBaudRate(int bitrate)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
System.Int32bitrate

SetModbusAddress(byte)​

Sets the Modbus node address of the sensor

View Source​
Declaration
public Task SetModbusAddress(byte newAddress)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
System.BytenewAddress

Implements​

  • Meadow.Foundation.Sensors.Power.ISpm1x
  • Meadow.Peripherals.Sensors.ICurrentSensor
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>
  • Meadow.Peripherals.Sensors.IVoltageSensor
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Voltage>
  • Meadow.Peripherals.Sensors.ISensor