I don't know which pins to use for connecting the MAX485 RS485 transceiver to the DEYE device . Are you using the MAX485 RS485 transceiver?
@munand6
You need to connect it to the ethernet socket rs485 drl Deye Pin 7 8
can you pls send to me your mail to directly communicate with you? @munand6
Write here because it could be of use to others.
This module seems to have ....
- Automatic bi-directional transmission control.
Which will differ from the MAX485 Module requiring directional control in your code.
@munand6 , could you also please be specific as to the deye model, you are interfacing with?
For example:
HMI: Ver 0000-C35D
MAIN: Ver 0-3381-1515
MODEL NO: SUN-5K-SG01LP1-EU
Thanks, hopefully @munand6 will let us know which model he developed off.
I've tried the modbus master library to no avail, giving E2 timeout on the model above (SUN-5K-SG01LP1-EU), utilising a nano every and HW serial (serial2), adapted generic simple code.
result = deye485.readHoldingRegisters(175, 17);
if (result == deye485.ku8MBSuccess) {
etc, etc
Modscan terminal connection has
*invalid response to query
Will have to dig into the use of a library further. Have tried numerous suggested connections to the inverter (Slave ID 01) and also removed the terminating resistor on one of the boards.
Common MAX485 TTL to RS-485 Interface Module bought from reputable local South African supplier.
Had noted: (not tried anything similar)
crc error possible?
crc16.h:71:17: warning: 'uint16_t crc16_update(uint16_t, uint8_t)' defined but not used [-Wunused-function]
static uint16_t crc16_update(uint16_t crc, uint8_t a)
My software does not use third-party libraries. My code is directed without using libraries. If you use the
My code if I can help you.
I understand, and thank you for sharing.
I am now about to write c code specifically for the devices I have, these do not have automatic transmission and that is the reason I am unable to utilize what you have written.
Its also possible that biasing resistors will need paying attention to, further to that, since I've removed the termination resistor, on one of the modules, the low baud rate, and short wires, I may need to enable an internal pull-up on RX(RO).
Was eventually able to adapt example code using the library to communicate with SUN-5K-SG01LP1-EU inverter, using an arduino nano every.
so you did it? can you read now data from deye 5k?
@agm1dr
@chm2023, yes the library works'
Testing was done on both Serial1 (USART1) and Serial2 (USART0) of nano every.
connections as follows.
BMS 485/CAN:
T568B B-/Pin 1(orange/white), A+/Pin 2(orange), Pin3/Gnd(green/white).
METER/METER:
T568B B-/Pin 4(blue), A+/Pin 5(blue/white), Pin3/Gnd(green/white).
You can have a non blocking function polling, for example reading the various registers you might be interested in.
Serial.flush();
result = deye.readHoldingRegisters(175, 10); //175, 176, 177, 178, 179, 180, 181, 182, 183, 184
if (result == deye.ku8MBSuccess) {
//186, "PV1 power", WATT, -1
//109, "PV1 voltage", VOLT, 0.1
//110, "PV1 current", AMPS, 0.1
//182, "Battery temperature", CELSIUS, 0.1
//183, "Battery voltage", VOLT, 0.01
//190, "Battery power", WATT, -1
//191, "Battery current", AMPS, -0.01
//90, "DC transformer temperature", CELSIUS, 0.1
//95, "Environment temperature", CELSIUS, 0.1
//91, "Radiator temperature", CELSIUS, 0.1,
//194, "Grid Connected"
//22, 23, 24, "Date Time", unit=""
deye_inv_power = deye.getResponseBuffer(0); //175, "Inverter power", WATT, -1
deye_load_power = deye.getResponseBuffer(3); //178, "Load power", WATT, -1 (178 -175)
deye_soc = deye.getResponseBuffer(9); //184, "Battery SOC", "%" (184 - 175)
} else {
Serial.print("modbus error: ");
Serial.print(result, HEX);
Serial.println(" ");
Could you kindly provide me with additional information, such as the complete source code, specific details regarding the library's origin, the make and model of the Arduino board, and the module employed in your project? I appreciate your assistance and support. Thank you.
@agm1dr
AND PLEASE TELL ME what you changed in the settings of the deye 5k
@agm1dr
Hello @chm2023 ,
Please read the posts carefully, all the answers are already provided.
Board:https://www.robotics.org.za/index.php?route=product/search&search=nano%20every
Module: https://www.robotics.org.za/RS485-MOD
Library: GitHub - 4-20ma/ModbusMaster: Enlighten your Arduino to be a Modbus master
The inverter is a Slave with ID 01, if you look at your advanced menu, you can confirm or set and reboot.
The last working test sketch that the OP posted should work adapted to your mcu of choice. I can only recommend as have been mentioned many times here that you choose a board with hardware serial capabilities.
Please tell what you have tried, and which firmware your inverter has loaded?
i have to check the parallel checkbox and the master or slave vox?
thankyou for helping
To use the old terminology the 'Arduino' is the modbus 'Master' and "Deye" is the "Slave".
My settings as the picture. I am not 100% sure what the difference between your model 'SG03' and the one I have 'SG01' is (SUN-5K-SG01LP1-EU) .
Please let me know what firmware is on your model? You can find that by pressing device info on the menu button.
Let me know the exact board and module, the wiring and post which sketch you have tried?
If this is a 'learning project' I suggest you do not proceed. I would recommend that you familiarize yourself with simple projects first. For instance communicating between two rs485 modules, to understand the protocol, hopefully this is not an offensive comment.



