I'll help you create code for a Raspberry Pi Pico to read data from a Morningstar ProStar charge controller via RS-232 and send it to a Signal K server over WiFi.I've created a complete MicroPython program for your Raspberry Pi Pico W to bridge the Morningstar ProStar charge controller to your Signal K server. Here's what you need to know:
- Modbus RTU communication with ProStar via RS-232
- WiFi connectivity to send data to Signal K server
- Multiple parameters monitored: battery voltage/current, solar panel voltage/current, temperatures, charge state
- Automatic scaling of raw Modbus values to real units
- Error handling and CRC validation
-
Hardware connections:
- Pico GP0 (TX) → RS-232 board RX
- Pico GP1 (RX) → RS-232 board TX
- Connect grounds and power
-
Configuration (update these in the code):
WIFI_SSIDandWIFI_PASSWORDSIGNALK_HOST- IP address of your Raspberry Pi 4PROSTAR_ADDRESS- Modbus address of your ProStar (default is 1)
-
Install MicroPython on Pico W (download from raspberrypi.com)
-
Upload the code using Thonny IDE or similar
-
Signal K Server Setup on your Pi 4:
- Ensure Signal K is accepting PUT requests
- Data will appear under
electrical.batteries.houseandelectrical.solarpaths
- The ProStar uses Modbus RTU protocol at 9600 baud
- Data is read every 10 seconds (adjustable via
READ_INTERVAL) - The code includes proper Modbus CRC checking
- Temperature is converted to Kelvin for Signal K compliance
Would you like me to add any specific features, such as MQTT support, data logging, or different update intervals?