Close

Building the XY-WFPOW firmware

A project log for WiFi control of a XY-SK120 bench power supply

I got tired of using the tiny buttons and knob so I put my XY-SK120 under PC control

ken-yapKen Yap • 09/12/2026 at 12:17•0 Comments

Getting ahead of myself here by showing that I have succeeded in monitoring the power supply from a web browser on my PC.

So after a lot of procrastination I decided to build the firmware for the XY-WFPOW controller that connects to the XY-SK120 by serial interface to control it. As mentioned in the previous log, this is a tiny module that's larger than life-size in the photo. Instead of the XY-WFPOW Github project I found previously, I found a more complete one at Sinilink modules Github project. Now comparing the XY-SK120 and the XY5008, the latter is a more powerful controller that handles higher voltage and current. What I'm counting on is that the Modbus commands of the XY5008 are usable for the XY-SK150, perhaps a few might be unimplemented.

So I took the YAML file that specifies the features to be included in the firmware for the XY-5008 and modified as below:

--- sinilink-modbus.yaml.orig   2026-09-10 10:39:49.504872773 +1000
+++ xy_sk120-modbus.yaml        2026-09-10 21:00:06.541073980 +1000
@@ -1,18 +1,18 @@
 substitutions:
   # Change this model to fit your particular one.
   # You can find it in Home Assistant as the device diagnostic "Model Name".
-  model: "XY5008"
-  device_name: "xy5008-controller"
-  device_friendly_name: "sinilink-XY5008"
+  model: "XY_SK120"
+  device_name: "xy-sk120-controller"
+  device_friendly_name: "XY-SK120"
   device_description: "Power Supply"
   
   # Model specific settings (Don't change these!)
-  XY5008_voltage_maximum: "50"
-  XY5008_voltage_accuracy: "2"
-  XY5008_voltage_multiplier: "0.01"
-  XY5008_current_maximum: "8"
-  XY5008_current_accuracy: "3"
-  XY5008_current_multiplier: "0.001"
+  XY_SK120_voltage_maximum: "36"
+  XY_SK120_voltage_accuracy: "2"
+  XY_SK120_voltage_multiplier: "0.01"
+  XY_SK120_current_maximum: "6"
+  XY_SK120_current_accuracy: "3"
+  XY_SK120_current_multiplier: "0.001"
 
 globals:
    - id:   vin_undervoltage_theshold
@@ -26,7 +26,7 @@
   comment: $device_description
   name_add_mac_suffix: false
   project:
-    name: "sinilink.xy5008-controller"
+    name: "sinilink.xy-sk120-controller"
     version: "1.0.0"
 
 esp8266:
@@ -61,6 +61,7 @@
 
 # Configure WiFi
 wifi:
+  min_auth_mode: WPA2
   networks:
   - ssid: !secret wifi_ssid1
     password: !secret wifi_password1
@@ -70,7 +71,7 @@
 
   # Enable fallback hotspot (captive portal) in case wifi connection fails
   ap:
-    ssid: "XY5008 Fallback Hotspot"
+    ssid: "XY-SK120 Fallback Hotspot"
     password: ""
 
 text_sensor:

Mostly name changes, but note the additional line min_auth_mode: WPA2. This is the default for new builds as WPA is weak. Explicitly stating WPA2 avoids a warning during the build. Of course you should also insert your hotspot SSID and login password in the networks: section.

The steps of building the firmware are:

  1. Edit the YAML file.
  2. Check the configuration with the config command. Fix until no more errors.
  3. Build the download image with the compile command.
  4. Flash the firmware with the run or flash command.

Because the same command line parameters are passed to the Docker commands, I made a shell script with several links where the name indicates which action is wanted.

#/bin/sh
case $0 in
*config)
        action=config
        ;;
*compile)
        action=compile
        ;;
*flash)
        flash='--device=/dev/ttyUSB0 --privileged'
        ;&
*run)
        action=run
        ;;
*clean)
        action=clean
        ;;
*)
        exit 1
        ;;
esac
echo Command: docker run -v "${PWD}":/config  -v /home/data/software/uC/esp/esphome:/cache $flash -it esphome/esphome "$action" xy_sk120-modbus.yaml
exec docker run -v "${PWD}":/config  -v /home/data/software/uC/esp/esphome:/cache $flash $baud -it esphome/esphome "$action" xy_sk120-modbus.yaml

As you can see the flash action is actually the same as the run action except that a USB to TTL converter is specified. This is only needed for the initial download.

I had a CH341 USB to TTL dongle for the flashing. However looking at the connectors on the XY-WFPOW module I could see a size issue. The tiny JST connector couldn't take the large Molex pins. There is a row of connector pads on the edge of the module, but the plated through holes are very small. In the end I found hookup wire that was small enough to insert into the holes, but not to solder, relying on friction to make contact with the plated hole.

I plugged in the CH341 dongle and it was recognised due to previous use of other CH341 interfaces which had the same USB vendor and model IDs, and it got assigned /dev/ttyUSB0.

Plugged it in and ran the ./flash command. It gave me a choice of USB serial or OTA flashing. BTW OTA is great. I should only need to do serial flashing once. LEDs blinked but the command said there was no reply from the module.

Measured the voltage on the 3.3 V contact of the module. It was only a couple of volts, not enough to power the module. Probably the LDO regulator on the USB dongle could not supply enough current.

So I rigged another wire from the 5 V pin of the dongle to the 5 V input of the JST connector. This comes from the PC so should be good for up to 500 mA.

Again the ./flash command didn't work. But I noticed that even before flashing the Rx LED on the dongle showed activity. That must be the existing firmware in the module running.

I remembered that the ESP bootloader looks at GPIO0 when powering up or resetting. If low then it accepts new firmware, otherwise it runs the existing firmware. So I rigged another wire to the GPIO0 pad and connected this to GND when plugging in the dongle and module pair. There was no activity on the Rx LED. I ran the ./flash command and this time it connected and flashed the firmware.

Success, I had replaced the factory firmware with my ESPHome firmware. Looking at the log of my DHCP server, I could see that it had acquired an IP address and was now on the WLAN.

The ESPHome firmware listens on port 80 and I could connect to it with telnet. But when I connected to it with a browser, I just got a blank page. Well, it's too much to expect that the web server will send back a fancy page.

More reading showed that I needed to install ESPHome Assistant to read the XY-WFPOW module. As this point I took a diversion to do this using a Docker image. (The firmware builder also uses a Docker image.) Eventually I found that the command was:

#!/bin/sh
exec docker run -d --name homeassistant --restart=unless-stopped -v /var/lib/homeassistant:/config --network=host homeassistant/home-assistant:stable

This did a lot of downloading and eventually fired up a Docker instance in a container. I then went to http://localhost:8123/ and got the overview page of ESPHome. I found the command to enroll the XY-WFPOW as a device and placed it in the Living Room, where my workbench is. Clicking on the module icon gave me the result in the top photo. How to control the power supply though? Clicking on the > after the module name gave me this:

From the configuration section I could set the output voltage and see the number change on the front panel of the XY-SK150. Success!

Incidentally this is not the only way to control the XY-SK150. You can connect to the serial interface directly and issue Modbus commands. Here's a project where the hacker used a Seeed XIAO ESP32-S3 as the controller.

Among the documents in that project one lists the Modbus registers and it matches up with what I have in the YAML file except that External Temperature is specified but I don't see any sensor in the power supply case for this, which accounts for the bogus reading of 888.8 °C. I made cosmetic edits to the YAML file and rebuilt the firmware and reflashed, this time using OTA which worked great. The External Temperature register is I guess a mistake in the Modbus document which is probably for an entire series of power supplies made by the same factory some of which have that feature. I'll ignore that measurement for now.

Future work is to find out how to control the power supply programmatically from command line instead of from Home Assistant, which is a large app running in a Docker container. Apparently the devices expose a REST web API.

I noticed that Home Assistant also discovered other equipment on my LAN, mostly entertainment. That's fun for another day to explore.

So, one less item on my list to get a round tuit for.

Discussions