5s bms temperature monitoring

good day, im busy setting up the 5s board and was wondering how to monitor and measure temperature from the two ADC pins on the MCU . The typical measurements are done from the bms24v48v using the AFE but in this case they are done by the mcu ? and how would i make sure that the measurement is being monitored and honoured ? the bms set temperature has no reference to PA6 and PA7 pin_temp definitions ?

In the BMS 5s the temperature measurement is independent of the BQ temperature sensing channel, as this caused some issues in the BMS24V/48V:

  1. Measurement is disturbed during button-press
  2. Accidental connection of different temperature sensors destroys the board, as they are referenced to different potentials (GND, cell 5 and cell 10).

Point 2 is not relevant for the BMS-5s. But the AFE doesn’t perform any actions based on over-/under-temperatures, so there is no difference in sensing the temperature directly with the MCU or via the BQ chip.

Reading the temperature in the BMS-5s is not yet implemented in the software, but it shouldn’t be too difficult to implement. Just normal ADC reading and temperature calculation.

Good day

Just some feed back regarding temperature cut off thresholds, i am sure there is a better way of implimenting this solution for the 24vand 48v bms . Please see my code below .
//Temperature Cutoffs Setup

        // Lower and Upper Limits To prevent Hystersis  3 and 72
        if ((temperatures[0] <= 3) || (temperatures[0] >= 72) ||
        (temperatures[1] <= 3) || (temperatures[1] >= 72) ||
        (temperatures[2] <= 3) || (temperatures[2] >= 72))
      } // Greater and lower Values to prevent Hystersis 7 and 68
        else if ((temperatures[0] > 7) || (temperatures[0] < 68) ||
        (temperatures[1] > 7) || (temperatures[1] < 68) ||
        (temperatures[2] > 7) || (temperatures[2] < 68))
        BMS.enableDischarging();//Lower Band Values
      } // Lower and Upper Limits To prevent Hystersis 3 and 47

        if ((temperatures[0] <= 3) || (temperatures[0] >= 47) ||
        (temperatures[1] <= 3) || (temperatures[1] >= 47) ||
        (temperatures[2] <= 3) || (temperatures[2] >= 47))
        BMS.disableCharging();  //Upper Band Values
      } // Greater and lower Values to prevent Hystersis 7 and 43
        else if ((temperatures[0] > 7) || (temperatures[0] < 43) ||
        (temperatures[1] > 7) || (temperatures[1] < 43) ||
        (temperatures[2] > 7) || (temperatures[2] < 43))

Correct my if im wrong but this needs to link to the CPP file rather then acting in the main.cpp and calling the bq769x0.cpp to read and write registers based on this condition .

ideally this line of code is supposed to respond to the temperature parameters but it does nothing based on the defintion in the Header file .
BMS.setTemperatureLimits(-20, 45, 0, 45)
Should the code in my previous post be placed in the header or cpp file and then called on to get BMS.SetTemperature variables to work correctly ?

It’s not true that setTemperatureLimits does nothing. The actual code is in the cpp file, not in the header file. Please look at https://github.com/LibreSolar/bq769x0_mbed_lib/blob/master/bq769x0.cpp#L553

You shouldn’t use fixed temperature values in your code, instead use the assigned min and max variables.

And you can’t use logical or in the enable condition. All values have to be in the allowed range, not only one.

thank you for that Frank, when i use the assigned max and min variables in the code the bms does not act on any of the changes, though i do see the information corresponding to the CPP .

void bq769x0::setTemperatureLimits(int minDischarge_degC, int maxDischarge_degC,
int minCharge_degC, int maxCharge_degC)
// Temperature limits (°C/10)
minCellTempDischarge = minDischarge_degC * 10;
maxCellTempDischarge = maxDischarge_degC * 10;
minCellTempCharge = minCharge_degC * 10;
maxCellTempCharge = maxCharge_degC * 10;

Setting my main.cpp configuration has no action on what takes place during charge and discharge unless im missing something ? your help would be greatly appreciated .

In the current library code the temperature limits are only evaluated once in the setup routine by calling enableCharging or enableDischarging, not when running.

I have an implementation which checks the temperatures in running mode. I have to clean it up first, then I will do a pull request within the next days.

sounds good i will appreciate this greatly . as i grow my knowledge more and more regarding code and hardware . Thank you Frank .

good day . Just checking when i can get the new code to test temperature failsafes, i know my code is not great and am a little concerned with functionality as im using nmc cells … any help would be greatly appreciated.

I hope i will find some time to upload this next weekend.

Here you go: https://github.com/LibreSolar/bq769x0_mbed_lib/pull/10

works like a dream no issue on the system during power off and on . Many thanks for your efforts and code much cleaner then mine :slight_smile: