BMW S-Box Phev (SafeyBox 9846612)
BMW S-Box Phev (SafeyBox 9846612)
I have a S-Box on my desk bought from a Breakers. Trying to play with it but I don't currently have a high Voltage Battery.
I tried the code from Damiens Github, that the Wiki links to, but this code fails to compile since crc.h is and I assume crc.c is not included in the repo. ( I am also using a ESP32 not a Due)
Fine, So I go to STM32VCU, grab the lookup table and modify away. ( I also found a CRC8 Maxim routine that appears to spit out the correct answers, especially as compared to some online CRC Calculators.)
So, I hook up the Battery+ and + terminals to 12V, and the Data Connector 12V , GND CANH CANL.
The box spits out can messages matching 12V battery, but none of the contactors will close. No this is either my CRC being wrong or perhaps the Voltage is too low. At this stage I have no way to get a higher voltage.
Does anyone know if the S-BOX has a min cut-off voltage at which point it refuses to switch?
Is it possible to test the S-BOX using just the Data Connector (PWR and CAN signals)? Any one with info to assist would be great.
Terminal Output of Sbox data
****************************
Battery Current: -1.00mA
Battery Voltage: 13.20V
Output Voltage: 0.32V
**************************
(PSU is Set to 13.2V
I tried the code from Damiens Github, that the Wiki links to, but this code fails to compile since crc.h is and I assume crc.c is not included in the repo. ( I am also using a ESP32 not a Due)
Fine, So I go to STM32VCU, grab the lookup table and modify away. ( I also found a CRC8 Maxim routine that appears to spit out the correct answers, especially as compared to some online CRC Calculators.)
So, I hook up the Battery+ and + terminals to 12V, and the Data Connector 12V , GND CANH CANL.
The box spits out can messages matching 12V battery, but none of the contactors will close. No this is either my CRC being wrong or perhaps the Voltage is too low. At this stage I have no way to get a higher voltage.
Does anyone know if the S-BOX has a min cut-off voltage at which point it refuses to switch?
Is it possible to test the S-BOX using just the Data Connector (PWR and CAN signals)? Any one with info to assist would be great.
Terminal Output of Sbox data
****************************
Battery Current: -1.00mA
Battery Voltage: 13.20V
Output Voltage: 0.32V
**************************
(PSU is Set to 13.2V
Re: BMW S-Box Phev (SafeyBox 9846612)
Solved.
There is no, Voltage cutoff. My CAN routine was sending garbage... Whoops. Clicking away nicely now.
There is no, Voltage cutoff. My CAN routine was sending garbage... Whoops. Clicking away nicely now.
-
- Posts: 48
- Joined: Fri Jul 26, 2019 8:06 pm
- Location: Bahrain
- Has thanked: 196 times
- Been thanked: 9 times
Re: BMW S-Box Phev (SafeyBox 9846612)
Hello, do you mind sharing the ESP32 code that you are using? I have the Sbox around and would like to test it as well
Zombieverter
Outlander rear motor & Inverter
Pajero 1990
Outlander rear motor & Inverter
Pajero 1990
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
so I took a stab at this myself, both using an Arduino Due with a CAN Bus transceiver and also the Lexus GS450h ver 2 VCU (pre ZombieVerter hardware)
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
I could really use your help, I have noticed the S-Box intermittently reporting some quirky things, for example with it just powered on, (both contactors still opened) it sometimes shows volts as high as 16,777.20V
now I have been informed that's because it is a signed value in an unsigned int, but aside from GOOGLing that one can hold negative numbers and the other one can't I'm more confused than a blind goat on astroturf and could greatly benefit from your tutelage and really just wanna know how to fix it, ha ha
now I have been informed that's because it is a signed value in an unsigned int, but aside from GOOGLing that one can hold negative numbers and the other one can't I'm more confused than a blind goat on astroturf and could greatly benefit from your tutelage and really just wanna know how to fix it, ha ha
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
- EV_Builder
- Posts: 1205
- Joined: Tue Apr 28, 2020 3:50 pm
- Location: The Netherlands
- Has thanked: 18 times
- Been thanked: 37 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
Can you post a piece of code of that variabele? And especially where it's written too?
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
see http://www.wdrautomatisering.nl for bespoke BMS modules.
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
thank you for taking interest, and offering to help, the variable appears to be called: OutputVoltage and is mentioned three times in the codeEV_Builder wrote: ↑Sun Jul 30, 2023 7:38 am Can you post a piece of code of that variabele? And especially where it's written too?
first it is defined like so in what I would call the Global Definitions Section
float OutputVoltage=0;
later on it appears in the void CheckRecCan()
else if(inFrame.id ==0x220)
{
OutputVoltage=((inFrame.data.bytes[2]<<16)| (inFrame.data.bytes[1]<<8)| (inFrame.data.bytes[0]))*0.001;
}
and lastly in the void ShowRecData()
SerialDEBUG.print("Output Voltage: ");
SerialDEBUG.print(OutputVoltage);
SerialDEBUG.println("V");
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
- EV_Builder
- Posts: 1205
- Joined: Tue Apr 28, 2020 3:50 pm
- Location: The Netherlands
- Has thanked: 18 times
- Been thanked: 37 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
A float is quite flexible I think something else is going on....
Normally a float is 4 bytes; in the code i only see 3 being Processed.
I think you should try adding the 4th and maybe the value is just below zero sometimes....
To test you add byte nr [3] and you shift left (<<24).
If you need more help just post. The assignment is the place to check.
Normally a float is 4 bytes; in the code i only see 3 being Processed.
I think you should try adding the 4th and maybe the value is just below zero sometimes....
To test you add byte nr [3] and you shift left (<<24).
If you need more help just post. The assignment is the place to check.
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
see http://www.wdrautomatisering.nl for bespoke BMS modules.
-
- Posts: 261
- Joined: Sun Feb 20, 2022 4:23 am
- Location: N. Wiltshire. UK
- Has thanked: 22 times
- Been thanked: 130 times
Re: BMW S-Box Phev (SafeyBox 9846612)
Zombieverter code uses int32_t for Voltage and sign extends from 24 bit value to 32 bit.
Voltage=((bytes[2] << 16) | (bytes[1] << 8) | (bytes[0]));
Voltage = (Voltage<<8) >> 8; // sign extend
you could then convert to float with the multiplication by 0.001
Voltage=((bytes[2] << 16) | (bytes[1] << 8) | (bytes[0]));
Voltage = (Voltage<<8) >> 8; // sign extend
you could then convert to float with the multiplication by 0.001
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
I'm sorry this is Greek to me, if you could actually modify the code I posted above with this change I would really appreciate itEV_Builder wrote: ↑Sun Jul 30, 2023 5:09 pm A float is quite flexible I think something else is going on....
Normally a float is 4 bytes; in the code i only see 3 being Processed.
I think you should try adding the 4th and maybe the value is just below zero sometimes....
To test you add byte nr [3] and you shift left (<<24).
If you need more help just post. The assignment is the place to check.
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
thank you, however I am not sure if you left off the assignment part in your example cause I am a total newb and you are assuming I know how to assign a int32_t, lol
as far as the two lines of code you provided, then the top line is essentially the same to the code I have, the second line is what I will add to my code to extend from 24 bit value to 32 bit
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
-
- Posts: 261
- Joined: Sun Feb 20, 2022 4:23 am
- Location: N. Wiltshire. UK
- Has thanked: 22 times
- Been thanked: 130 times
Re: BMW S-Box Phev (SafeyBox 9846612)
Zombieverter declares Voltage in the header file so you will need to declare in your code, int32_t Voltage.
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
with a big help from a friend, I think we got it working, using your advice, thank you so much, here is the code:
int32_t ov;
ov=((inFrame.data.bytes[2]<<16)| (inFrame.data.bytes[1]<<8)| (inFrame.data.bytes[0]));
ov = (ov<<8) >> 8; // sign extend
OutputVoltage = (float)ov * 0.001;
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
Re: BMW S-Box Phev (SafeyBox 9846612)
Does anyone know if the ZombieVerter VCU can use the BMW S-Box to replace the IVT Shunt yet?
The SBOX is nice and compact solution for Precharge and Contactors and they cost less than the IVT Shunt.
I am in the gathering parts phase now.
Thanks
The SBOX is nice and compact solution for Precharge and Contactors and they cost less than the IVT Shunt.
I am in the gathering parts phase now.
Thanks
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
just wanted to share some symptoms of a bad BMW 530e Safety Box 15 OHM resistor
Good Resistor Reading: 15 ohms
Bad Resistor Reading: 1 million ohms
Good Resistor Reading: 15 ohms
Bad Resistor Reading: 1 million ohms
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
-
- Posts: 638
- Joined: Sat Jun 06, 2020 6:54 pm
- Location: UK/EU
- Has thanked: 35 times
- Been thanked: 32 times
Re: BMW S-Box Phev (SafeyBox 9846612)
Anybody knows what Amps are the contactors/fuse rated for in an S Box? Some sources seem to suggest 120A which is rather low. In that case what would be the amp range that the internal current sensor could measure?
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
the fuse is 350A, the resistor is 15 OHMs, maybe the Panasonic contactor part number AEV14012 below will help you find the specs
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
those of you who follow The Greg's 1971 GMCe Lexus GS450H BMW 530e Tesla Model S powered Electruck [FIRST DRIVE] build, know that his latest past time is welding these Panasonic contactors found in the BMW Safety Box
so he decided to take one for the team and went out and purchased an extra one on eBay for $12 bucks, same AEV14012 part number but... (yes knowingly he bought one the wrong size, aka "shorty")
so does anybody know what the M25 vs M19 designation refers to?
so he decided to take one for the team and went out and purchased an extra one on eBay for $12 bucks, same AEV14012 part number but... (yes knowingly he bought one the wrong size, aka "shorty")
so does anybody know what the M25 vs M19 designation refers to?
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
Re: BMW S-Box Phev (SafeyBox 9846612)
Look an awful lot like the Prius ones in using for the chademo![Image]()
-
- Posts: 48
- Joined: Fri Jul 26, 2019 8:06 pm
- Location: Bahrain
- Has thanked: 196 times
- Been thanked: 9 times
Re: BMW S-Box Phev (SafeyBox 9846612)
I read somewhere (I can't seems to find it) that the number refers to the model and the physical layout, but technically they are identical
Zombieverter
Outlander rear motor & Inverter
Pajero 1990
Outlander rear motor & Inverter
Pajero 1990
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
I would love to hear from people who are running this Safety Box with Damien's code from his GitHub, does the Current reading work for you while driving the vehicle? Mine does not, not in the Serial Monitor on my laptop and not on my Nextion display.
here is a pic of a really dumbed down Nextion display showing three things:
1. Current in Amps from the Safety Box (this never changes)
2. Output Voltage from the Safety Box
3. Temperature from the Inverter
in the Arduino sketch in the void Loop() I have to write this to the Nextion display every 2 seconds or else my Inverter does not work if I just let the loop run every second by default
here is a pic of a really dumbed down Nextion display showing three things:
1. Current in Amps from the Safety Box (this never changes)
2. Output Voltage from the Safety Box
3. Temperature from the Inverter
in the Arduino sketch in the void Loop() I have to write this to the Nextion display every 2 seconds or else my Inverter does not work if I just let the loop run every second by default
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
-
- Posts: 261
- Joined: Sun Feb 20, 2022 4:23 am
- Location: N. Wiltshire. UK
- Has thanked: 22 times
- Been thanked: 130 times
Re: BMW S-Box Phev (SafeyBox 9846612)
I think the calculation is wrong, should be like below ( calculation taken from Zombieverter code ).
BattCurrent is int32_t with current in mA, you may want to convert to amps and float in a similar way to the voltage
BattCurrent=((inFrame.data.bytes[2]<<16)| (inFrame.data.bytes[1]<<8)| (inFrame.data.bytes[0]));
BattCurrent = (BattCurrent<<8) >> 8;//sign extend
If you change the baud rate of the Nextion display you maybe able to update more often. Instructions here. https://forum.arduino.cc/t/nextion-baud ... e/560081/2
BattCurrent is int32_t with current in mA, you may want to convert to amps and float in a similar way to the voltage
BattCurrent=((inFrame.data.bytes[2]<<16)| (inFrame.data.bytes[1]<<8)| (inFrame.data.bytes[0]));
BattCurrent = (BattCurrent<<8) >> 8;//sign extend
If you change the baud rate of the Nextion display you maybe able to update more often. Instructions here. https://forum.arduino.cc/t/nextion-baud ... e/560081/2
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
thank you that did it, here is my actual code:royhen99 wrote: ↑Wed Sep 13, 2023 6:35 am I think the calculation is wrong, should be like below ( calculation taken from Zombieverter code ).
BattCurrent is int32_t with current in mA, you may want to convert to amps and float in a similar way to the voltage
BattCurrent=((inFrame.data.bytes[2]<<16)| (inFrame.data.bytes[1]<<8)| (inFrame.data.bytes[0]));
BattCurrent = (BattCurrent<<8) >> 8;//sign extend
If you change the baud rate of the Nextion display you maybe able to update more often. Instructions here. https://forum.arduino.cc/t/nextion-baud ... e/560081/2
if (inFrame.id == 0x200) {
int32_t bc;
bc= ((inFrame.data.bytes[2] << 16) | (inFrame.data.bytes[1] << 8)| (inFrame.data.bytes[0]));
bc = (bc<<8) >> 8;//sign extend
BattCurrent = (float)bc * 0.001;
}
Why are the numbers negative?
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg
-
- Posts: 261
- Joined: Sun Feb 20, 2022 4:23 am
- Location: N. Wiltshire. UK
- Has thanked: 22 times
- Been thanked: 130 times
Re: BMW S-Box Phev (SafeyBox 9846612)
I assume it's just the convention that BMW has chosen, ( +ve = charge, -ve = discharge ). Easy enough to add a "-" somewhere so it displays as positive.
- Gregski
- Posts: 2685
- Joined: Tue Sep 14, 2021 10:28 am
- Location: Sacramento, California
- Has thanked: 493 times
- Been thanked: 909 times
- Contact:
Re: BMW S-Box Phev (SafeyBox 9846612)
gotcha, fixed it with the abs Arduino function, once again a huge thanks for your help
"I don't need to understand how it works, I just need to understand how to make it work!" ~ EV Greg