MAX485 - Modbus no response from device

I am trying to connect to Epever Tracer AN Solar Charge controller from ESP32 using Arduino Framework and below Max485 module but I can't get any repsonse from device.

rs485

I was trying to use exactly the same setup mentioned in this project but somehow it's not working: GitHub - tekk/Tracer-RS485-Modbus-Blynk-V2: An arduino sketch to connect the EPSolar/EPEver Tracer A/B Series (RS-485 Modbus) to an ESP8266 and monitor using the Blynk mobile app - the RELOADED version

Using cheap chinese logic analyzer I am getting strange result:

  • When I checking A and B lines of my Max485 module I see signal which has been correctly decoded by logic analyzer. However I don't get any response from Solar charge controller.
  • When I connect to controller from PC using cheap CH340 USB to RS485 converter and oryginal Solar Charger software everything works as expected. I tried to sniff these transmission using logic analyzer but instead of modbus data I am getting some random stuff. Serial port monitor software shows correct modbus messages (same that I am sending).

Connection parameters used in both cases:

Serial 115200 bit/sec 8 data bit, no parity, 1 stop bit
Modbus Slave ID of controller: 1

Pin connection:

ESP (TX) -> MAX485 (DI)
ESP (RX) -> MAX485 (RO)
ESP (D4) -> MAX485 (DE and RE connected together with jumper)
ESP VIN -> MAX485 VCC
ESP GROUND -> MAX485 GND

Code I am using:

First approach tried to write to serial directly as well:

pinMode(deviceStatus.pinConfig.RSE_MODBUS, OUTPUT);
    
digitalWrite(deviceStatus.pinConfig.RSE_MODBUS, 1);
Serial.write(1);  //Slave ID
Serial.write(4);  //READ register
Serial.write(51); //Register number
Serial.write(26); //Register number 2nd bit

Serial.write(0);  //Number of registries requested
Serial.write(3);  //Number of registries requested 2nd bit

Serial.write(158); //CRC
Serial.write(136); //CRC2 2nd bit
Serial.flush();
digitalWrite(deviceStatus.pinConfig.RSE_MODBUS, 0);

Other approach using Arduino Modbus Master library:

void preTransmission() {
  digitalWrite(deviceStatus.pinConfig.RSE_MODBUS, 1);
}

void postTransmission() {
  digitalWrite(deviceStatus.pinConfig.RSE_MODBUS, 0);
  
}

  node.begin(1, Serial);
  delay(1000);
  //callbacks to toggle DE + RE on MAX485
  node.preTransmission(preTransmission);
  node.postTransmission(postTransmission);
  delay(500);

  result = node.readInputRegisters(0x3100, 1);

In this approach result returns 226 error code which means timeout waiting for response.

Measured voltages:

Between A and B lines - 0,05V
Between B and ground - 0,64V
Between A and ground - 0,7V

However in working CH340 with oryginal software voltage between A and B lines show 0,6V instead of 0,05V.

What I've checked already that I've read may work:

  • Reverting A and B lines
  • Reverting RX and TX
  • I've tried to use also Wave share module 3485/485
  • Tried to either send message using raw Serial.write or use designated modbus libraries
  • Putting resistor between VCC and A line or between VCC and B line
  • Try to add some 100 Ohm resistor between lines A anb B on MAX485 end
  • Try to use common ground between controller and my module (however in CH340 working connection ground is not connected and it works).
  • I've try to add some delays before/after I switch RE and DE state

Output from logic analyzer using ESP32 for connection (not working):


Channels are B line, A line, RE&DE switch

Output from logic analyzer using USB CH340 for connections (working):


Channels are B line, A line

Why I still can't see reponse from controller? Why logic analyzer show some random data but it works somehow for oryginal software and CH340 usb connector? What should I change? I really spend few days on it and have no clue how to make it working. I will be grateful for any help on this topic.

I need the Schematic as you have wired it, not a frizzy picture to be sure but if I take a SWAG you do not have level translation between teh 485 module and the ESP. Also what are you using for termination resistors and how long is the line. Please post links to technical information on the hardware devices.

Thank you for response. Yes I don't have any additional level translation module as this MAX485 works for other people driven by 3.3V serial. I've also tried other RS485 module designated for 3.3V and got same results:
https://www.waveshare.com/rs485-board-3.3v.htm
https://www.waveshare.com/w/upload/e/e8/SP481-SP483-SP485.pdf

The 5V 485MAX module:
Uploading: MAX485-Module-Schematic.jpg...
https://datasheets.maximintegrated.com/en/ds/MAX1487-MAX491.pdf

I've try to use 100R termination resistor but didn't noticed any difference. Line is very short around 40cm. That's the regulator I am trying to connect:
https://www.epever.com/wp-content/uploads/2021/05/Tracer-AN-SMS-EL-V1.0.pdf

I tried to follow these modbus specifications:
https://www.img4.cz/i4wifi/attach/StoItem/7069/MODBUS-Protocol-v25.pdf

Will post schematic diagram soon as well.

let's recap:
if you use the OEM tracer software communication is ok
if you are using your controller/max485/your selfmade RJ45 cable you only see sending data.

correct?

please show the wiring from the RJ45 socket to the max485 module to your microcontroller.
Make clear pictures including the connection of DE/RE
We must be able to identify each used cable including the two (better three) used lines going into the EP tracer.

I'm very confident that the example sketch from the Modbus Master Library of Doc Walker should return data from the Tracer (even if not correct, but that's another story - the communication will work).

https://github.com/4-20ma/ModbusMaster/blob/master/examples/RS485_HalfDuplex/RS485_HalfDuplex.ino

please post a FULL compileable sketch for your microcontroller together with the pictures and others might spot the error.

1 Like

Thank you for reply.

@noiasca - Yes OEM tracer software on PC works without issues (I am connecting using CH340 USB RS485 converter). However from ESP with MAX 485 is not receiving data correctly.
In both cases I am using the same selfmade RJ34 cable which in one case works fine so I belive it's not the case.

To find bug easier I run GitHub - tekk/Tracer-RS485-Modbus-Blynk-V2: An arduino sketch to connect the EPSolar/EPEver Tracer A/B Series (RS-485 Modbus) to an ESP8266 and monitor using the Blynk mobile app - the RELOADED version example without aby other stuff connected (just keep read code without sending it to blynk). Even used the same ESP version - 8266. However I am still gettting either timeout code - 226 or some data which is not correct.

Tried to swap A and B lines as well as RX and TX but without success. VCC on RS485 module seems to be correct - 5,06V. What is strange - voltage between A and B terminal is only 0,05V. When I connect from PC USB CH340 with oryginal software voltage between A and B terminal is about 0,6V.

Below you will find complete sketch with console output and photo with which shows connection.

Tracer-RS485-Modbus.cpp (3.0 KB)

Console output:

Setup OK!
Reading data from modbus
␁␄1␀␀␆~�Read register 0x3100 failed!
226
␀␃/4Load Current: 0.00
Load Power: 0.00
␁␄1␚␀␂^�Battery Remaining %: 0.00
Battery Temperature: 0.00
Reading data from modbus
␁␄1␀␀␆~�Read register 0x3100 failed!
226
␀␃/4Load Current: 0.00
Load Power: 0.00
␁␄1␚␀␂^�Battery Remaining %: 0.00
Battery Temperature: 0.00
Reading data from modbus
␁␄1␀␀␆~�Read register 0x3100 failed!
226
␀␃/4Load Current: 0.00
Load Power: 0.00
␁␄1␚␀␂^�Battery Remaining %: 0.00
Battery Temperature: 0.00
Reading data from modbus

the picture is not clear, but the
yellow cable DI seems to go to G
orange cable DO seems to go to TX
and RX is not connected on the shield.

I don't see the RJ45 socket in the tracer and which cable goes to which pin.

on the other hand based on your serial output it seems that only reading from 3100 fails, the other two functions are working.

try to add delay(3000) after the Serial.println and the before the AddressRegistry_3100();

The problem is that other data is corrupted as well. Temperature for example should be around 25 degress for example (that PC software shows and that's what build in LED display shows).

Pin connections looks like below:
ESP 5V -> RS485 VCC
ESP GND -> RS485 GND
ESP RX -> RS485 DI
ESP TX -> RS485 RO
RS485 DE and RE jumped togetger
ESP D1 -> RS485 DE
ESP D2 -> RS485 RE

Tracer RJ45 blue cable goes to B line
RJ45 Green cable goes to A line

I am using following RJ45 pinout:

EDIT:
I found one issue which explains some things. Looks like modbus registry addreses have been changed in recent version of solar controller. So it explains why first one is getting timeout but other two are working. However using qmodbus software I can receive correct data but still from ESP I am getting only 0 values.

When I change anything on cable connection switch A-B lines, RX-TX ports I am receiving only timeouts. For 3,3V module I was getting timeouts but after I created pullup and pulldown lines for AB it's working exaclyt as 5V module - so I am receiving only zeros.

  • It's not cable as I can query controller from PC using same cable
  • ESP RS485 module connections seems to be correct as otherway I am starting receiving timeouts
  • Both RS modules behave in same way so I belive they are working
  • Communication parameters seems to be correct - I used the same settings from qmodbus (baud rate 115200, 8N1, Slave Id: 1)

Any ideas what can cause this strange issues?

have you tried this:

what was the result?

which registers is YOUR tracer using?
Can you provide a datasheet?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.