HLW8012 high-precision energy metering IC in pakistan

$ 0.32

Category:
Download Arduino Library HLW8012 high-precision energy metering IC in Pakistan HLW8012 is a single-phase multi-function metering chip that provides high-frequency pulse CF for energy metering, indicating active power, and high-frequency CF1 for indicating current RMS or voltage RMS Chip pin No. Pin name Types of description 1 VDD power supply 5V voltage 2 V1P Analog input Current Channel Differential Input, Maximum Differential Input Voltage Range ±43.75mV 3 V1N Analog input 4 V2P Analog input Voltage Channel Positive Input, Max Input Signal ±700mV 5 GND Simulated ground Simulated ground 6 CF Digital output Output active power high-frequency pulse, pulse duty cycle 50% 7 CF1 Digital output SEL=0, CF1 output current arms, pulse duty cycle 50% SEL=1; CF1 output voltage arms, pulse duty cycle 50% 8 SEL Digital input Configure CF1 output current or voltage arms, internal pull-down Chip features High-frequency pulse CF, indicating active power, ±0.2% accuracy in 1000:1 range High-frequency pulse CF1 can be configured as output current arms or voltage arms, achieving 0.5% accuracy over a 500:1 range Built-in oscillator Low power consumption, 5V single-supply operation, working power less than 15mW SOP-8 package Application: Metering socket Smart home electricity collector Intelligent street light power collection end The power quality monitoring system Various types of energy metering systems Internal block diagram Sample code #include #define SERIAL_BAUDRATE 9600 // GPIOs #define SEL_PIN 11 #define CF1_PIN 13 #define CF_PIN 12 // Check values every 2 seconds #define UPDATE_TIME 2000 // Set SEL_PIN to HIGH to sample current // This is the case for Itead’s Sonoff POW, where a // the SEL_PIN drives a transistor that pulls down // the SEL pin in the HLW8012 when closed #define CURRENT_MODE HIGH // These are the nominal values for the resistors in the circuit #define CURRENT_RESISTOR 0.002 #define VOLTAGE_RESISTOR_UPSTREAM ( 5 * 470000 ) // Real: 2280k #define VOLTAGE_RESISTOR_DOWNSTREAM ( 1000 ) // Real 1.009k HLW8012 hlw8012; void unblockingDelay(unsigned long mseconds) { unsigned long timeout = millis(); while ((millis() – timeout) UPDATE_TIME) { last = millis(); Serial.print(“[HLW] Active Power (W) : “); Serial.println(hlw8012.getActivePower()); Serial.print(“[HLW] Voltage (V) : “); Serial.println(hlw8012.getVoltage()); Serial.print(“[HLW] Current (A) : “); Serial.println(hlw8012.getCurrent()); Serial.print(“[HLW] Apparent Power (VA) : “); Serial.println(hlw8012.getApparentPower()); Serial.print(“[HLW] Power Factor (%) : “); Serial.println((int) (100 * hlw8012.getPowerFactor())); Serial.println(); // When not using interrupts we have to manually switch to current or voltage monitor // This means that every time we get into the conditional we only update one of them // while the other will return the cached value. hlw8012.toggleMode(); } }