2004 BMW M3 Hybrid (Was: 2 BMW E46 Projects)

Tell us about the project you do with the open inverter
Post Reply
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

2004 BMW M3 Hybrid (Was: 2 BMW E46 Projects)

Post by mdrobnak »

I must say I've been really inspired by things on this forum, and have some ideas for upcoming (6 - 12 months from now-ish) conversions.

I have 2 vehicles - a 2004 BMW 330i sedan, with the SMG / SSG gearbox in it. The naming is funny because it depends on where in the world you are. :) It was marketed as the Sequential Manual Gearbox in the US, and Sequential Sport Gearbox...everywhere else. I also have a 2004 BMW M3 Coupe, with..the SMG gearbox. Except this time, it's the Sequential "M" Gearbox. Similar concepts, completely different execution.

Both cars have a standard manual gearbox fitted, plus some extra hydraulics and actuators in order to electro-mechanically control the H pattern movement and clutch engagement.

I plan on keeping the SSG gearbox on the 330. I'm about 75% of the way there on controlling the gearbox successfully. I write software for an aftermarket Engine Control Unit (ECU) manufacturer known as Motec. They have an SDK for their M1 series of ECUs that allows you to do vehicle integration, and that's what I've mostly done.

Plan for this vehicle is to fit a Nissan Leaf inverter and motor. Control via stock CAN at least initially. The challenge here that I see is keeping the clutch. There's a clutch position sensor in the SSG transmission that would need to be spoofed otherwise if that couldn't be worked out.

Initial thoughts for batteries are either the LG Chem battery packs from EV West, or a Chevy Volt Gen 1 pack. I would target about 360V, and I'd want to bypass anything that could limit power.

Items I'm unclear on:
* BMS - Does the Simpl BMS actively balance cells? If so, then if I went with the Volt pack that's a pretty significant cost savings vs something like the Orion 2 BMS.
* Charger - Not a clue. Volt? Elcon? TSM2500?
* DC/DC - Seems like everything rated for 300V+ isn't cheap.

Phase 2, after everything gets worked out would be to swap the Nissan control for an OpenInverter control board to get ~136kW instead of 80...Or Arlin's Axiom controller perhaps (but that's money money). Another possibility for the initial conversion was getting a cheap Leaf and pulling it apart, but that seemed like a very labor intensive way to go about things, negating any potential savings.

Plan for the M3 is to use the GS450h gearbox with Damien's controller and make it a hybrid. :) Again, similar ideas regarding batteries, BMSes and chargers, but in this case the DC/DC isn't needed as I'm not going to touch anything on the engine side (this keeps it real simple when it comes time for emissions inspection). This one is a little more complicated due to more CAN mucking about, and actual command of engine controls, but should be fairly fun in the end I think. And fast. And quiet when SoC is high enough. Again, using Motec for ease of implementation here.

So I'm really interested in feedback from people on here regarding the items that are still unknowns.

Thanks for any feedback given. :-)

-Matt
RE3Rotor
Posts: 74
Joined: Thu Feb 06, 2020 11:37 pm
Location: Vancouver, Canada

Re: 2 BMW E46 Projects

Post by RE3Rotor »

I was looking for Tesla Model 3 PCS that incorporates a charger + DCDC converter. They have been hovering around $800USD lately. :(

Also there is a Tesla DCDC converter that CAN be had for around $300.
Emyr
Posts: 8
Joined: Thu May 16, 2019 3:13 pm

Re: 2 BMW E46 Projects

Post by Emyr »

mdrobnak wrote: Wed Mar 11, 2020 4:24 amPlan for the M3 is to use the GS450h gearbox with Damien's controller and make it a hybrid. :) Again, similar ideas regarding batteries, BMSes and chargers, but in this case the DC/DC isn't needed as I'm not going to touch anything on the engine side (this keeps it real simple when it comes time for emissions inspection). This one is a little more complicated due to more CAN mucking about, and actual command of engine controls, but should be fairly fun in the end I think. And fast. And quiet when SoC is high enough. Again, using Motec for ease of implementation here.
It's not clear to me what this conversion will actually achieve.

For less effort and money and with more reliability, you could get a complete GS450h and just tune it:
Put it on a diet. Strip out some of the heavy luxuries, like the heated adjustable seats. Fit lightweight alloys and adjustable coilovers.
Flash a tune onto the stock V6. The 2GR-FE factory tunes varies by vehicle with power ranging 295-314hp (220-234kW) at 6200rpm and torque ranging 248-260lbft (336-353 Nm) at 4700 rpm, on relatively poor 87 octane fuel.
Replace the NiMH pack with a Lithium Ion pack and replace the inverter's control board to extend use of both MG1 and MG2.
Bentto
Posts: 27
Joined: Thu Feb 13, 2020 6:55 pm
Location: The Netherlands

Re: 2 BMW E46 Projects

Post by Bentto »

Emyr wrote: Wed Mar 11, 2020 9:49 am
mdrobnak wrote: Wed Mar 11, 2020 4:24 amPlan for the M3 is to use the GS450h gearbox with Damien's controller and make it a hybrid. :) Again, similar ideas regarding batteries, BMSes and chargers, but in this case the DC/DC isn't needed as I'm not going to touch anything on the engine side (this keeps it real simple when it comes time for emissions inspection). This one is a little more complicated due to more CAN mucking about, and actual command of engine controls, but should be fairly fun in the end I think. And fast. And quiet when SoC is high enough. Again, using Motec for ease of implementation here.
It's not clear to me what this conversion will actually achieve.

For less effort and money and with more reliability, you could get a complete GS450h and just tune it:
Put it on a diet. Strip out some of the heavy luxuries, like the heated adjustable seats. Fit lightweight alloys and adjustable coilovers.
Flash a tune onto the stock V6. The 2GR-FE factory tunes varies by vehicle with power ranging 295-314hp (220-234kW) at 6200rpm and torque ranging 248-260lbft (336-353 Nm) at 4700 rpm, on relatively poor 87 octane fuel.
Replace the NiMH pack with a Lithium Ion pack and replace the inverter's control board to extend use of both MG1 and MG2.
Yes, but then you end up with a GS450h and not a sweet sweet E46 M3 ;)

Butchering the M3 doesn't make sense to me either though. I would leave that baby original and focus on one project: going full electric with the 330i.
User avatar
mfox
Posts: 151
Joined: Fri Apr 05, 2019 9:56 pm
Location: Croatia
Been thanked: 5 times

Re: 2 BMW E46 Projects

Post by mfox »

I'm also agree with that .. M3 OEM and 330i full electric :D
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2 BMW E46 Projects

Post by mdrobnak »

RE3Rotor wrote: Wed Mar 11, 2020 5:33 am Also there is a Tesla DCDC converter that CAN be had for around $300.
Nice find, that's not bad!
Emyr wrote: Wed Mar 11, 2020 9:49 am It's not clear to me what this conversion will actually achieve.

For less effort and money and with more reliability, you could get a complete GS450h and just tune it:
How many things do we do in life that make sense? This is more about the challenge.
mfox wrote: Wed Mar 11, 2020 10:08 am I'm also agree with that .. M3 OEM and 330i full electric :D
Well, it's an SMG M3, which people are butchering anyway by converting back to manual when it all goes belly up. The car has almost 118k miles on it, and is in OK shape. It's not a collectors piece. It was the cheapest, minimally-modified car I could find. Original plan was just to sell it cheaply after I was done with the vehicle for development purposes. People seem to get very touchy about the M3. :D I'd rather make it interesting than it get sold to some 18 year old who wants a cheap BMW and wrecks it in a month. But that's me.

Thanks for the idea feedback so far. If anyone has component feedback that'd be awesome.

Looks like Thunderstruck has some interesting batteries available:
https://www.thunderstruck-ev.com/used-l ... dules.html
https://www.thunderstruck-ev.com/used-a ... dules.html

Although aside from those two items, they seem a bit pricey.

-Matt
Bentto
Posts: 27
Joined: Thu Feb 13, 2020 6:55 pm
Location: The Netherlands

Re: 2 BMW E46 Projects

Post by Bentto »

I personally don't realy care about the M3 being butchered or not, there are more than enough of those things. But from an economic standpoint it really doesn't make any sense. E46 M3's are quite valuable compared to all other E46's and butchering it will make it a LOT less valuable, automatically making your conversion a very expense one just by depreciation of the car, even if you would get all parts ridiculously cheap.

So I would sell the M3, use the money to build a heck of conversion from a normal E46 and still end up with less money spend. :D
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2 BMW E46 Projects

Post by mdrobnak »

Chevy Volt battery packs are definitely the way to go + Simp BMS.
Not sure what I'll do with the 330 as I'll probably want to parallel two packs. That could be tricky. (At least according to the Orion BMS docs it is.)

-Matt
User avatar
Jack Bauer
Posts: 3644
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 9 times
Been thanked: 288 times
Contact:

Re: 2 BMW E46 Projects

Post by Jack Bauer »

I have gen1 volt battery and tesla drive unit in my E31 and can get 30 miles of fun driving or 40 miles of normal. And that's only 16kwh. What about a gen 2 volt pack?
I'm going to need a hacksaw
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2 BMW E46 Projects

Post by mdrobnak »

Jack Bauer wrote: Mon Mar 16, 2020 1:19 pm I have gen1 volt battery and tesla drive unit in my E31 and can get 30 miles of fun driving or 40 miles of normal. And that's only 16kwh. What about a gen 2 volt pack?
I thought the Gen 2 BMS was still very unknown, and thus was not looking at them. If we can use the stock BMS or simp bms ...then that's definitely an idea.
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2 BMW E46 Projects

Post by mdrobnak »

330 Progress split to here:
viewtopic.php?f=11&t=714
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW M3 Hybrid (Was: 2 BMW E46 Projects)

Post by mdrobnak »

Time for some insight into the complexities here.

I threw my Motec M150 into the M3 and am sniffing the CAN Bus data (as well as having a Manifold Pressure and Temperature sensor hooked up).

There's a lot of data.

And when comparing side by side what the stock ECU is sending vs what I am, it certainly opened my eyes in some places.

Each screenshot is a particular ID generated by the ECU going back to the gearbox. Sorry, not giving out IDs here, I've been working on this for 2.5 years. And I'm one of two people in the world that I know of that's gotten it even close to working.

With that out of the way...

Some data looks reasonably good:
smg_1.png

However as you can see between the green and pink data 6 items down, my data (green) is not nearly as smooth. This happens to be wheelspeed data, which is at a odd cadence - 7.5 ms on the BMW platform. Everything in the Motec is on a 1/5/10/20/50/100 ms cadence. So I have it polling at 10 ms. Clearly I need to change that to 1ms and allow it to fall out of there 'Have I received anything' block for a majority of the time. Hopefully that doesn't eat up too much CPU.

The other items look reasonable - there's some discontinuity on the first two due to scaling, but that's expected and OK. The counter is right, and looks good.

Moving onward to the next ID:
smg_2.PNG
This is pretty bang-on except for the third graph, the yellow line should look more like the red. Part of that is...vacuum based load measurement on the M3 is awful. Because of the individual throttle bodies, you lose vacuum really fast. So not a lot of resolution there.

There's also some (hopefully) smaller items in there, but the major pieces look reasonable.

The next ID:
smg_3.PNG
More smoothness issues on the first graph.

Various differences in the next few graphs.

With the next purple/green one, there's some discontinuities on the green line that are unexpected, and I'm unsure why.

The red / orange, I seem to be doing some extra stuff (in red).

The bottom line is a checksum type thing, so the differences are what are causing that to be different as well.


The fourth ID:
smg_4_1.png
Here's where things go off the rails a little. Eagle-eyed viewers will note the counter doesn't look quite right.
smg_4_2.png
Yep, messed that one up a bit.

Finally, the fifth ID:
smg_5.png
This is mostly temperatures, and that's all mostly right (except the coolant temp because..it's not hooked up - most of the rest you can get off CAN).

Now, if you think all of these IDs are bad...Here is the table list:
smg_tables.png
smg_tables.png (3.33 KiB) Viewed 5704 times
24 tables. Twenty-four, to find in the ROM, extract, determine how to reformat to fit into the Motec, populate...and ensure things are being accessed correctly. Those tables are what make up only some of the data in the previous graphs. Others is reused from other places.

It looks like Bosch said 'hey we have this thing' and didn't work with BMW on setting up CAN to work for them, so BMW rescaled their data to work for the Bosch stuff.

I also captured this with a high-speed CAN capture, so I can compare if the stair-step issue is _real_, or just a timing problem, similar to the wheel speed data.

The plan is to spend the next week or so diving back into Motorola CPU32 assembly to see where I've got wrong with some of this. Knowing which items are pretty good definitely helps.

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW M3 Hybrid (Was: 2 BMW E46 Projects)

Post by mdrobnak »

Nothing worse than a wild goose chase.
counter_reality.png
It's smooth 0-15, just like my generated counter is.

Ugh. I see what the problem is. I tried to cheat and put 3 IDs in the same script. That does not work. Decidedly not. Try again, Matt.
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW M3 Hybrid (Was: 2 BMW E46 Projects)

Post by mdrobnak »

Since I have an order for this M3 package, I was hoping to reduce time on figuring out what's causing me issues.
So, let's try something a little different.

Commence project MiTM! A man-in-the-middle attack is always fun.
Problem: Current checksum calculation is based upon what I know the input to be.
Example: byte 0 may be Thing A, but byte 1 may be 2 bits of Thing A, 4 bits of Thing B, and a counter. But the checksum might only be on Thing A, and not Thing B.
So I need to calculate it based upon masking and shifting things around when necesary.

First attempt at code modification:
cksum_try1.png
Hmm. 3/4 ain't bad for the first try.

Let's try that again:
cksum_try2.png
There we go. Now I can clear any error codes, modify some wiring (this is all via a pass-through connector, not touching stock stuff), turn on message forwarding from the stock DME(ECU) to the transmission via the Motec, make sure all is good.
Then go ID by ID, and byte by byte, changing things, until the transmission complains "CAN Bus Data Error". Yes, that's all it gives you.
Hopefully I can at least narrow it down to the ID, and also figure out if it's a running vehicle vs startup issue. (There's lots of "Engine Running" conditionals in the stock code that I may have missed one or two).

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW M3 Hybrid (Was: 2 BMW E46 Projects)

Post by mdrobnak »

So, uh, this happened:


Turns out all I had to do was backport my changes to try and recreate the code for existing data and try to get it to match. Once I did that, I was fairly confident that I had fixed this particular problem.

And so, I did! As far as I am aware, this is the first publicly announced implementation of SMG Gearbox control for the BMW M3 on the E46 platform.

That all said, it is a little rough, clearly. Something is not quite right, and I need to look really hard at whats going on to try and fix the limiting during gear transition. All of that took a back seat to trying to get the darn light to go away.

CAN Data Error indeed.

PS You get to see what I look like now too haha
User avatar
Jack Bauer
Posts: 3644
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 9 times
Been thanked: 288 times
Contact:

Re: 2004 BMW M3 Hybrid (Was: 2 BMW E46 Projects)

Post by Jack Bauer »

Very nice:) My pal Dave wants to do an E30 smg build.
I'm going to need a hacksaw
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW M3 Hybrid (Was: 2 BMW E46 Projects)

Post by mdrobnak »

:) Yeah that should be possible now...Although I think the GS450h gearbox will end up being more reliable. :D

Here's the state of the package which is what will be available for sale:


Starts reasonably well, shifts pretty well given the amount of tuning I've done on it, and idles nicely. What more do you need? :)

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW M3 Hybrid (Was: 2 BMW E46 Projects)

Post by mdrobnak »

Well, it is emissions test time here, and the car was recently giving me some codes regarding the O2 sensors. I made an appointment and was dropping the car off on Friday, when I realized it was low on gas. So I stopped, filled, and...no restart. Yay!
Finally got it to start after like 8-10 tries, got it to the shop, which was only like 3 blocks away, and it proceeded to die again. They left it over the weekend, tried to reproduce the problem the last few days, and .. can't repro. Of course. Well, at this point it is only missing one test to pass emissions, and that monitor should run the next time I start it up. So I'm going to chalk it up to my instrumentation wiring messing with things, oops.

So once that's done, I will put the wiring back in to tap off the MAF reading as well as CAN, so I can just monitor things. I need to track down the data that isn't quite right yet, trace each function, and see where I went wrong. Basically continue what I was doing before, except I want the data as close to 100% as I can get it.

Items that will need addressing when made a hybrid:
* Power steering - Going to keep the original rack on the M3, so need to fit an electric pump.
* AC - I will leave this as-is, so AC will require the engine, but I will default to an eco mode that'll kill the engine / compressor at a stop.
* Alternator - The stock ECU is going to want to see this, so I'm going to leave this in place.
* DC/DC - Do I run this all the time, or turn it off if the engine is going?

That's all I can think of at the moment.
Post Reply