A library to communicate with an eSmart3 MPPT solar charge controller or similar device via RS485.
> influx -precision rfc3339 --database eSmart3 --execute "select * from ChgSts where time > '2022-10-24T07:32:26Z' and time < '2022-10-24T07:33:55Z' order by time"
name: ChgSts
time BatCap BatTemp BatVolt CO2 ChgCurr ChgMode ChgPower Fault Host InnerTemp LoadCurr LoadPower LoadVolt OutVolt PvVolt Serial SystemReminder Version
---- ------ ------- ------- --- ------- ------- -------- ----- ---- --------- -------- --------- -------- ------- ------ ------ -------------- -------
2022-10-24T07:32:27Z 96 22 132 1900544 0 0 0 0000001000 esmart3-1 23 0 0 0 0 1 34000083 0 1.0
2022-10-24T07:33:41Z 96 22 132 1900544 0 0 0 0000001000 esmart3-1 23 0 0 132 0 1 34000083 0 1.0
2022-10-24T07:33:42Z 96 22 130 1900544 0 0 0 0000001000 esmart3-1 23 157 202 129 0 1 34000083 0 1.0
2022-10-24T07:33:43Z 95 22 132 1900544 0 0 0 0000001000 esmart3-1 23 0 0 0 0 1 34000083 0 1.0
2022-10-24T07:33:44Z 96 22 132 1900544 0 0 0 0000001000 esmart3-1 23 0 0 0 0 1 34000083 0 1.0
2022-10-24T07:33:48Z 96 22 132 1900544 0 0 0 0000001000 esmart3-1 23 0 0 132 0 1 34000083 0 1.0
2022-10-24T07:33:50Z 95 22 126 1900544 0 0 0 0000001000 esmart3-1 23 423 520 123 0 1 34000083 0 1.0
2022-10-24T07:33:51Z 95 22 126 1900544 0 0 0 0000001000 esmart3-1 23 433 532 123 0 1 34000083 0 1.0
2022-10-24T07:33:52Z 95 22 126 1900544 0 0 0 0001001000 esmart3-1 23 424 521 123 0 1 34000083 0 1.0
2022-10-24T07:33:53Z 95 22 126 1900544 0 0 0 0001001000 esmart3-1 23 421 517 123 0 1 34000083 0 1.0
2022-10-24T07:33:54Z 95 22 132 1900544 0 0 0 0000001000 esmart3-1 23 0 0 0 0 1 34000083 0 1.0
Serial2.begin(9600, SERIAL_8N1);
SoftwareSerial port;
...
port.begin(9600, SWSERIAL_8N1, rx_pin, tx_pin);
Serial.begin(9600); Serial.swap();
Complete example
#include <Arduino.h>
#include <esmart3.h>
ESmart3 esmart3(Serial2); // Uses ESP32 2nd serial port to communicate with RS485 adapter
void setup() { Serial2.begin(9600, SERIAL_8N1); // Init serial port with default pins 16 and 17 for RX and TX esmart3.begin(RS485_DIR_PIN); // Init RS485 communication }
void loop() { bool on_off;
if (esmart3.getLoad(on_off)) { // Get current load output status esmart3.setLoad(!on_off); // Toggle current load output }
delay(10000); }
Thanks @altelch and @skagmo for helpful information.
Comments welcome, Joachim Banzhaf