muwerk mupplet Sensor Library
muwerk applets; mupplets: functional units that support specific hardware or reusable applications for sensors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ustd::PowerBl0937 Class Reference

Power, Voltage and Current sensor BL0397. More...

#include <mup_power_bl0397.h>

Public Member Functions

 PowerBl0937 (String name, uint8_t pin_CF, uint8_t pin_CF1, uint8_t pin_SELi, int8_t interruptIndex_CF, uint8_t interruptIndex_CF1)
 

Detailed Description

Power, Voltage and Current sensor BL0397.

The power_bl0397 mupplet measures current voltage (V), current (A) and power consumption (W) using a chinese BL0397 sensor as used in Gosund SP-1 switches.

Messages sent by illuminance_ldr mupplet:

topic message body comment
<mupplet-name>/sensor/voltage <current-voltage> Current voltage (V) as string.
<mupplet-name>/sensor/current <current-current> Current current (A) as string.
<mupplet-name>/sensor/power <current-power> Current power usage (W) as string.

Messages received by illuminance_ldr mupplet:

topic message body comment
<mupplet-name>/sensor/state/get - Causes current voltage, current, and power messages to be sent.
<mupplet-name>/sensor/voltage/get - Causes current voltage message to be sent.
<mupplet-name>/sensor/current/get - Causes current current message to be sent.
<mupplet-name>/sensor/power/get - Causes current power message to be sent.

Constructor & Destructor Documentation

◆ PowerBl0937()

ustd::PowerBl0937::PowerBl0937 ( String  name,
uint8_t  pin_CF,
uint8_t  pin_CF1,
uint8_t  pin_SELi,
int8_t  interruptIndex_CF,
uint8_t  interruptIndex_CF1 
)
inline

Creates a new instance of BL0937 based power meter

Parameters
nameFriendly name of the meter.
pin_CFBL0937 pin CF. BL0937 outputs a 50% duty PWM signal with frequency proportional to power usage
pin_CF1BL0937 pin CF1. BL0937 outputs a 50% duty PWM signal with frequency eithe proportical to voltage (SELi high) or current (SELi low).
pin_SELiBL0937 pin SELi. If set to high, BL0937 outputs voltage proportional frequncy on CF1, low: current-proportional.
interruptIndex_CFShould be unique interrupt index 0..USTD_MAX_BLP_PIRQS. Used to assign a unique interrupt service routine.
interruptIndex_CF1IRQ service index for CF1, Should be unique interrupt index 0..USTD_MAX_BLP_PIRQS. Used to assign a unique interrupt service routine.

The documentation for this class was generated from the following file: