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
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
public byte ModbusAddress { get; }
SerialNumber
Gets the serial number of the sensor device
View Source
public int SerialNumber { get; }
SoftwareVersion
Gets the software/firmware version of the sensor
View Source
public int SoftwareVersion { get; }
ProductModel
Gets the product model identifier of the sensor
View Source
public byte ProductModel { get; }
HardwareRevision
Gets the hardware revision of the sensor
View Source
public byte HardwareRevision { get; }
Current
Gets the current measurement from the sensor (synchronous property)
View Source
public Current? Current { get; }
Voltage
Gets the voltage measurement from the sensor (synchronous property)
View Source
public Voltage? Voltage { get; }
Methods
ReadCurrent()
Asynchronously reads the current measurement from the sensor
View Source
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
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
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
public Task SetBaudRate(int bitrate)
Returns
System.Threading.Tasks.Task
Parameters
| Type | Name |
|---|---|
System.Int32 | bitrate |
SetModbusAddress(byte)
Sets the Modbus node address of the sensor
View Source
public Task SetModbusAddress(byte newAddress)
Returns
System.Threading.Tasks.Task
Parameters
| Type | Name |
|---|---|
System.Byte | newAddress |
Implements
- Meadow.Foundation.Sensors.Power.ISpm1x
Meadow.Peripherals.Sensors.ICurrentSensorMeadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>Meadow.Peripherals.Sensors.IVoltageSensorMeadow.Peripherals.Sensors.ISensor<Meadow.Units.Voltage>Meadow.Peripherals.Sensors.ISensor