Smart DGM PP-W162

As you may have heard, Biedronka (the largest supermarket chain in Poland) is offering a $10 smart socket. They claim with the device you can remotely control anything up to 16 A (3680 W), monitoring the power usage too. I bought a few Sonoff Pows for this purpose before, and I couldn’t get them for less than $15 if I remember correctly. Also, the PP-W162 is much more compact and it doesn’t need any external wiring.

It’s pretty much clear that the device contains an ESP8266, so it’s just a matter of flashing it with your own firmware for turning it into something useful. It’d be perfect if the device could be flashed over-the-air, but most manufacturers don’t allow it for obvious reasons (as we all know, the ”S” in IoT stands for ”security”). Despite the fact that the casing doesn’t seem to have any screws, it can be easily opened using a screwdriver (you’d need to glue it after flashing). Here’s how I hooked it up:

Flashing Smart DGM PP-W162

Remember to ground the GPIO0 before powering the ESP to turn on the flashing mode. The device consists of:

  • TYWE2S board
  • energy metering component based on BL0937 (HLW8012 clone), connected to: GPIO4 (CF), GPIO5 (CF1), GPIO12 (SEL, inverted)
  • 230 V relay connected to GPIO14
  • blue LED connected to GPIO13 (inverted)
  • switch connected to GPIO3 (inverted)

Here’s the full ESPHome configuration:

esphome:
  name: PPW162
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: 
  password: 

logger:

api:

ota:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO3
      mode: INPUT_PULLUP
      inverted: true
    name: "Button"
    on_press:
      - switch.toggle: relay

sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: true
    cf_pin: 4
    cf1_pin: 5
    current:
      name: "Current"
    voltage:
      name: "Voltage"
    power:
      name: "Power"
    update_interval: 1s
    voltage_divider: 800
    current_resistor: 0.0023

switch:
  - platform: gpio
    name: "Relay"
    pin: GPIO14
    id: relay

status_led:
  pin:
    number: GPIO13
    inverted: yes

The energy consumption monitoring needs some additional calibration (e.g. linear scaling). The above voltage divider and current resistor values give pretty accurate results for low-power devices (10 W), but I’ve noticed that the results are a bit off (~5%) when you connect something bigger than a kilowatt.


Hello

I'm Kuba Kuźma — Ruby on Rails and JavaScript Developer

Learn more