Doing the can-can-CANbus

[2020-07-19]

With the motor running and the rain falling yesterday, I put some time into the electronics that will run the car, beyond the inverter. I stripped out the existing ECU (what BMW calls a DME) from its neat little hidey-hole up against the driver’s side bulkhead in the engine bay. It sits in one of a pair of slots under a water-proof cover and I figure I may as well re-use this arrangement.

My plan is to re-use as much of the existing loom as makes sense, so I’m aiming to get hold of a knackered DME that I can cannibalise for its connectors. These will then slot into a 3D-printed case that itself will slide into one of the slots.

Inside this case, my current plan is to use a Mega 2560 Pro microcontroller. I came across these thanks to Les Pounder’s blog. They run a 16MHz ATMEGA 2560 chip, the same as an Arduino Mega, but have 70 i/o pins in a nice small form factor and all of them are easily accessible. This will give me loads of scope for control of relays and both digital and analogue inputs – for example, for the RFID-based immobiliser that I’m thinking of adding to replace the one that is built into the engine management system that I will be selling.

Connected to the microcontroller will be a relay board, an MCP2515 CANbus interface, and maybe a serial interface for the BM’s old K-line diagnostics (though that may not add much value – we shall see)

I am not sure how many relays I will need yet but I have space for a 16-way board. Probably overkill but nice to have the capacity. I did think about routing the 5V signals from the inverter that control the pre-charge relays and contactors over to this position and then routing them back again to the high voltage junction box. But I really want to keep any 5V signal wires as short as possible, however well shielded they may be. So I have returned to my original plan of having a 4-way relay board in a small box connected directly to the inverter, right next to the AMPSeal connector. This is on its second design revision at the moment. Based on the layout currently in my head (all of which depends on how the motor and batteries fit in – i.e. TBD), there will then be just a short hop from this box to the HV junction box where the contactors and relays sit.

The CANbus interface is what will allow me to pull data from the inverter and charger and feed it to the dashboard or other places. It should also allow me to control and monitor the ABS and Active Stability Control system (ASC). I’m completely new to CANbus apart from a few experiments earlier in the project, but with some help from the forum, am now happily gathering messages from the inverter and starting to translate and store them in a form that I should then be able to relay back out to the dash – e.g. recreating the signal that drives the oil temperature sensor with data from the motor or inverter.

BMW DME wiring in situ
BMW DME in its mounting tray
Mega 2560 Pro connected to MCP2515 Canbus adaptor
16-way relay board

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.