Kia Niro BMS

evdc
Posts: 12
Joined: Fri Nov 24, 2023 6:00 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by evdc »

Thanks for the answer @bexander , but if you see here

Code: Select all

0 3947 1 3952 2 3947 3 3950 4 3949 5 3952 
Module: 0
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3952 1 3951 2 3947 3 3942 4 3943 5 3954 
Module: 1
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3946 1 3954 2 3951 3 3952 4 3951 5 3952 
Module: 2
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3948 1 3907 2 3949 3 3946 4 3940 5 3946 
Module: 3
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3944 1 3949 2 3951 3 3952 4 3942 5 3948 
Module: 4
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3946 1 3954 2 3949 3 3951 4 3949 5 3952 
Module: 5
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3940 1 3944 2 3943 3 3951 4 3943 5 3944 
Module: 6
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3944 1 3952 2 3951 3 3868 4 3944 5 3947 
Module: 7
All Cells to Balance
110111
Cell to Balance Filtered :100010
1 5  Voltage Diff Min-Max: 119
0 3948 1 3946 2 3943 3 3947 4 3949 5 3952 
Module: 8
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3943 1 3954 2 3947 3 3953 4 3945 5 3944 
Module: 9
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3947 1 3941 2 3938 3 3987 4 3946 5 3952 
Module: 10
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3947 1 3952 2 3945 3 3948 4 3946 5 3953 
Module: 11
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3943 1 3943 2 3940 3 3945 4 3939 5 3944 
Module: 12
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3948 1 3946 2 3937 3 3949 4 3947 5 3950 
Module: 13
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3944 1 3955 2 3938 3 3951 4 3950 5 3950 
Module: 14
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3945 1 3945 2 3941 3 3945 4 3945 5 3948 
Module: 15
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3941 1 3951 2 3939 3 3952 4 3944 5 3943 
Module: 16
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
0 3947 1 3948 2 3942 3 3942 4 3939 5 3948 
Module: 17
All Cells to Balance
111111
Cell to Balance Filtered :101010
1 3 5  Voltage Diff Min-Max: 119
, the balance is included for the 1st, 3rd and 5th cells for all modules except for the 7th module, which is correctly written on serial.out, however, in practice it starts the balance of the 3rd cell can be noticed here

Code: Select all

High Cell: 3985V Module: 10 Cell: 3  Low Cell: 3852V Module: 7 Cell: 3
Total Voltage: 425932
High Cell Temp C: 14  Low Cell Temp C: 12  High Die Temp C: 20
 
because when the balance of the 3rd cell in the 7th module is not released

Code: Select all


0 3949 1 3953 2 3948 3 3950 4 3950 5 3952 
Module: 0
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3951 1 3954 2 3947 3 3943 4 3943 5 3954 
Module: 1
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3946 1 3954 2 3949 3 3954 4 3949 5 3952 
Module: 2
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3947 1 3907 2 3949 3 3945 4 3941 5 3947 
Module: 3
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3944 1 3953 2 3952 3 3951 4 3943 5 3947 
Module: 4
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3944 1 3952 2 3948 3 3953 4 3951 5 3950 
Module: 5
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3941 1 3944 2 3943 3 3952 4 3941 5 3940 
Module: 6
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3946 1 3953 2 3950 3 3865 4 3943 5 3947 
Module: 7
All Cells to Balance
110111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3947 1 3944 2 3940 3 3947 4 3947 5 3951 
Module: 8
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3943 1 3954 2 3946 3 3954 4 3946 5 3944 
Module: 9
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3947 1 3940 2 3940 3 3987 4 3946 5 3949 
Module: 10
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3950 1 3952 2 3944 3 3951 4 3946 5 3954 
Module: 11
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3942 1 3946 2 3939 3 3946 4 3935 5 3946 
Module: 12
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3946 1 3946 2 3937 3 3949 4 3946 5 3948 
Module: 13
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3942 1 3955 2 3941 3 3951 4 3947 5 3949 
Module: 14
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3947 1 3944 2 3940 3 3944 4 3946 5 3947 
Module: 15
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3940 1 3950 2 3940 3 3953 4 3945 5 3942 
Module: 16
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 122
0 3945 1 3951 2 3941 3 3943 4 3935 5 3945 
Module: 17
All Cells to Balance
111111
Cell to Balance Filtered :10101

the voltage is like this

Code: Select all


High Cell: 4002V Module: 10 Cell: 3  Low Cell: 3881V Module: 7 Cell: 3
Total Voltage: 426104
High Cell Temp C: 14  Low Cell Temp C: 12  High Die Temp C: 20


Best Regards
User avatar
bexander
Posts: 857
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 67 times
Been thanked: 96 times

Re: Kia Niro BMS

Post by bexander »

When cell balancing is active you can not trust the cell voltage readings. When a cell is balanced it will have effect on adjecent cell voltage readings. To measure the cell voltages correctly, no balancing can be active while taking measurement.

An example from an old log.
Voltage reading at rest (no balancing):
1: 4136 4144 4142 4143 4142 4141 4143 4142
Balancing active as follows:
1: 0010 0101
Voltage reading with active balancing:
1: 4136 4153 4121 4154 4150 4125 4159 4124
evdc
Posts: 12
Joined: Fri Nov 24, 2023 6:00 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by evdc »

bexander wrote: Thu Oct 24, 2024 3:08 pm When cell balancing is active you can not trust the cell voltage readings. When a cell is balanced it will have effect on adjecent cell voltage readings. To measure the cell voltages correctly, no balancing can be active while taking measurement.

An example from an old log.
Voltage reading at rest (no balancing):
1: 4136 4144 4142 4143 4142 4141 4143 4142
Balancing active as follows:
1: 0010 0101
Voltage reading with active balancing:
1: 4136 4153 4121 4154 4150 4125 4159 4124

Ok, but why when I turn off the balancing of the 7th module completely I keep seeing how the 3rd cell discharges? I also charged and discharged the battery for a week and the balance only got worse!

Best regards
User avatar
manny
Posts: 65
Joined: Sun Jan 23, 2022 4:15 pm
Location: Netherlands
Has thanked: 13 times
Been thanked: 51 times

Re: Kia Niro BMS

Post by manny »

if one cell always discharging. I would look for a hardware problem.

first check the cell voltage with a multimeter. and compare them with the bms readings.

if without the bms connected the battery still discharges.
maybe the cell is bad or the bms chip is damaged and the balance is always on?
evdc
Posts: 12
Joined: Fri Nov 24, 2023 6:00 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by evdc »

manny wrote: Thu Oct 24, 2024 5:12 pm if one cell always discharging. I would look for a hardware problem.

first check the cell voltage with a multimeter. and compare them with the bms readings.

if without the bms connected the battery still discharges.
maybe the cell is bad or the bms chip is damaged and the balance is always on?
I did the following test, when I ran a balance on all modules up to and including the 7th, there was no problem and it didn't include the balance on the 3rd cell, however when I ran a balance on all the modules up to 8 then it ran the balance on the 3rd cell from my 7th module even though it didn't was included in the balance command being sent. I think it triggered the balance of all modules from 1st to 7th the same way it did for my 8th module! Check if I address the modules correctly and there was no problem there, I really don't know how to solve this problem.

Best Regards
User avatar
bexander
Posts: 857
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 67 times
Been thanked: 96 times

Re: Kia Niro BMS

Post by bexander »

Have you tried swapping position of the different modules? Do you still have the same effect when having module 7 as module 1 or as module 12?

Test with this SW and all modules. Do you still have the same behaviour?
BMS_test_OI.ino
(45.27 KiB) Downloaded 97 times
evdc
Posts: 12
Joined: Fri Nov 24, 2023 6:00 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by evdc »

bexander wrote: Fri Oct 25, 2024 1:03 am Have you tried swapping position of the different modules? Do you still have the same effect when having module 7 as module 1 or as module 12?

Test with this SW and all modules. Do you still have the same behaviour?
BMS_test_OI.ino
Hello, after I set my pin out to the code they sent me, I got the serial out, I don't know why.

Best Regards

Code: Select all


Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
InitCAN WD timeout
Daisy chain init
UARTSlaveDevicesWakeUp WD timeout
Set all slaves
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
WRITEALL fail
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
WRITEALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF
A
errorByte cleared
Error FF
A
errorByte cleared
READALL fail
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
Error FF
E
errorByte cleared
WRITEALL fail
STATUS cleared
E
errorByte cleared
Error FF
Error FF

�
���O~��Error FF
A
errorByte cleared
READALL fail

Attachments
BMS_test_OI.zip
(9.88 KiB) Downloaded 70 times
User avatar
bexander
Posts: 857
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 67 times
Been thanked: 96 times

Re: Kia Niro BMS

Post by bexander »

The CAN init fails. The SPI-bus setup is done by CAN init, hence the MAX17841 init fails as well.
I suggest you start by looking at why the CAN-init fails.
evdc
Posts: 12
Joined: Fri Nov 24, 2023 6:00 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by evdc »

bexander wrote: Sat Oct 26, 2024 12:31 pm The CAN init fails. The SPI-bus setup is done by CAN init, hence the MAX17841 init fails as well.
I suggest you start by looking at why the CAN-init fails.
Can I not use CAN to run this program?
User avatar
bexander
Posts: 857
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 67 times
Been thanked: 96 times

Re: Kia Niro BMS

Post by bexander »

No need to use CAN but you then need to setup the SPI-bus in another way.
evdc
Posts: 12
Joined: Fri Nov 24, 2023 6:00 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by evdc »

bexander wrote: Sat Oct 26, 2024 2:06 pm No need to use CAN but you then need to setup the SPI-bus in another way.
Hello, I was able to run the test code that you sent me and I compared the series output of the two codes and I think I understood what the main error is.

Output from testCode:

Code: Select all


Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
Entering Configuration Mode Failure...
InitCAN WD timeout
Daisy chain init
Set all slaves
3 2 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 0 80 20 D D3 
422.8   0.0     0.0     8
48 3920 83 3772
-18     79      -18     15
1: 3879 3918 3917 3919 3919 3918 79 -18 14
2: 3918 3916 3919 3917 3918 3918 -18 79 13
3: 3916 3918 3918 3916 3918 3919 79 -18 14
4: 3918 3918 3918 3918 3919 3919 -18 79 15
5: 3916 3916 3918 3916 3884 3917 79 -18 14
6: 3917 3919 3919 3918 3918 3919 -18 79 14
7: 3919 3919 3919 3916 3899 3917 79 -18 13
8: 3918 3919 3918 3919 3918 3920 -18 79 14
9: 3918 3918 3911 3919 3918 3919 79 -18 14
10: 3917 3919 3919 3914 3917 3919 -18 79 14
11: 3918 3919 3919 3919 3919 3919 79 -18 14
12: 3918 3917 3911 3919 3917 3919 -18 79 14
13: 3919 3919 3918 3918 3917 3920 79 -18 14
14: 3918 3916 3918 3919 3772 3918 -18 79 14
15: 3917 3919 3917 3919 3917 3919 79 -18 14
16: 3918 3919 3919 3917 3918 3918 -18 79 14
17: 3917 3919 3919 3918 3916 3918 79 -18 14
18: 3916 3920 3917 3917 3920 3880 -18 79 14
422.8   0.0     0.0     8
48 3920 83 3772
-18     79      -18     15
1: 3879 3918 3917 3919 3919 3918 79 -18 14
2: 3918 3916 3919 3918 3918 3918 -18 79 14
3: 3917 3918 3918 3914 3918 3919 79 -18 14
4: 3919 3918 3917 3918 3919 3919 -18 79 15
5: 3916 3916 3918 3916 3883 3917 79 -18 14
6: 3917 3919 3919 3919 3918 3919 -18 79 14
7: 3918 3919 3919 3916 3899 3918 79 -18 13
8: 3918 3919 3918 3919 3918 3920 -18 79 14
9: 3918 3919 3911 3918 3918 3919 79 -18 15
10: 3917 3918 3919 3915 3917 3919 -18 79 14
11: 3918 3919 3919 3919 3920 3919 79 -18 14
12: 3919 3918 3911 3919 3917 3919 -18 79 14
13: 3919 3919 3918 3919 3917 3920 79 -18 15
14: 3918 3916 3918 3918 3772 3919 -18 79 14
15: 3918 3919 3917 3919 3917 3919 79 -18 14
16: 3918 3919 3919 3917 3918 3918 -18 79 14
17: 3918 3919 3919 3917 3915 3918 79 -18 14
18: 3916 3920 3917 3918 3920 3880 -18 79 14
422.8   0.0     0.0     8
48 3920 83 3772

Output from other code i run:

Code: Select all


UARTSlaveDevicesWakeUp done 1
UARTSlaveDevicesWakeUp done 2
Modules:18
all slaves balance off 
Balance cells
High Cell: 3922V Module: 0 Cell: 1  Low Cell: 3774V Module: 4 Cell: 4
Total Voltage: 422901
High Cell Temp C: 11  Low Cell Temp C: 0  High Die Temp C: 15
Low Temperature Restriction
Power Control: 29
Regen Control: 29
Status: 1000   Charger LED Status: 10
0 3918 1 3922 2 3916 3 3918 4 3922 5 3880 
Module: 0
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3918 1 3919 2 3918 3 3918 4 3915 5 3919 
Module: 1
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3918 1 3921 2 3918 3 3918 4 3919 5 3921 
Module: 2
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3918 1 3919 2 3918 3 3919 4 3916 5 3921 
Module: 3
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3918 1 3919 2 3920 3 3919 4 3772 5 3918 
Module: 4
All Cells to Balance
101111
Cell to Balance Filtered :101
0 2  Voltage Diff Min-Max: 150
0 3919 1 3920 2 3917 3 3919 4 3918 5 3921 
Module: 5
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3918 1 3915 2 3910 3 3919 4 3916 5 3918 
Module: 6
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3919 1 3918 2 3920 3 3919 4 3920 5 3917 
Module: 7
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3917 1 3921 2 3919 3 3914 4 3917 5 3919 
Module: 8
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3919 1 3919 2 3910 3 3918 4 3916 5 3921 
Module: 9
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3919 1 3919 2 3918 3 3919 4 3918 5 3919 
Module: 10
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3921 1 3920 2 3921 3 3915 4 3897 5 3916 
Module: 11
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3917 1 3918 2 3919 3 3918 4 3918 5 3920 
Module: 12
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3916 1 3916 2 3918 3 3915 4 3885 5 3918 
Module: 13
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3918 1 3916 2 3919 3 3918 4 3918 5 3918 
Module: 14
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3916 1 3919 2 3918 3 3915 4 3917 5 3918 
Module: 15
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3918 1 3915 2 3921 3 3917 4 3919 5 3916 
Module: 16
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
0 3879 1 3918 2 3915 3 3919 4 3919 5 3919 
Module: 17
All Cells to Balance
111111
Cell to Balance Filtered :10101
0 2 4  Voltage Diff Min-Max: 150
High Cell: 3922V Module: 0 Cell: 1  Low Cell: 3772V Module: 4 Cell: 4
Total Voltage: 422873
High Cell Temp C: 11  Low Cell Temp C: 8  High Die Temp C: 15
Low Temperature Restriction
Power Control: 88
Regen Control: 88
Status: 1000   Charger LED Status: 10
High Cell: 3937V Module: 1 Cell: 3  Low Cell: 3756V Module: 4 Cell: 4
Total Voltage: 422808
High Cell Temp C: 11  Low Cell Temp C: 8  High Die Temp C: 16
Low Temperature Restriction


User avatar
bexander
Posts: 857
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 67 times
Been thanked: 96 times

Re: Kia Niro BMS

Post by bexander »

evdc wrote: Sat Oct 26, 2024 4:27 pm Hello, I was able to run the test code that you sent me and I compared the series output of the two codes and I think I understood what the main error is.
That sounds great. Please, share what the error was so I and others can learn from it.
evdc
Posts: 12
Joined: Fri Nov 24, 2023 6:00 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by evdc »

bexander wrote: Sun Oct 27, 2024 11:44 am That sounds great. Please, share what the error was so I and others can learn from it.
I haven't solved the problem yet, but I noticed that the lowest cell in the code you sent me is in 14 modules, and in the code I'm using, the lowest cell is in the 5th module and I think that the problem lies somewhere in there.
User avatar
bexander
Posts: 857
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 67 times
Been thanked: 96 times

Re: Kia Niro BMS

Post by bexander »

Quite some difference between storeCellVoltage:
My version:

Code: Select all

void storeCellVoltage(uint8_t dataRegister, uint8_t readRegisterData[(2*numberOfSlaves + 5)]) 
{	
	for(int i=0; i<numberOfSlaves; i++)
	{
		uint16_t measVoltage = ((readRegisterData[(2*numberOfSlaves + 1) - i*2] << 8) + readRegisterData[(2*numberOfSlaves) - i*2]);
		measVoltage = (measVoltage >> 2) * (uint32_t)5000 / 0x3FFF;
		cellVoltage[i*numberOfCellsPerSlave + (dataRegister - 0x20)] = measVoltage;
	}
}
Your:

Code: Select all

void storeCellVoltage(uint8_t dataRegister, uint8_t readRegisterData[29])
{
  uint8_t cellNumberOffset = dataRegister - 0x20;
  //Serial.println(cellNumberOffset);

  for (int i = 0; i < NumModulesFound; i++)
  {
    uint32_t measVoltage = ((readRegisterData[3 + (i * 2)] << 6) + (readRegisterData[2 + (i * 2)] >> 2));
    measVoltage = (measVoltage * 5000) / 16383;
    cellVoltageNew[i][cellNumberOffset] = measVoltage;

    // Serial.println("");
    // Serial.println(dataRegister);
    // Serial.println(measVoltage);
    // Serial.println("");
  }
}
EDIT: This line give different array position results:

Code: Select all

uint16_t measVoltage = ((readRegisterData[(2*numberOfSlaves + 1) - i*2] << 8) + readRegisterData[(2*numberOfSlaves) - i*2]);
Compared to:

Code: Select all

uint32_t measVoltage = ((readRegisterData[3 + (i * 2)] << 6) + (readRegisterData[2 + (i * 2)] >> 2));
evdc
Posts: 12
Joined: Fri Nov 24, 2023 6:00 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by evdc »

bexander wrote: Sun Oct 27, 2024 3:39 pm Quite some difference between storeCellVoltage:
My version:

Code: Select all

void storeCellVoltage(uint8_t dataRegister, uint8_t readRegisterData[(2*numberOfSlaves + 5)]) 
{	
	for(int i=0; i<numberOfSlaves; i++)
	{
		uint16_t measVoltage = ((readRegisterData[(2*numberOfSlaves + 1) - i*2] << 8) + readRegisterData[(2*numberOfSlaves) - i*2]);
		measVoltage = (measVoltage >> 2) * (uint32_t)5000 / 0x3FFF;
		cellVoltage[i*numberOfCellsPerSlave + (dataRegister - 0x20)] = measVoltage;
	}
}
Your:

Code: Select all

void storeCellVoltage(uint8_t dataRegister, uint8_t readRegisterData[29])
{
  uint8_t cellNumberOffset = dataRegister - 0x20;
  //Serial.println(cellNumberOffset);

  for (int i = 0; i < NumModulesFound; i++)
  {
    uint32_t measVoltage = ((readRegisterData[3 + (i * 2)] << 6) + (readRegisterData[2 + (i * 2)] >> 2));
    measVoltage = (measVoltage * 5000) / 16383;
    cellVoltageNew[i][cellNumberOffset] = measVoltage;

    // Serial.println("");
    // Serial.println(dataRegister);
    // Serial.println(measVoltage);
    // Serial.println("");
  }
}
EDIT: This line give different array position results:

Code: Select all

uint16_t measVoltage = ((readRegisterData[(2*numberOfSlaves + 1) - i*2] << 8) + readRegisterData[(2*numberOfSlaves) - i*2]);
Compared to:

Code: Select all

uint32_t measVoltage = ((readRegisterData[3 + (i * 2)] << 6) + (readRegisterData[2 + (i * 2)] >> 2));
Thank you very much for your help @bexander, that was the main problem!
Best regards
User avatar
Bratitude
Posts: 850
Joined: Thu Jan 02, 2020 7:35 pm
Location: Canada
Has thanked: 102 times
Been thanked: 241 times
Contact:

Re: Kia Niro BMS

Post by Bratitude »

manny wrote: Sun Nov 05, 2023 12:04 pm
Also made a board to fit in a waterproof housing

20231105_123553.jpg
Do have you have the gerber and bom for this?
https://bratindustries.net/ leaf motor couplers, adapter plates, custom drive train components
User avatar
manny
Posts: 65
Joined: Sun Jan 23, 2022 4:15 pm
Location: Netherlands
Has thanked: 13 times
Been thanked: 51 times

Re: Kia Niro BMS

Post by manny »

Sure.

Will put it on GitHub and post a link. Hopefully have some time to do this tonight.
User avatar
manny
Posts: 65
Joined: Sun Jan 23, 2022 4:15 pm
Location: Netherlands
Has thanked: 13 times
Been thanked: 51 times

Re: Kia Niro BMS

Post by manny »

AmeldePamel
Posts: 2
Joined: Thu Dec 12, 2024 11:25 am

Re: Kia Niro BMS

Post by AmeldePamel »

bigmotherwhale wrote: Sun Nov 05, 2023 3:28 pm tidy setup, do you have contactor control on that board? I think this will need to be changed to reflect the number of modules and whether they are series / parallel

if((batteryVoltage > 300) && (compareVoltage > batteryVoltage) && (millis() - lastMillisContactor > 500))

I also found a thread on here where someone had done a similar thing to this code, it might be worth having a look, search for "MAX_Teensy_1.2"

Im interfacing with an all in one BMS with the CMUs onboard, using as much existing hardware as possible.

I realised my current sensor is only a single sensor not with high and low, and also I need an additional contactor and economizer control as well as a canbus signal from the inverter to determine voltage, so im trying to work out what I need to change in the code.
Hello. It looks like you use the original board from Kefico? What have you added to the board? Is it possible to read the CAN with these additinal boards?
bigmotherwhale
Posts: 111
Joined: Tue Sep 22, 2020 6:48 pm
Has thanked: 15 times
Been thanked: 22 times

Re: Kia Niro BMS

Post by bigmotherwhale »

AmeldePamel wrote: Thu Dec 12, 2024 11:58 am Hello. It looks like you use the original board from Kefico? What have you added to the board? Is it possible to read the CAN with these additinal boards?
I have read the stock BMS with a elm327 and a smartphone app, but the Arduino i have crudely patched into the hardware disables the onboard micro.
It should be easy to read the battery voltages and temp through the one of the CAN ports on there, i think there are two channels. Try looking for a pinout, you just need 12v, GND and IGN, and of course the can connection, if my memory serves me well.
AmeldePamel
Posts: 2
Joined: Thu Dec 12, 2024 11:25 am

Re: Kia Niro BMS

Post by AmeldePamel »

bigmotherwhale wrote: Thu Dec 12, 2024 5:04 pm I have read the stock BMS with a elm327 and a smartphone app, but the Arduino i have crudely patched into the hardware disables the onboard micro.
It should be easy to read the battery voltages and temp through the one of the CAN ports on there, i think there are two channels. Try looking for a pinout, you just need 12v, GND and IGN, and of course the can connection, if my memory serves me well.
That was my opinion as well, to easy read the CAN-port. But no such luck..
wprzybyla
Posts: 1
Joined: Wed Dec 18, 2024 11:58 am

Re: Kia Niro BMS

Post by wprzybyla »

maciek16c wrote: Sun Oct 08, 2023 9:09 am I think it should be possible to use stock BMS. Looks like a lot of CAN messages are the same or similar between different Hyundai / Kia models and i have Hyundai Santa-Fe PHEV battery working using Savvycan script or zombieverter (there are still some obd-2 errors, but probably not critical)
Will the Zombieverter be compatible with a battery from a Kia Ceed PHEV (96 cells, 8.9 kWh)?
Post Reply