HLW8032

From ElectroDragon
Jump to navigation Jump to search

HLW8032

Tips to use with ESP8266:

Method 1

  • Use Wemos and its softserial, wiring should be
  1. HLW8032 RX to Wemos D5
  2. HLW8032 3.3V to Wemos 5V or 3.3V
  3. HLW8032 GND pin to Wemos GND

Method 2 (obsolete)

  • The wiring should be:
HLW8032 RX -> ESP8266 RX pin
HLW8032 3.3V -> ESP8266 3.3V, also works on 5V
HLW8032 GND -> ESP8266 GND
  • Better not use with wemos board, which has USB-TTL UART bridge circuits on board, could cause conflict to uart reading from hlw8032. Please use a standalone ESP8266 module or board, without this circuits, for example our esp-12f adapter board
  • Better not use with ESP-link firmware, data can be read, but not in the raw hex data. Better write your own code to read and analyze the data by esp8266
  • Again double check baudrate should be 4800, in case for ESP-LINK, options should set to "8E1", data could be read but incomplete
  • The test could see here: https://twitter.com/electro_phoenix/status/1104004115422539781
  • Not yet have demo code of this available now.

Use Isolated ZMPT Sensor Version

  • Find the design documents (chinese) here
  • Use a already-known load to calculate the coefficience first
  • The math for Voltage is, same for current and power, voltage value is in register bit 2~4, voltage_value is 5~7
Voltage = (voltage_register / voltage_value) * voltage_coefficent. 


  • For example for voltage 220V, you can calculate the value of voltage_coefficent
22V = (voltage_register / voltage_value) * voltage_coefficent. 


* Use voltage_coefficent as a constant value for further reading.
  • Notice voltage_register is different for every chip.

Analyze Data

  • Data read when only power by 5V, not load, not yet connect to AC mains
55 5A 02 DA 78 07 26 72 00 3D 3B 07 27 5B 4C C4 58 D0 A7 87 61 00 01 BC 
F2 5A 02 DA 78 07 28 BB 00 3D 3B 04 35 B5 4C C4 58 11 9F 4F 61 00 00 6C =>
F2 / 5A / 02 DA 78 / 07 28 BB / 00 3D 3B / 04 35 B5 / 4C C4 58 / 11 9F 4F / 61 / 00 00 / 6C =>
state: F2 / check: 5A / Voltage parameter REG: 02 DA 78 / Voltage REG: 07 28 BB / Current Parameter REG: 00 3D 3B / Current REG: 04 35 B5 / Power parameter REG: 4C C4 58 / Power REG: 11 9F 4F / Data Updata REG: 61 / PF REG: 00 00 / CheckSum REG: 6C

ZMPT Sensors (on isolated version)

Current-type Voltage Sensor ZMPT107

  • Input AC voltage side: Sensor Nominate curernt 2mA = 220 / 100K (sample resistor) about 2.195mA
  • 2mA is the typical working current of sensor, both side are equal current 2.195mA
  • Output ACvoltage side: Output voltage for read = 2.195mA * 51R (sample resistor) = 0.112Vac

Current Sensor ZMCT103C

  • output current up to 5mA
  • 5mA * 1R = 0.005Vac

Any questions please read more details in datasheet

Schematic HLW8032