toggio / PhpEpsolarTracer

Library for communicating with Epsolar/Epever Tracer BN MPPT Solar Charger Controller
66 stars 23 forks source link

Is there a way to change Controller ID #10

Open Bmorunning opened 7 years ago

Bmorunning commented 7 years ago

I have three EpSolar controllers in my system. They are all on the same RS-485 network and are addressed as 1,2 and 3. I can read unit 1 and receive the data. Is there a way I can add or change the program so I can read all three units? I tried to follow the program and tried to find where it calls for the data from the controller, It seems it just uses the default address with out being signed.

thanks

acmorfe commented 7 years ago

change \x01 to device id.

$this->tracer->sendRawQuery("\x01\x43\x33\x00\x00\x76\xca\xa7",false);

Bmorunning commented 7 years ago

Thanks for the input, I tried that and I get a serial port time out error. I changed all Queries to /x02, if I change it back to /x01 it works fine. Is there some where else that could conflict the x02?

Bmorunning commented 7 years ago

If i uses the debug, it sends the data and receives back, all thou there is no data in the fields.

pi@solar-pi:/var/www/html/epsolar $ php test.php DEBUG [query sent]: \x03\x04\x31\x0c\x00\x03\x7f\x16 DEBUG [response received]: \x03\x04\x06\x00\x00\x00\x00\x00\x00\x79\xf3 DEBUG [data]: \x00\x00\x00\x00\x00\x00 Array ( [0] => 00 [1] => 00 [2] => 00 [3] => 00 [4] => 00 [5] => 00 ) DEBUG [query sent]: \x03\x04\x31\x0c\x00\x03\x7f\x16 DEBUG [response received]: \x03\x04\x06\x00\x00\x00\x00\x00\x00\x79\xf3

acmorfe commented 7 years ago

did you recalculate the CRC?

Bmorunning commented 7 years ago

<?php // Include Php Serial Modbus Class require 'PhpSerialModbus.php';

// Crate an instance of the class $modbus = new PhpSerialModbus;

// Initialize port $modbus->deviceInit('/dev/ttyUSB0',115200,'none',8,1,'none');

// Open port $modbus->deviceOpen();

// Enalbe debug $modbus->debug = true;

// Send query to slave 1 with function code 4, asking for 3 registers from 310C $result=$modbus->sendQuery(3,4,"310C",3); print_r($result);

// Send raw query $rawquery="\x03\x04\x31\x0c\x00\x03"; $modbus->sendRawQuery($rawquery.$modbus->crc16($rawquery),false);

// Get response with raw data $result=$modbus->getResponse(true); print_r($result);

// Close device $modbus->deviceClose(); ?> This is what I am using to test to see if i get results back from controller 3, a lot easier to try on smaller file. I am not sure with the crc or how to go about doing that.

Thanks for any help

Bmorunning commented 7 years ago

`<?php // Include Php Serial Modbus Class require 'PhpSerialModbus.php';

// Crate an instance of the class $modbus = new PhpSerialModbus;

// Initialize port $modbus->deviceInit('/dev/ttyUSB0',115200,'none',8,1,'none');

// Open port $modbus->deviceOpen();

// Enalbe debug $modbus->debug = true;

// Send query to slave 1 with function code 4, asking for 3 registers from 310C $result=$modbus->sendQuery(3,4,"310C",3); print_r($result);

// Send raw query $rawquery="\x03\x04\x31\x0c\x00\x03"; $modbus->sendRawQuery($rawquery.$modbus->crc16($rawquery),false);

// Get response with raw data $result=$modbus->getResponse(true); print_r($result);

// Close device $modbus->deviceClose(); ?> ` Sorry forgot to add as code.

acmorfe commented 7 years ago

you are querying LOAD voltage/current/power... maybe there is no load or load is turned off.