wrybread / ESP32ArduinoRenogy

Reads data from a Renogy solar charge controller's RS232 port with an ESP32 or Arduino
MIT License
27 stars 10 forks source link

Works on Arduino MKR1010 #2

Open Five-Nines opened 1 year ago

Five-Nines commented 1 year ago

I used your info to successfully connect an Arduino MKR1010 to a Renogy Wanderer 10A (model # RNG-CTRL-WND10) charge controller. The MKR1010 natively has Serial1 on pins 13 (RX) and 14 (TX).

In the renogy_rs232.ino program: Not required:

define RXD2 13

define TXD2 14

Substitute: Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2); node.begin(modbus_address, Serial2);

with: Serial1.begin(9600); //On mkr1010, pins 13 (RX) & 14 (TX) are Serial1 node.begin(modbus_address, Serial1);

Additional comments: • The RJ12 cable I purchased on Amazon has a wire color sequence opposite of yours – pin 1 is blue. As you allude to, it’s the pins and not the wire colors that are important. • The NOYITO TTL-to-RS232 level adjuster is excellent. I was using Sparkfun RS232 shifters with no success. • As you mention, the “info” registers don’t have relatable information, except for amp_rating=10, which is correct for a 10A controller. • The multiplier for battery_charging_amps = data_registers[2] is .01, not .1. (Page 9 of the Rover 20A/40A Charge Controller—MODBUS Protocol documentation.) • The internal temperature sensor is for the controller itself, and not ambient temperature. Expect it to change as the controller receives electricity from the panel. The Wanderer 10A does not have remote battery temperature sensor capabilities, therefore, battery_temperature usage can be commented out. • The controller’s uptime counter seems inaccurate as my controller has been connected to a new battery for three weeks, yet the controller’s uptime is three days. In addition, because it doesn’t have a method to set the date and time, a new day doesn’t begin at 12:00am. It is possible the firmware estimates 12:00am based on solar day length. Other counters based on a day also are questionable. • One reason I only use the MKR1010 (vs other Adriano boards) is that it has web server (and client) capabilities. My sketch publishes a simple webpage with the Renogy controller’s info.

Thank you for publishing the detailed information on GitHub! I was struggling with the many variables involved – pinouts, pin functions, RS232, Modbus, C++ - but your information got me on track.

image

Cyrilinf1 commented 1 year ago

It's working also with the same change on arduino mega and SRNE controller (ML4860). Some parameter arent good like solar_panel_watts but as volage and amper work well i calculate it in the arduino (i'm very bad in code). I wil test the other parameters and checks if it's ok or not compare to the lcd screen