leodesigner / powmr_comm

PowMr Inverter serial communication protocol reverse engineering
MIT License
69 stars 6 forks source link

Split RS232 and ESP code #3

Open davidebeatrici opened 1 year ago

davidebeatrici commented 1 year ago

I have a server that is running right next to the inverter, it would be really nice to be able to connect the serial port directly to it using something like https://gitlab.com/Teuniz/RS-232.

Splitting the code into separate classes would definitely help to implement that, among other advantages.

leodesigner commented 1 year ago

Thanks for suggestion.

I wanted to avoid coupling any other external device (orangepi, raspberrypi). The inverter is quite noisy in RF spectrum and may cause these devices to work less stable. Especially with the common ground.

I guess we have a lot of other options to communicate over modbus from linux machine.

davidebeatrici commented 1 year ago

Thank you for the fast reply.

My idea was to put at least one filtering capacitor between inverter and computer, but the devices cannot be fully decoupled. An ESP8266 can be sacrificed in case something goes wrong as it's very cheap, a high-end server on the other hand...

I think I'll design a PCB on EasyEDA.

davidebeatrici commented 1 year ago

I completed both schematic and PCB, here's a preview of the latter:

Pictures ![Top](https://github.com/leodesigner/powmr_comm/assets/5897523/d3bcaf75-f912-4a78-82f0-9d35fb01027b) ![Bottom](https://github.com/leodesigner/powmr_comm/assets/5897523/a6e6eecb-eb3c-401b-b0ea-6194351eb1a4)
Components
Name Part LCSC part
C1, C2 GRM21BR61E226ME44L C86816
C3, C4 GRM21BR60J476ME15L C77072
C5 GRM155R71H332KA01D C85963
C6, C7, C8, C9 GRM155R71C104KA88D C71629
ESP32 ESP32-C3-WROOM-02U-N4 C2926676
ESP32_BOOT TSG002A05018A C2888616
ESP32_UART PZ254V-11-04P C492403
L1, L2 DFE252012F-1R0M=P2 C435392
PSU TPS62180YZFT C73980
R1, R3 CRCW0402470KFKED C482181
R2 0402WGF1503TCE C25755
RS232 R-RJ45R08P-A009 C2902700
RS232_UART MAX3232IPWR C113205

The power supply is definitely overkill for our needs, but more stuff can be connected to the board by simply soldering wires to it.

I will make the order on JLCPCB, test the hardware and then publish the resources under an open-source license.

davidebeatrici commented 1 year ago

The PCB(s) have arrived!

Pictures ![](https://github.com/leodesigner/powmr_comm/assets/5897523/7b7160cc-a039-4edf-a5bc-2faf0c22512c) ![](https://github.com/leodesigner/powmr_comm/assets/5897523/4edfbde5-3492-4093-a43c-57a38e932683)
davidebeatrici commented 1 year ago

Alright, the hardware is working as it should! It took me a while to test as I had to fix a few things. I will publish schematics and PCB soon.

The inverter is quite noisy in RF spectrum and may cause these devices to work less stable. Especially with the common ground.

You were absolutely right: when powered by the RS232 port, simply connecting the ground from the ESP32's UART header to a CH340 interface causes the computer's USB port to reset continuously... any ideas on how to fix that?