{"id":820,"date":"2026-06-29T23:25:24","date_gmt":"2026-06-29T20:25:24","guid":{"rendered":"https:\/\/kivijakola.fi\/projektit\/?p=820"},"modified":"2026-06-30T22:32:56","modified_gmt":"2026-06-30T19:32:56","slug":"ecgsolax-hybrid-solar-inverter-modbus-control","status":"publish","type":"post","link":"https:\/\/kivijakola.fi\/projektit\/2026\/06\/29\/ecgsolax-hybrid-solar-inverter-modbus-control\/","title":{"rendered":"ECGSOLAX Hybrid Solar Inverter Modbus control"},"content":{"rendered":"\n<p>Bought ECG-HVM6.5KP-48V hybrid solar inverter with integrated WiFi. Mention is to use this for battery bank testing.  Inverter has USB look-like port but there is nothing to do with USB with it. <br><br><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"821\" height=\"1024\" src=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-10-821x1024.png\" alt=\"\" class=\"wp-image-832\" style=\"aspect-ratio:0.8015380379795853;width:404px;height:auto\" srcset=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-10-821x1024.png 821w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-10-240x300.png 240w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-10-768x958.png 768w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-10.png 1042w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n<\/div>\n\n\n<p><br><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"458\" height=\"436\" src=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva.png\" alt=\"\" class=\"wp-image-821\" style=\"width:231px;height:auto\" srcset=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva.png 458w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-300x286.png 300w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><figcaption class=\"wp-element-caption\">3peak 3232e<\/figcaption><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"412\" src=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-3.png\" alt=\"\" class=\"wp-image-824\" style=\"width:254px;height:auto\" srcset=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-3.png 500w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-3-300x247.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"463\" height=\"450\" src=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-2.png\" alt=\"\" class=\"wp-image-823\" style=\"width:261px;height:auto\" srcset=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-2.png 463w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-2-300x292.png 300w\" sizes=\"auto, (max-width: 463px) 100vw, 463px\" \/><\/figure>\n<\/div>\n\n\n<p><br>There is 3peak 3232e TLL to RS232 transceiver IC directly connected to USB port pins. USB port D+ pin is connected to 3232e TOUT1 and D- to RIN1. So, We need to build special &#8221;USB to RS232&#8221; cable by just soldering DB9 Connector to cut USB A cable tail.<\/p>\n\n\n\n<p><strong>DB9 PIN2 (RX) &#8211;&gt; Green &#8211;&gt; USB D+<br>DB9 PIN3 (TX) &#8211;&gt; White &#8211;&gt; USB D-<br>DB9 PIN5 (GND) &#8211;&gt; Black &#8211;&gt; USB Ground<\/strong><br><br>But this is not the full story! You can get Modus replies to WiFi module visible with this connection but you cannot request anything by yourself! 3232e TIN1 pin is directly shared with WiFi RX pin but ROUT1 is muxed with SOT23-6 BL1551B SPDT analog switch. There is very interesting control for the mux. It is controlled with USB VCC signal!<\/p>\n\n\n\n<p>There is also resistors and protecting diodes connected to that USB VCC line. So, line can be directly controlled with RS232 control pins. I connected that to DTR. This line should be also set automatically high when port is opened and back to low when closed as standard procedure. Sending and receiving data should be transparent operation for example from Linux command line and not needing any extra set or clear pin state commands. So, missing connection:<br><br><strong>DB9 PIN4 (DTR) &#8211;&gt; RED &#8211;&gt; USB VCC<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"369\" height=\"406\" src=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-5.png\" alt=\"\" class=\"wp-image-826\" srcset=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-5.png 369w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-5-273x300.png 273w\" sizes=\"auto, (max-width: 369px) 100vw, 369px\" \/><figcaption class=\"wp-element-caption\">BL1551B pins<\/figcaption><\/figure>\n\n\n\n<p><br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"989\" src=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-4-1024x989.png\" alt=\"\" class=\"wp-image-825\" style=\"aspect-ratio:1.035383263209631;width:406px;height:auto\" srcset=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-4-1024x989.png 1024w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-4-300x290.png 300w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-4-768x741.png 768w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-4.png 1157w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Finally we can connect DB9 connector to &#8221;real&#8221; serial to USB converter and plug that USB side to PC (Raspberry Pi or anything). After that all we can write Modbus requests to serial port with settings 9600bps 8n1, standard modbus RTU and DTR enabled:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"933\" height=\"696\" src=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-6.png\" alt=\"\" class=\"wp-image-827\" srcset=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-6.png 933w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-6-300x224.png 300w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-6-768x573.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>And we can see normal WiFi messages started rolling when DTR is cleared:<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"933\" height=\"696\" src=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-7.png\" alt=\"\" class=\"wp-image-828\" srcset=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-7.png 933w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-7-300x224.png 300w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-7-768x573.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"906\" height=\"1024\" src=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-8-906x1024.png\" alt=\"\" class=\"wp-image-829\" srcset=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-8-906x1024.png 906w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-8-265x300.png 265w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-8-768x868.png 768w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-8.png 1004w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Linux Shell Integration<\/h2>\n\n\n\n<p>My need to control inverter registers is very much limited for timed output source priority setting. This is done directly from my Linux server. There is not any actual home automation SW running, so, I let this home automation integration for other people.<\/p>\n\n\n\n<p>It turned out that driving DTR from shell script while sending data is little bit complicated.  stty setup comand is instead supporting RTS\/CTS HW handshaking. So, modified connection little bit for that:<\/p>\n\n\n\n<p> Moved USB cable red line to RTS and soldered also CTS together.<\/p>\n\n\n\n<p><strong>DB9 PIN7+8 (RTS+CTS) &#8211;> RED &#8211;> USB VCC<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"460\" height=\"614\" src=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-11.png\" alt=\"\" class=\"wp-image-849\" style=\"width:286px;height:auto\" srcset=\"https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-11.png 460w, https:\/\/kivijakola.fi\/projektit\/wp-content\/uploads\/2026\/06\/kuva-11-225x300.png 225w\" sizes=\"auto, (max-width: 460px) 100vw, 460px\" \/><\/figure>\n<\/div>\n\n\n<p>Modbus register map was found from here: <a href=\"https:\/\/github.com\/GamesterUnknown\/ESPHome_JSDSolar_inverter\/tree\/main\/docs\">https:\/\/github.com\/GamesterUnknown\/ESPHome_JSDSolar_inverter\/tree\/main\/docs<\/a><\/p>\n\n\n\n<p>Output source priority register is at address  0x4102 and values for that: 0:GPB 1:PGB 2:PBG 3:MKS<\/p>\n\n\n\n<p>Following script puts inverter to Grid first mode:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nstty -F \/dev\/ttyUSB0 speed 9600 cs8 crtscts -cstopb -parenb -echo\necho -en '\\x01\\x10\\x41\\x02\\x00\\x01\\x02\\x00\\x00\\xF6\\xB6' > \/dev\/ttyUSB0\n<\/code><\/pre>\n\n\n\n<p>And this to PBG priority mode:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nstty -F \/dev\/ttyUSB0 speed 9600 cs8 crtscts -cstopb -parenb -echo\necho -en '\\x01\\x10\\x41\\x02\\x00\\x01\\x02\\x00\\x02\\x77\\x77' > \/dev\/ttyUSB0\n<\/code><\/pre>\n\n\n\n<p>These scripts can be then timed with Cron.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Backround for changing priority<\/h2>\n\n\n\n<p>Intention for this is solar panel setup is: <br><span style=\"text-decoration: underline;\">Daytime:<\/span><br>* Charge batteries<br>* Feed power to load<br>* Sell excess energy to grid<br><span style=\"text-decoration: underline;\">After sunset:<\/span><br>* Use batteries to power load<br>* Use grid when batteries are empty<\/p>\n\n\n\n<p>It turned out that inverter is pushing excess energy to grid only in &#8217;Grid first&#8217; mode. In all other modes it is just limiting panel input power when batteries are full. So, there is not choises for daytime mode. But there is no sense with this mode during night time as grid is priorized and it is then never using batteries! Timed mode change gives also possiblity to optimize time for changing on batteries and using their energy.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bought ECG-HVM6.5KP-48V hybrid solar inverter with integrated WiFi. Mention is to use this for battery bank testing. Inverter has USB look-like port but there is nothing to do with USB with it. There is 3peak 3232e TLL to RS232 transceiver IC directly connected to USB port pins. USB port D+ pin is connected to 3232e &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/kivijakola.fi\/projektit\/2026\/06\/29\/ecgsolax-hybrid-solar-inverter-modbus-control\/\" class=\"more-link\">Jatka lukemista<span class=\"screen-reader-text\"> &#8221;ECGSOLAX Hybrid Solar Inverter Modbus control&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-820","post","type-post","status-publish","format-standard","hentry","category-yleinen"],"_links":{"self":[{"href":"https:\/\/kivijakola.fi\/projektit\/wp-json\/wp\/v2\/posts\/820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kivijakola.fi\/projektit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kivijakola.fi\/projektit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kivijakola.fi\/projektit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kivijakola.fi\/projektit\/wp-json\/wp\/v2\/comments?post=820"}],"version-history":[{"count":10,"href":"https:\/\/kivijakola.fi\/projektit\/wp-json\/wp\/v2\/posts\/820\/revisions"}],"predecessor-version":[{"id":850,"href":"https:\/\/kivijakola.fi\/projektit\/wp-json\/wp\/v2\/posts\/820\/revisions\/850"}],"wp:attachment":[{"href":"https:\/\/kivijakola.fi\/projektit\/wp-json\/wp\/v2\/media?parent=820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kivijakola.fi\/projektit\/wp-json\/wp\/v2\/categories?post=820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kivijakola.fi\/projektit\/wp-json\/wp\/v2\/tags?post=820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}