-
Building the XY-WFPOW firmware
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:
- Edit the YAML file.
- Check the configuration with the config command. Fix until no more errors.
- Build the download image with the compile command.
- 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.yamlAs 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:stableThis 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.
-
Getting started with ESPHome
09/12/2026 at 11:12 • 0 comments![]()
Actually I was led to ESPHome from my other project for a benchtop power supply. I ordered this WiFi module for controlling the power supply. Sure, it's possible to adjust the supply using the knob and buttons but tedious. So I wanted to be able to control it from my computer.
The module seems to be made by the same manufacturer that made the amplifier for #Playing music remotely with bluetooth. It uses the same phone app: sinilink. However the reviews for the app were very uncomplimentary. There were more 1-star ratings than 5-star ratings. In other words, a piece of s***. I only used the app for setting up the Bluetooth interface so the app didn't bother me.
Fortunately the MODBUS commands for the power supply are documented, and the WiFi module is just a conduit for the serial commands. There is a ESPHome-Sinilink-XY-WFPOW Github project which interfaces the module to ESPHome.
So what is ESPHome? In one sentence, it's a framework for building a software system for an IoT system. Sensors and output devices that are based on the ESP family of WiFi enabled MCUs, and some others, notably the RP2040, are supported. You generate firmware for MCU modules by specifying components with a YAML file, and the development software pieces the components together and builds the firmware image. Another great feature is being able to update the firmware Over The Air. This is important when the gadget has been deployed and it's not easy to take it back to the workbench to reprogram the firmware. You can explore the website for more details.
So I would need to build new firmware to flash into the XY-WFPOW. You can see the pin connector holes at the top of the module in the photo. I'm guessing I need a USB to serial adaptor which I have.
This extended introduction is just to give the background to the impetus to learn ESPHome. I can foresee that ESPHome will be useful for making ESP module based gadgets even if they work standalone and are not connected to the IoT. For setting up an ESPHome development environment there are various methods.
First method
This was by pip install esphome. This downloaded all the required Python modules to $HOME/.local. I used the wizard to construct a YAML specification for the ESP32-WROOM board I have, to get familiar with the process.
Unfortunately when I tried to compile the project, it failed trying to load uv, which is a package manager, into the Python platformio environment. I did a search for the fix, but many replies to previous questions said give up, use the ESPHome docker image.
I'm a little biased against container environments such as snap, flatpak, and virtualised machines using VirtualBox, even though I use them when I have to, because of the extra layer of complexity. But in this case I think the problems stem from the Python software ecosystem. It's just got over the transition from Python-2 to Python-3. They are still tinkering and adding features such that at the time of writing the version is up to 3.14 and a lot of Python software require a recent release. They still manage to break backward compatibility, for example, in a recent KiCad problem. So much for stability. And it doesn't help that Linux distros add their own quirks and problems. So reluctantly I opted for:
Second method
This involves downloading the docker image for ESPHome. You then run commands from the container to build the firmware and even flash the image, as docker can be given permissions on the host USB ports.
The first compile took a lot of time to download all the supporting Python modules. It generated images for the firmware, including any content for the data partition. One feature of many ESP modules is they come with data partitions in which one can even put a small filesystem. Low-end MCUs generally have small data partitions, if they do. I discovered that a lot of files owned by root were left behind in my project, due to the privilege I gave it to access the USB port. I think I will just build which needs no root permissions and then use esptool to flash the target system. Esptool can use the USB ports that have been made writable via udev.
A more serious problem was that about 2GB of files was left behind in the platformio subdirectory of the project. That's a lot of storage if I have many projects in development. It's occurred to other people too to reuse the platformio files. Fortunately it is already possible by specifying a bind mount for this directory, which can be common to all projects. There is also an open request to reuse the compiled objects across projects as some people have large numbers of similar gadgets to update, but that's another issue.
So now I have the basic infrastructure for building ESP firmware, which I will expand in future logs, when I get a round tuit. 😉
-
Assembling the power supply
09/12/2026 at 11:09 • 0 comments![]()
I ordered a XY-SK120 buck-boost converter with digital controller with LCD screen from Aliexpress. With it I can dial up any desired voltage and use current limiting to forestall damage when first powering up projects. It has many other features. From the specs it's quite an impressive piece of electronics for its small size. Input can be 6-36 VDC and output 0-36 VDC at up to 6 A and it handles up to 120W.
I chose the cased version. It's more than just the bare converter board with banana sockets in an enclosure. At the back is a cooling fan and a power input panel that takes various sources, including terminal block, barrel socket, some kind of Molex socket, and even USB-3 PD input. A cursory inspection shows that diodes isolate the inputs from each other. These extras account for the higher price.
The fly in the ointment is poor documentation. It would be nice to know how to operate the UI without trial and error. Not even a slip of paper in the box. But a bit of hunting found an instruction manual online. From the modification date, less than 3 months ago, the firmware is still being improved, and in the future it might be possible to update it using the serial interface.
Normally one would use a SMPS or an old laptop power brick for the input. I decided to put to use an old school power supply board possibly from an LA30 Decwriter that the board for #Flashing LEDs from old printer electronics came from. In the board pictured below, only one set of bridge rectifiers and one large capacitor are in use. There are actually two independent power supplies on the board. The low voltage one supplies digital logic via a 5 V regulator, one of the large TO-3 cases. I won't be using that half. The high voltage one supplies the electromechanics. The capacitor is a whopping 10000 µF rated for 50 V so lots of margin. Nominal voltage level was probably around 30 V. A 24 VAC appliance transformer that I was given feeds the board.
![]()
For the enclosure I used an old Ryobi timer saved from e-waste. It seems to have been an appendage to unknown industrial equipment. The inside was gutted to fit the PS PCB.
![]()
That such a small controller can provide 6 A is a testament to how much the power density of electronics has increased over the years. (But some reviews mention that the cooling fan may be inadequate at high power levels.) The current is more than the old bulky linear power supply can supply. The fuse on the rectifier board is rated at 2.5 A. The transformer is rated at 1.5 A. (Although at lower output voltage, more current can be supplied, as the converter is switching mode.) Anyway this is enough for my needs for the near future.
Oops, I forgot to order 4 mm banana plug cables. Next round then. Can't buy everything in the shops all at once. 😉
Well that takes another tuit off my round tuit list.
Update 2025-08-25, replaced the feed PSU
Unfortunately a couple of weeks ago the converter went off in the middle of the night while powering a project.
Cut to the chase, I replaced the feed PSU with an old laptop brick capable of supplying 85 W @ 19 V so the last two pictures are no longer relevant. And now it's more efficient.
But this isn't newsworthy except for the steps I took to find the problem. It's an old school step-down transformer feeding a bridge rectifier followed by a whopping big electrolytic capacitor. The voltage on the secondary seemed normal at about 23 VAC. But after the rectifier the voltage under load was 2.5 VDC. No wonder the converter didn't work.
But what was the faulty part, the connections, the transformer, the rectifier, the capacitor, or the converter? I tried disconnecting components one at a time and found that removing the converter brought the voltage up to about 29 V. Damn, did I have a busted converter? Then I thought to monitor the voltage on the capacitor for a few seconds after powering up. The voltage rose gradually over seconds, not almost instantly. This meant that the transformer had a high impedance. Mostly likely a break in the winding that had enough conduction to charge the capacitor slowly. Oh well, one heavy transformer for the e-waste bin then.
Ken Yap





