Configure a Renogy Power Sensor

Configure a renogy sensor to integrate a Renogy charge controller into your machine:

Navigate to the CONFIGURE tab of your machine’s page in the Viam app. Click the + icon next to your machine part in the left-hand menu and select Component. Select the power_sensor type, then select the renogy model. Enter a name or use the suggested name for your sensor and click Create.

Renogy power sensor configuration tab

Edit the attributes as applicable to your power sensor, according to the table below.

{
  "components": [
    {
      "name": "ren1",
      "model": "renogy",
      "type": "power_sensor",
      "namespace": "rdk",
      "attributes": {
        "serial_path": "<string>",
        "serial_baud_rate": <int>,
        "modbus_id": <int>
      },
      "depends_on": []
    }
  ]
}
{
  "components": [
    {
      "name": "your-renogy-sensor",
      "model": "renogy",
      "type": "power_sensor",
      "namespace": "rdk",
      "attributes": {
        "serial_path": "/dev/serial/by-path/usb-0:1.1:1.0",
        "serial_baud_rate": 9600,
        "modbus_id": 1
      },
      "depends_on": []
    }
  ]
}

The "serial_path" filepath used in this example is specific to serial devices connected to Linux systems. The "serial_path" filepath on a macOS system might resemble "/dev/ttyUSB0" or "/dev/ttyS0".

The following attributes are available for renogy sensors:

AttributeTypeRequired?Description
serial_pathstringOptionalThe full filesystem path to the serial device, starting with /dev/. To find your serial device path, first connect the serial device to your machine, then:
  • On Linux, run ls /dev/serial/by-path/* to show connected serial devices, or look for your device in the output of sudo dmesg | grep tty. Example: "/dev/serial/by-path/usb-0:1.1:1.0".
  • On macOS, run ls /dev/tty* | grep -i usb to show connected USB serial devices, ls /dev/tty* to browse all devices, or look for your device in the output of sudo dmesg | grep tty. Example: "/dev/ttyS0".

Default: /dev/serial0
serial_baud_rateintegerOptionalThe baud rate to use for serial communications.
Default: 9600
modbus_idintegerOptionalController MODBUS address.
Default: 1

Test the power sensor

After you configure your power sensor, open the power sensor’s TEST panel on the CONFIGURE or CONTROL tabs. The panel contains readings for your voltage, current, and power.

An instance of the power sensor component's test panel with voltage, current, and power readings.

Troubleshooting

If your power sensor is not working as expected, follow these steps:

  1. Check your machine logs on the LOGS tab to check for errors.
  2. Review this power sensor model’s documentation to ensure you have configured all required attributes.
  3. Click on the TEST panel on the CONFIGURE or CONTROL tab and test if you can use the power sensor there.

If none of these steps work, reach out to us on the Community Discord and we will be happy to help.

Next steps

For general configuration and development info, see:

Have questions, or want to meet other people working on robots? Join our Community Discord.

If you notice any issues with the documentation, feel free to file an issue or edit this file.