Exploring programming a XY6020L power supply via modbus

Thread Starter

Curt Carpenter

Joined Jun 25, 2018
37
I have purchased a Chinese XY6020L variable buck power supply from Ali Express. It has a serial Modbus interface-- but no information that I can find anywhere as to how to program for it. No idea, for example, what baud rate the supply uses with the serial modbus protocol.

Being adventurous, I want to figure out how to program this supply and control it from my PC. What I'm looking for here is some advice on how to get started. I have the supply connected to my PC with a suitable interface and can send characters from PC to supply -- but no idea how to begin actually probing to get some modbus responses back from the supply. Any ideas on how to proceed would be welcome!
 

Thread Starter

Curt Carpenter

Joined Jun 25, 2018
37
You need to learn about MODBUS, but not from youtube.
Thanks. I've studied the modbus protocol spec but didn't see anything there that I thought would help me "ping" my device somehow to at least establish a working connection. The protocol itself seems pretty straight forward. The only thing I know about the supply's modbus interface is that it has default address 1 and (probably) default baud rate 115200.
 

g-radmac

Joined Nov 13, 2023
2
Hi there,
looking for the same thing here, were you able to make it work?
Thanks
Actually did some experiments
- port settings: 115200 baud/s
- last 2 bytes are CRC
- 1st byte is slave address - in my case is 0x01
- 2nd byte is function
more info about modbus and functions for example here https://www.simplymodbus.ca/FAQ.htm

analog output holding registers
register 0x0000 = set voltage - read/write
register 0x0001 = max current (i think)
register 0x0002 = voltage applied on the output (when on) - i think this one is read only
register 0x0012 = turn on/off the output, aka apply/provide set voltage to output

functions
0x03 - read analog output holding registers
0x06 - set analog output holding registers

read registers command example
01 03 00 00 00 14 45 C5

ID 0x01
function read analog output holding registers - 0x03
starting register address - 0x0000
number of registers to read - 0x0014 (20)
CRC - 45 C5

response
01 03 28 01 F4 01 90 01 F4 00 00 00 00 0B DC 00 00 00 00 00 00 00 00 00 00 00 32 00 1E 01 32 22 B8 00 00 00 00 00 00 00 01 00 00 B7 D1

ID 0x01
function read analog output holding registers - 0x03
length of the response data - 0x28
Register 0 Data - 0x01F4 (500) = 5.00V
Register 1 Data - 0x0190 (400) = 4.00A
Register 2 Data - 0x01F4 (500) = 5.00V (indicating the output is on so set voltage is actually on the output)
Register 12 Data - 0x0001 (1) - set voltage to output


other example commands
turn on
- 01 06 00 12 00 01 E8 0F
turn off - 01 06 00 12 00 00 29 CF
set 5V - 01 06 00 00 01 F4 89 DD
set 15V - 01 06 00 00 05 DC 8B 03

I am sure with this you can figure out the rest of the registers that are used and how they function.
 

nsaspook

Joined Aug 27, 2009
12,796
Actually did some experiments
- port settings: 115200 baud/s
- last 2 bytes are CRC
- 1st byte is slave address - in my case is 0x01
- 2nd byte is function
more info about modbus and functions for example here https://www.simplymodbus.ca/FAQ.htm

analog output holding registers
register 0x0000 = set voltage - read/write
register 0x0001 = max current (i think)
register 0x0002 = voltage applied on the output (when on) - i think this one is read only
register 0x0012 = turn on/off the output, aka apply/provide set voltage to output

functions
0x03 - read analog output holding registers
0x06 - set analog output holding registers

read registers command example
01 03 00 00 00 14 45 C5

ID 0x01
function read analog output holding registers - 0x03
starting register address - 0x0000
number of registers to read - 0x0014 (20)
CRC - 45 C5

response
01 03 28 01 F4 01 90 01 F4 00 00 00 00 0B DC 00 00 00 00 00 00 00 00 00 00 00 32 00 1E 01 32 22 B8 00 00 00 00 00 00 00 01 00 00 B7 D1

ID 0x01
function read analog output holding registers - 0x03
length of the response data - 0x28
Register 0 Data - 0x01F4 (500) = 5.00V
Register 1 Data - 0x0190 (400) = 4.00A
Register 2 Data - 0x01F4 (500) = 5.00V (indicating the output is on so set voltage is actually on the output)
Register 12 Data - 0x0001 (1) - set voltage to output


other example commands
turn on
- 01 06 00 12 00 01 E8 0F
turn off - 01 06 00 12 00 00 29 CF
set 5V - 01 06 00 00 01 F4 89 DD
set 15V - 01 06 00 00 05 DC 8B 03

I am sure with this you can figure out the rest of the registers that are used and how they function.
Perfect, thanks for the information. I'll order one to test on my solar energy project MODBUS interface as a utility charger.

Why do they try to make it so hard to find simple information on a product from China?
 

Thread Starter

Curt Carpenter

Joined Jun 25, 2018
37
Thanks for the information. I've been working another project and had to set the PS aside, but will get back to it in a day or two and let you know if I have any success. Thanks again for the starting point!
 

hardym2

Joined Dec 26, 2023
2
Thanks for all your analysis. I am new to modbus, and new to the XY6020L interface.
On the xy6020l product description, there is an small interface for the available wifi module, and the interface can be used for serial to RS-485 (I've not seen an adapter part available).
There are also 4 holes for serial, that is referred to as modbus.
Are these the same interface? that is, do we think that the wifi is communicating modbus data?
Do we know the pinout for the 4 hole modbus interface?
Is the modbus serial interface really +/- 5 volts?
Is the modbus interface on all the time, or does it have to be enabled via software configuration?

Arduino can do modbus protocol, but probably not the -5v. Is there a simple circuit that can be used to interface the xy6020L modbus into an Arduino?

On the example run, register 6 was 0x0DBC. That is 3036. Do we think that the input voltage was 30.36 volts during this run, so register 6 is the input voltage.

(fyi, my purpose with this is a small solar charge controller, to optimize power output from a solar panel to a battery, need to make realtime output current adjustments and monitor input voltage realtime. A solar power optimizer + voltage booster)
 

hardym2

Joined Dec 26, 2023
2
I have a couple of answers
Modbus is just a protocol that can ride on many hardware protocols, like RS-232. I suppose that the interface on the XY6020L board is TTL, RS-232, and the framing protocol is Modbus.

The XY6020L Wifi adapter is a XY-WFPOW. This appears to be a modbus-enabled implementation to their custom App.
https://www.aliexpress.us/item/3256802230942869.html?gatewayAdapt=glo2usa4itemAdapt
https://templates.blakadder.com/sinilink_XY-WFPOW.html

The app for the Wifi adapter is (apparently) only available for android,
and is listed in the comments here:
 

discord

Joined Jan 7, 2024
2
@Curt Carpenter and others. Pardon my ignorance.

I'm interested in the XY6020L, but am having trouble understanding what it is. Is the device a "buck / boost" power supply? My confusion is caused by the marketing of the device. In some posts I see it mention buck / boost converter.

In other posts I see it labeled as a buck converter.

For example, can I both step and step down from an input source?

Can I step up 13.5 V to say 15V ?

Similarly can I step down 15V to say 13.5V ?
 

Hockey

Joined Jan 2, 2024
2
@Curt Carpenter and others. Pardon my ignorance.

I'm interested in the XY6020L, but am having trouble understanding what it is. Is the device a "buck / boost" power supply? My confusion is caused by the marketing of the device. In some posts I see it mention buck / boost converter.

In other posts I see it labeled as a buck converter.

For example, can I both step and step down from an input source?

Can I step up 13.5 V to say 15V ?

Similarly can I step down 15V to say 13.5V ?
This is a buck converter. It can only step down voltage.
The specs on Aliexpress indicate:
Maximum output voltage: (input voltage+1.1) - 2

So 15V could be stepped down to 14.1V (or anything below that)

If you wanted 15V output, you would need to input at least 15.9V... however I would suggest providing some extra, say 17V or more. In my limited experience, it is not advisable to operate right on the limit of the specs.
 

discord

Joined Jan 7, 2024
2
Yeah it wasn't clear to me as some sellers mark this as a "Buck Boost Converter" : https://www.aliexpress.us/item/3256...3a433f-6&utparam-url=scene:search|query_from:

60V 1200W 20A DC Buck Boost Converter CC CV Step-Down Module LCD Adjustable Regulated Stabilized Voltage Power Supply


Thanks for clarifying.

This is a buck converter. It can only step down voltage.
The specs on Aliexpress indicate:
Maximum output voltage: (input voltage+1.1) - 2

So 15V could be stepped down to 14.1V (or anything below that)

If you wanted 15V output, you would need to input at least 15.9V... however I would suggest providing some extra, say 17V or more. In my limited experience, it is not advisable to operate right on the limit of the specs.
 

MisterBill2

Joined Jan 23, 2018
17,814
Often the sellers are clueless as to what the original description means. Or maybe this description was created by an AI robot that inserted "Buck Boost" because it was a close match.
I recall a listing for a "100 watt amplifier" that was actually 100 milliwatts. rated. Just a case of the writer not recognizing the "milli" part of the word. It seems that not everything stated in on-line advertising is correct.
 
Last edited:
Thanks to g-radmac for his discovery of the UART protocol.
With help of his information I created the Arduino library to control the xy6020l dcdc via a cheap Arduino pro micro clone from china.
The meaning of the transfered holding registers are explained in the header file: xy6020l.h
With a control & transmit rate of around 200 ms it works fine. Sometime the xy6020l ignores set requests and no answer on bus is provided.
Publishing the library is not finished yet, so you will not see it on Arduino IDE library manager.
GitHubs repo:
-> xy6020l
 
Last edited:
Top