we are working on a project where an ESP32 communicates with a solar inverter (Axpert KS/MKS/V) over RS232 to fetch status data (e.g., PV power, battery voltage) via the QPIGS<cr>
command. The ESP32 then sends this data to an MQTT broker.
To protect the inverter from unauthorized commands (in case the ESP32 is compromised via OTA or network access), I plan to use an ATtiny as a middle layer between the ESP32 and the inverter. The ATtiny would act as a command filter, allowing only QPIGS<cr>
to pass through to the inverter and blocking any other commands (e.g., those that could change charging parameters).
Problem:
Despite setting the same baud rate and RS232 communication parameters, the ATtiny is having trouble communicating with the inverter (e.g., incomplete or failed data transmissions). The ESP32 can communicate directly with the inverter without issues.
Questions:
- Is using an ATtiny a reliable way to filter RS232 commands for this application, or could it be causing the communication issues?
- Could the limited processing power or serial handling of the ATtiny be the problem? Should I consider a different MCU or hardware filter approach?
- What are the best practices to ensure robust RS232 communication between an MCU and an inverter while maintaining security?
System Details:
- Inverter: Axpert KS/MKS/V
- ESP32: Communicating over RS232
- ATtiny: Acting as a command filter, forwarding only
QPIGS<cr>
. - Baud rate: 2400
- Protocol: RS232
Any advice on resolving these issues or suggestions for alternative solutions would be appreciated!
QPIGS
to the inverter. \$\endgroup\$QPIGS
, then just have the ATTing generate that command itself, triggered by the ESP. \$\endgroup\$