corbinbs / solarshed

A Python library to help monitor solar charge controllers typically used in off the grid applications.
MIT License
86 stars 25 forks source link

Test setup with Renogy Rover #22

Open popstefanija opened 9 months ago

popstefanija commented 9 months ago

Hello,

Currently I am trying to make this work with a test setup of the Renogy Rover MPTT 40A controller. I have only a Mighty Max 12V 100Ahr connected to Bat (+) and Bat (-). PV(+), PV(-), Load(+), and Load(-) are all disconnected.

I can successfully use solarshed on '/dev/ttyUSB4', and I am confident this is the port that the Rover uses (see below). However there is no response from the Rover, why would that be? Do I need to make an adjustment to my test setup?

`

from solarshed.controllers.renogy_rover import RenogyRover controller = RenogyRover('/dev/ttyUSB4', 1) controller.charging_status() Traceback (most recent call last): File "", line 1, in File "/home/ubuntu/radioconda/lib/python3.10/site-packages/solarshed/controllers/renogy_rover.py", line 163, in charging_status return self.read_register(288) & 0x00ff File "/home/ubuntu/radioconda/lib/python3.10/site-packages/minimalmodbus.py", line 258, in read_register return self._genericCommand(functioncode, registeraddress, numberOfDecimals=numberOfDecimals, signed=signed) File "/home/ubuntu/radioconda/lib/python3.10/site-packages/minimalmodbus.py", line 697, in _genericCommand payloadFromSlave = self._performCommand(functioncode, payloadToSlave) File "/home/ubuntu/radioconda/lib/python3.10/site-packages/minimalmodbus.py", line 795, in _performCommand response = self._communicate(request, number_of_bytes_to_read) File "/home/ubuntu/radioconda/lib/python3.10/site-packages/minimalmodbus.py", line 930, in _communicate raise IOError('No communication with the instrument (no answer)') OSError: No communication with the instrument (no answer) `

jim0020 commented 9 months ago

Have you tried adjusting the slave address? I had to change it to get mine to work for some unknown reason. I temporarily changed the code to find the correct slave address:

if __name__ == "__main__":
    slaveaddress = 1
    while slaveaddress < 256 :
        try:
            print( 'Trying slaveaddress: ', slaveaddress )
            rover = RenogyRover('/dev/ttyUSB0', slaveaddress)
            print('Model: ', rover.model())
            print('Battery %: ', rover.battery_percentage())
            print('Battery Type: ', rover.battery_type())
            print('Battery Capacity: ', rover.battery_capacity())
            print('Battery Voltage: ', rover.battery_voltage())
            battery_temp = rover.battery_temperature()
            print('Battery Temperature: ', battery_temp, battery_temp * 1.8 + 32)
            controller_temp = rover.controller_temperature()
            print('Controller Temperature: ', controller_temp, controller_temp * 1.8 + 32)
            print('Load Voltage: ', rover.load_voltage())
            print('Load Current: ', rover.load_current())
            print('Load Power: ', rover.load_power())
            print('Charging Status: ', rover.charging_status_label())
            print('Solar Voltage: ', rover.solar_voltage())
            print('Solar Current: ', rover.solar_current())
            print('Solar Power: ', rover.solar_power())
            print('Power Generated Today (kilowatt hours): ', rover.power_generation_today())
            print('Charging Amp/Hours Today: ', rover.charging_amp_hours_today())
            print('Discharging Amp/Hours Today: ', rover.discharging_amp_hours_today())
            break
        except minimalmodbus.NoResponseError:
            slaveaddress = slaveaddress + 1
jim0020 commented 9 months ago

Is your test setup the same computer you run the working solarshed on? Make sure the serial port, /dev/ttyUSB4, is correct for your test setup.

popstefanija commented 9 months ago

Thank you, it worked! I used 16 as slaveaddress, which I identified as device_id using this software