Kia Niro BMS
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
Re: Kia Niro BMS
Success! i can see the voltages on some cells but then it seems to crash soon after.
There is a cell reading zero in the middle so i assume that as this is also sometimes used as a 72 cell bms in other models the one they didnt use was the middle cell?
good to see some data starting to come through
Attached log
Edit: got the crashing under control, was a just a hardware issue with the int pin, seems to read consistently and updates.
There is a cell reading zero in the middle so i assume that as this is also sometimes used as a 72 cell bms in other models the one they didnt use was the middle cell?
good to see some data starting to come through
Attached log
Edit: got the crashing under control, was a just a hardware issue with the int pin, seems to read consistently and updates.
- Attachments
-
- error.txt
- (3.97 KiB) Downloaded 269 times
- 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
I think the cells are connected in the same manner as the PHEV-bms, i.e. pos 1-4 and 6-9 and not pos 1-8 for each chip.
That means you need to roll back some of the early changes.
That means you need to roll back some of the early changes.
Re: Kia Niro BMS
Hey guys,
I am having a storage pack with Peugeot modules that also use MAX 17841
viewtopic.php?p=62076#p62076
Are you using Arduino Nano or ESP 32 for controller?
I have an Arduino working but I have problem moving to ESP32. My problem with Arduino is that the RAM memory is full and I don’t have space for development.
I am having a storage pack with Peugeot modules that also use MAX 17841
viewtopic.php?p=62076#p62076
Are you using Arduino Nano or ESP 32 for controller?
I have an Arduino working but I have problem moving to ESP32. My problem with Arduino is that the RAM memory is full and I don’t have space for development.
- 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
I'm using Arduino or more specifik Atmega328P on an home made board but should work on most arduinos.usus wrote: ↑Mon Oct 30, 2023 8:17 am Hey guys,
I am having a storage pack with Peugeot modules that also use MAX 17841
viewtopic.php?p=62076#p62076
Are you using Arduino Nano or ESP 32 for controller?
I have an Arduino working but I have problem moving to ESP32. My problem with Arduino is that the RAM memory is full and I don’t have space for development.
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
Re: Kia Niro BMS
I editied this part back to original as this seems to be the part that reads the data into the memory?
void readData()
{
for(int i=0; i<4; i++)
{
readAllSlaves((0x20 + i), true); // Read CELL 1-4 of all slaves
}
for(int i=0; i<4; i++)
{
readAllSlaves((0x25 + i), true); // Read CELL 5-8 of all slaves"
It had no effect, the zero was still in the middle, i tried changing the numbers in the "Stores measured cell voltage data in cellVoltage array" and set cell voltage register to 0x29 but got back to the errobyte 1 condition.
void readData()
{
for(int i=0; i<4; i++)
{
readAllSlaves((0x20 + i), true); // Read CELL 1-4 of all slaves
}
for(int i=0; i<4; i++)
{
readAllSlaves((0x25 + i), true); // Read CELL 5-8 of all slaves"
It had no effect, the zero was still in the middle, i tried changing the numbers in the "Stores measured cell voltage data in cellVoltage array" and set cell voltage register to 0x29 but got back to the errobyte 1 condition.
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
Re: Kia Niro BMS
Nearly, something odd happening with the last cell like its been cut short, is the one on the far right die temperature?
0 0 0 21
1: 3682 3684 3685 3685 3685 3683 3684 7 20
2: 3684 3684 3685 3684 3683 3685 3683 16 21
3: 3685 3684 3685 3685 3684 3684 3684 3 21
4: 3684 3685 3685 3685 3685 3685 3683 2 21
5: 3684 3684 3684 3684 3684 3684 3683 32 20
6: 3684 3684 3684 3684 3684 3685 3684 1 21
7: 3684 3684 3684 3684 3684 3683 3684 8 21
8: 3685 3684 3685 3685 3684 3685 3684 3 21
0 0 0 0 0 0 0 0
206.3 -22.4 22.9 F 1
3 3685 32 2
0 0 0 21
0 0 0 21
1: 3682 3684 3685 3685 3685 3683 3684 7 20
2: 3684 3684 3685 3684 3683 3685 3683 16 21
3: 3685 3684 3685 3685 3684 3684 3684 3 21
4: 3684 3685 3685 3685 3685 3685 3683 2 21
5: 3684 3684 3684 3684 3684 3684 3683 32 20
6: 3684 3684 3684 3684 3684 3685 3684 1 21
7: 3684 3684 3684 3684 3684 3683 3684 8 21
8: 3685 3684 3685 3685 3684 3685 3684 3 21
0 0 0 0 0 0 0 0
206.3 -22.4 22.9 F 1
3 3685 32 2
0 0 0 21
- 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
Yes, the die temp is on the far right.
Don't know at the moment what is going on with the 8th cell. Will have to wait until tomorrow to look into it further.
Don't know at the moment what is going on with the 8th cell. Will have to wait until tomorrow to look into it further.
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
- 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
I can't find anything obviuos at the moment so I have turned on the print out of all received data from readAllSlaves. Please run this and post the print outs. Will be a lot of data...
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
- 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
This is a bit strange and I suspect some hardware issue.
Have you checked the cell connections (wiring) for cell no 8 for all modules (max17823)?
Please also verify with a multimeter that the cell voltages are infact close to 3,68V / cell, for those no 8 cells?
Have you checked the cell connections (wiring) for cell no 8 for all modules (max17823)?
Please also verify with a multimeter that the cell voltages are infact close to 3,68V / cell, for those no 8 cells?
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
Re: Kia Niro BMS
I tested the BMS using Torque and an ELM Bluetooth adaptor before i began and it showed all cells and they were all 3.6 range,
I just checked the individual cells on the input connector with a meter and they all seem fine end each module is outputting 58v on the bus bar.
If it was a fault in the CMU would that not be one whole horizontal row not the end cut of each one?
Could it be that the top cell is being read by something higher than 9? it does have 12 channels on each chip
The only thing i don't have per your schematic is the SHDN pin connected to the atmega and is just pulled high.
I just checked the individual cells on the input connector with a meter and they all seem fine end each module is outputting 58v on the bus bar.
If it was a fault in the CMU would that not be one whole horizontal row not the end cut of each one?
Could it be that the top cell is being read by something higher than 9? it does have 12 channels on each chip
The only thing i don't have per your schematic is the SHDN pin connected to the atmega and is just pulled high.
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
Re: Kia Niro BMS
I just realised what you said, It has 8X max17845 chips onboard.bexander wrote: ↑Tue Oct 31, 2023 3:19 pm This is a bit strange and I suspect some hardware issue.
Have you checked the cell connections (wiring) for cell no 8 for all modules (max17823)?
Please also verify with a multimeter that the cell voltages are infact close to 3,68V / cell, for those no 8 cells?
I will also see what pins connect to each battery on the chip then we will know if its 1-4 5-9 etc.
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
Re: Kia Niro BMS
I checked which cells connected to which pins on the chip, C0 is ground then all the way to C8 in sequence just like the 17845 datasheet.
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
Re: Kia Niro BMS
That was the same as before so i went looking to find where the measurement was failing, after pouring over the datasheet I set mesureeen to 0x11FF and i got this:
1: 3682 3683 3684 3684 3684 3684 3682 3684 20
2: 3684 3683 3685 3684 3683 3682 3685 3683 20
3: 3684 3684 3684 3684 3684 3683 3684 3684 21
4: 3683 3685 3684 3684 3684 3684 3685 3682 21
5: 3683 3683 3683 3683 3683 3684 3684 3683 20
6: 3684 3684 3684 3684 3684 3684 3684 3683 21
7: 3684 3684 3683 3683 3682 3684 3683 3684 21
8: 3684 3683 3684 3684 3684 3684 3685 3683 21
If you could go over the code and check what i have done to see if i haven't just messed things up and it was just
writeAllSlaves(0x12, 0x11fF, true); // Set MEASUREEN, Enable cell voltages 1-4, 6-9 and AUX1 that was stopping us reading the last cell.
1: 3682 3683 3684 3684 3684 3684 3682 3684 20
2: 3684 3683 3685 3684 3683 3682 3685 3683 20
3: 3684 3684 3684 3684 3684 3683 3684 3684 21
4: 3683 3685 3684 3684 3684 3684 3685 3682 21
5: 3683 3683 3683 3683 3683 3684 3684 3683 20
6: 3684 3684 3684 3684 3684 3684 3684 3683 21
7: 3684 3684 3683 3683 3682 3684 3683 3684 21
8: 3684 3683 3684 3684 3684 3684 3685 3683 21
If you could go over the code and check what i have done to see if i haven't just messed things up and it was just
writeAllSlaves(0x12, 0x11fF, true); // Set MEASUREEN, Enable cell voltages 1-4, 6-9 and AUX1 that was stopping us reading the last cell.
- 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
Yes, that is also what I discovered and changed in the last SW I posted but with all chanels enabled.bigmotherwhale wrote: ↑Thu Nov 02, 2023 2:36 pm That was the same as before so i went looking to find where the measurement was failing, after pouring over the datasheet I set mesureeen to 0x11FF and i got this:
1: 3682 3683 3684 3684 3684 3684 3682 3684 20
2: 3684 3683 3685 3684 3683 3682 3685 3683 20
3: 3684 3684 3684 3684 3684 3683 3684 3684 21
4: 3683 3685 3684 3684 3684 3684 3685 3682 21
5: 3683 3683 3683 3683 3683 3684 3684 3683 20
6: 3684 3684 3684 3684 3684 3684 3684 3683 21
7: 3684 3684 3683 3683 3682 3684 3683 3684 21
8: 3684 3683 3684 3684 3684 3684 3685 3683 21
If you could go over the code and check what i have done to see if i haven't just messed things up and it was just
writeAllSlaves(0x12, 0x11fF, true); // Set MEASUREEN, Enable cell voltages 1-4, 6-9 and AUX1 that was stopping us reading the last cell.
I would suggest:
writeAllSlaves(0x12, 0x00FF, true); // Set MEASUREEN, Enable cell voltages 1-8
and
writeAllSlaves(0x1E, 0x0008, true); // Set TOPCELL, Top cell for measurement is 8
Turning of aux1 (you stated previously you don't have any external temperature sensors, correct?)
Also turning of cell9 as it is not used, to avoid it to falsely trigger fault bits, as per maxim recommendations.
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
Re: Kia Niro BMS
"writeAllSlaves(0x1E, 0x0008, true); // Set TOPCELL, Top cell for measurement is 8"
Yes i also changed this already to get it working.
I dont have any temp sensors, will have a look at disabling them. how do i change the bits D12 and D13 in the mesureen value? I dont understand how to do this.
How would i turn off cell 9? wont the topcell number do this?
Thanks for getting this up and running, most appreciated.
Can i also ask are you using contactors with built in economizers? as it seems that there is no PWM for the output of the contactor, im not entirely sure whether my contactors need this or not TBH.
Yes i also changed this already to get it working.
I dont have any temp sensors, will have a look at disabling them. how do i change the bits D12 and D13 in the mesureen value? I dont understand how to do this.
How would i turn off cell 9? wont the topcell number do this?
Thanks for getting this up and running, most appreciated.
Can i also ask are you using contactors with built in economizers? as it seems that there is no PWM for the output of the contactor, im not entirely sure whether my contactors need this or not TBH.
- 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
Looking at register 0x12 (MEASUREEN). If you want to set just bit D12, that corresponds to 0x1000 or translated to binary 0b 0001 0000 0000 0000. Every digit in hex coresponds to 4 bits in binary. D0 is the first digit, right most digit. D15 is the left most digit.
If you want to set cell 1-8 enabled and then also enabled D12 and D13, in binary 0b 0011 0000 1111 1111, in hex 0x30FF. Using the "calculator" (in windows or linux) in programming mode let's you visualize this in a good way and also translate from binary to hex or decimal for that matter.
I suggested 0x00FF, or 0b 0000 0000 1111 1111, to enabled cell 1-8 with everyting else (temp sensors) disabled.
Correct, my contactors don't need economizing so only on or off.
If you want to set cell 1-8 enabled and then also enabled D12 and D13, in binary 0b 0011 0000 1111 1111, in hex 0x30FF. Using the "calculator" (in windows or linux) in programming mode let's you visualize this in a good way and also translate from binary to hex or decimal for that matter.
I suggested 0x00FF, or 0b 0000 0000 1111 1111, to enabled cell 1-8 with everyting else (temp sensors) disabled.
Correct, my contactors don't need economizing so only on or off.
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
Re: Kia Niro BMS
Thankyou for the clear explanation and help getting this up and running.
I hopefully should be able to handle the coding for the additional contactor and economizer control myself.
There are some thermistors in the pack in a couple of places handled directly by the micro on the BMS, im not sure how im going to implement monitoring them yet. The inverter im trying to hack already has a voltage monitor via CAN and there is an isolated 0-5v refence on the board so I have some options there.
I hopefully should be able to handle the coding for the additional contactor and economizer control myself.
There are some thermistors in the pack in a couple of places handled directly by the micro on the BMS, im not sure how im going to implement monitoring them yet. The inverter im trying to hack already has a voltage monitor via CAN and there is an isolated 0-5v refence on the board so I have some options there.
- 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
First of all great work on this code!
Very happy I can reuse the bms slave modules
I have a complete e208 pack. So i needed to change the code.
The e208 pack consists of 18 modules with 6 cells each.
Got the original code and the latest code posted. I used notepad++ to make a diff. To be able to find all the changes made.
To make the code less hard coded I adding a couple of variables
Not sure that i got all the hard coded bits.
The split in cell layout in the original code is hard to code for, so I removed it
Also made a board to fit in a waterproof housing
The DC DC converter and attiny are missing but on their way.
Very happy I can reuse the bms slave modules
I have a complete e208 pack. So i needed to change the code.
The e208 pack consists of 18 modules with 6 cells each.
Got the original code and the latest code posted. I used notepad++ to make a diff. To be able to find all the changes made.
To make the code less hard coded I adding a couple of variables
- numberOfModules
- numberOfCellsPerModule
- Message_length
Not sure that i got all the hard coded bits.
The split in cell layout in the original code is hard to code for, so I removed it
Also made a board to fit in a waterproof housing
The DC DC converter and attiny are missing but on their way.
- Attachments
-
- BMS2_7_4.ino
- (50.27 KiB) Downloaded 246 times
-
- Posts: 111
- Joined: Tue Sep 22, 2020 6:48 pm
- Has thanked: 15 times
- Been thanked: 22 times
Re: Kia Niro BMS
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.
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.