EPSOLAR solar charge controller monitoring system

When you retrieve a value out of your node.getResponseBuffer(), you are getting a 16 bit unsigned value. For the battery status, you then have to look at those specific bits

result = node.readInputRegisters(0x3200, 5);

if (result == node.ku8MBSuccess)
{

  Serial.print("Battery Status : ");
  Serial.println(node.getResponseBuffer(0x00), BIN);
  /*
    D15: 1-Wrong identification for rated voltage
    D8: Battery inner resistance abnormal 1, normal 0
    D7-D4: 0x00 Normal, 0x01 Over Temp.(Higher than the warning settings), 0x02 Low Temp.(Lower than the warning settings),
    D3-D0: 0x00 Normal ,0x01 Over Voltage. , 0x02 Under Voltage, 0x03 Over discharge, 0x04 Fault
  */
  uint16_t batStatus = node.getResponseBuffer(0x00);
  if ( batStatus & 0x8000 ) {
    Serial.print("Wrong identification for rated voltage");
  }
  if ( batStatus & 0x0100 ) {
    Serial.print("Battery inner resistance abnormal");
  }
  uint8_t temp = (batStatus & 0x00F0) >> 4;   // D7-D4 shifted down
  if ( temp == x000 ) {
    Serial.print("Normal");
  } else if ( temp == 0x01 ) {
    Serial.print("Over Temp.(Higher than the warning settings)");
  } else if ( temp == 0x02 ) {
    Serial.print("Low Temp.(Lower than the warning settings)");
  }

  temp = (batStatus & 0x000F);   // D3-D0
  if ( temp == x000 ) {
    Serial.print("Normal");
  } else if ( temp == 0x01 ) {
    Serial.print("Over Voltage.");
  } else if ( temp == 0x02 ) {
    Serial.print("Under Voltage");
  } else if ( temp == 0x03 ) {
    Serial.print("Over discharge");
  } else if ( temp == 0x04 ) {
    Serial.print("Fault");
  }
1 Like