Jump to content

micro-controller using CAN bus data for ancillary control


2X044
 Share

Recommended Posts

Sharing this semi-complete project now that it is up and running. Before getting into it, I owe thanks to @Lukeyson and @jakka351, they don't know me but I relied heavily on the information they shared and to the team at ForScan it would have been a lot harder/impossible without there work! Beers are on me.

I completed a manual conversion on my BA Mk2 XR6T, for some reason, the PCM would not ground the reverse lockout wire. I understand that the PCM is supposed to ground the pin when the car is travelling less than 7km/h and the clutch is depressed. I read that most people use the brake light circuit to ground the wire but I didn't like this idea.

The data I required is available via the CAN bus so I bought a micro-controller with a native CAN bus interface and put together a prototype board that does the following:

  • Listens on the CAN bus for the vehicle speed.
  • When the vehicle speed is below 5km/h, once per second, sends a query to the PCM asking the status of the clutch pedal.
  • When the vehicle speed and clutch status are correct, pulls the reverse lockout wire to ground using a MOSFET (and turn on an LED to show me it's working).

Here is the proto-board:

BA_uC_proto_resize.jpg.d7ad4dbe9a782f388e727f8839e7837f.jpg

Here it is hidden in the console with all the wires coming in the back:

BA_uC_InCar_Resize.jpg.16d7a4567d6d060a5b508a3a9692fd17.jpg

Now that it is all working, my mind is running on all the possibilities having a programmable micro-controller hooked into the cars CAN-bus with a bunch of analog and digital ins/outs so I am currently designing a PCB that breaks out a lot more of the micro-controllers pins. My design brings out the following:

  • 3x digital outputs via MOSFETs that will ground up to 2A each
  • 1x 0-12V analog output (op-amp)
  • 1x 0-10k variable resistance (to ground)
  • 5x analog inputs (with voltage dividers so that it is 12V tolerant).

BA_uC_pcb.jpg.eb95b3de1f370519902b43dc166ad311.jpg

More inputs/outputs are possible in the future but I would change to surface-mount components.

My ideas on things that I can do with it are:

  • Progressive shift-light using a string of 8xWS2812 LEDs
  • Slow down the fuel-pump via PWM and a solid state relay when off-boost
  • Spoof the F6 oil pressure sensor signal to the PCM (don't think this one is needed with PCMtec)
  • Factor style PID boost control (for the NA + T crowd)
  • Yaw control using the input from an IMU (needs a lot more thought and big cajones while tuning)

I'll post up code and designs on github shortly and update this with a link then.

I hope this inspires someone, I will try to answer any questions however this isn't a beginners project.

Edited by 2X044
typo
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

My wish list

Cheap closed loop boost control. This puts and end to the shortage of turbo PCMs. 

Intercept the oil temp and pull it high eg 255c on failure modes like low fuel pressure or other conditions that rely on external sensors not present on the factory pcm. 

You could wire in low oil/fuel pressure analog inputs with pre configured ranges for sensors you include in the kit. 

Lean out detection via wideband when load > 1.5 etc 

Make it all configurable easily via simple dials, no usb, no laptop. Super simple. Sell the full kit, fittings, loom that is the right length for each model, make everything truely plug and play. 

Package it up with IP rated case, obtain power from an existing plug (eg the oil/cht temp sender) then a sandwitch plate for obd/can and make it a 20 minute job to install and wire up. No crimping, no wiring. Use off the shelf oil pressure and fuel pressure sensors . 

I can send you the broadcast packets to sniff to get this data at 16ms intervals for ba/bf/fg. 

We would happily push this product on our facebook page/website at no cost if it was robust, reliable and didn't have stock issues. 

This would effectively implement all the most important parts of an after market pcm at a low cost. People would make it almost a mandatory add on for a stock pcm tune. 

  • Like 1
Link to comment
Share on other sites

You've got my mind churning now! Some interesting "wishes" there.

I'd been thinking about how to trip "limp home" mode through spoofing a sensor but hadn't thought of the oil temp. I'd been thinking about intercepting throttle position signals but if the PCM will respond to a change in the oil temp that would no doubt be easier. If anyone has a surplus oil temp sensor (BA if there are differences) kicking around send it my way and I'll work out how to intercept and mimic it. I suspect either the analog voltage outputs or the variable resistor that I've included on the PCB will do the trick I just need to work out ranges, slopes and offsets.

The closed loop boost control is an interesting challenge, including making it fail to safe should anything happen to the micro-controller. I'll probably need to talk to you about how it is implemented by the factory PCM to try to match it and make sure I have all the inputs needed.

Other sensors should be straight forward, again ranges, slopes and offsets will be needed to ensure the PCB is designed correctly as the micro-controller analog inputs are natively only 3.3V tolerant. I've got a SAAS oil pressure sensor and an autometer fuel pressure sensor kicking around so can start with them.

By far the hardest part will be the packaging, QC, etc. to make it a commercial offering. I'm sure there will be some special "gotcha's" in the implementation, but that is half the fun.

I'd given a little thought to how configuration could be made easy but hadn't got to simple dials. Depending on what is possible with the Tactrix, my first thought was that the configuration could be sent over the CAN bus via unused identifiers (extended?). It may even be possible to make it seamless for PCMtec users.

This is only a hobby for me, I'll keep you informed of progress but it may be slow. My turbocharger is fubar at the moment so that will need my immediate attention.

  • Like 1
Link to comment
Share on other sites

@2X044 Random tangent question. What PCB design software are you using?

For your interconnects to an IP rated enclosure, Deutsch DT series pcb header connectors are covid stock affected. AMP AT series is a similar offering which are still well stocked. Hammond Manufacturing make some really nice rugged IP rated enclosures that are priced very reasonable. 

  • Like 1
Link to comment
Share on other sites

That design looks good, I think I'm independently keeping several Aliexpress stores afloat and have a number of "automotive" enclosures and connectors. I bought the enclosure that I'm using from Altronics as I wanted to be able to see the LEDs inside.

How do you cut the holes in the sliding lid?

  • Haha 1
Link to comment
Share on other sites

Hahaha, it gets like that sometimes! I've been there in the past buying up bulk.

For inside the cabin your box will be okie dokie. But it is nice to splash out a little more and go for the OEM look on certain projects once in a while. 

I've got a small milling machine with a DRO that should get the job done. Doesn't give a water jet finish but good enough with a bit of hand finishing.   

Link to comment
Share on other sites

I've got a dead BF turbo PCM in the shed that come with a ute I bought. It had been opened up by the previous owner in a rough way after it wouldn't power up. If the board is of use to anyone to compare against a stock NA BF ZF6/6sp manual PCM to develop an add on boost controller for NA PCM's or see what's required to modify a na PCM, I'm happy to post it to them.

Link to comment
Share on other sites

Additional functionality that would be useful for the racing guys, picking up wheel speed and correcting for different size wheels and tyres front to rear.

I get asked for this quite a bit and have no solution available to offer.

When cars are fitted with radials for drag days, this induces a limp home condition and makes the car undrivable.

Link to comment
Share on other sites

19 hours ago, hjtrbo said:

Hahaha, it gets like that sometimes! I've been there in the past buying up bulk.

For inside the cabin your box will be okie dokie. But it is nice to splash out a little more and go for the OEM look on certain projects once in a while. 

I've got a small milling machine with a DRO that should get the job done. Doesn't give a water jet finish but good enough with a bit of hand finishing.   

Pop in inside a Bluetooth Phone Module casing. moy bueno

Link to comment
Share on other sites

13 hours ago, Bill said:

I've got a dead BF turbo PCM in the shed that come with a ute I bought. It had been opened up by the previous owner in a rough way after it wouldn't power up. If the board is of use to anyone to compare against a stock NA BF ZF6/6sp manual PCM to develop an add on boost controller for NA PCM's or see what's required to modify a na PCM, I'm happy to post it to them.

Yes please, I'll PM you.

6 hours ago, Whiteford said:

Additional functionality that would be useful for the racing guys, picking up wheel speed and correcting for different size wheels and tyres front to rear.

I get asked for this quite a bit and have no solution available to offer.

When cars are fitted with radials for drag days, this induces a limp home condition and makes the car undrivable.

I can think of two (maybe three) ways of doing this, not sure which would be best but all would be "invasive" to the wiring of the car and not a 20 min job. The challenge is that with the ABS controller connected it will be publishing the wheel speed data on the CAN bus. You either need to trick it to broadcast the "normal" info or disconnect it and then pretend to be it (with potential for all sorts of issues).

5 hours ago, jakka351 said:

Pop in inside a Bluetooth Phone Module casing. moy bueno

I've ordered one of these from Aliexpress... Way too big for a final system but should be good for a plug and play prototype while leaving an OBD2 port available for ForScan/PCMtec.

Enclosure.jpg.c1e898b48fbc470afa14127490645d96.jpg

  • Like 1
Link to comment
Share on other sites

10 hours ago, 2X044 said:

I've ordered one of these from Aliexpress... Way too big for a final system but should be good for a plug and play prototype while leaving an OBD2 port available for ForScan/PCMtec.

Yeah, that's definitely a sizeable chunk of plastic lol. Would have to leave the fuse panel cover off. I use a ribbon style splitter cable. Pushed the factory OBD port back out of it's housing in the fuse panel. Then I have the obd port of the splitter cable pushed through the fuse panel cover handle opening. Makes life just that little more convenient. 

OBD II 16 Pin OBD Cable Male To Female Y Splitter Extension Cable (ozsmartthings.com.au) 

 

Link to comment
Share on other sites

2 hours ago, hjtrbo said:

Yeah, that's definitely a sizeable chunk of plastic lol. Would have to leave the fuse panel cover off. I use a ribbon style splitter cable. Pushed the factory OBD port back out of it's housing in the fuse panel. Then I have the obd port of the splitter cable pushed through the fuse panel cover handle opening. Makes life just that little more convenient. 

OBD II 16 Pin OBD Cable Male To Female Y Splitter Extension Cable (ozsmartthings.com.au) 

 

Better than my bodge splitter.

20220910_091859_resize.thumb.jpg.856ae4bd4119ac59aeae450b6e999d23.jpg

  • Haha 1
Link to comment
Share on other sites

18 hours ago, 2X044 said:

I can think of two (maybe three) ways of doing this, not sure which would be best but all would be "invasive" to the wiring of the car and not a 20 min job. The challenge is that with the ABS controller connected it will be publishing the wheel speed data on the CAN bus. You either need to trick it to broadcast the "normal" info or disconnect it and then pretend to be it (with potential for all sorts of issues).

Alternatively you could intercept the wheel speed sensors themselves, or even just replace them with something that is configurable so you can adjust the front/rear ratio.

Link to comment
Share on other sites

On 9/9/2022 at 4:58 AM, 2X044 said:

I can think of two (maybe three) ways of doing this, not sure which would be best but all would be "invasive" to the wiring of the car and not a 20 min job. The challenge is that with the ABS controller connected it will be publishing the wheel speed data on the CAN bus. You either need to trick it to broadcast the "normal" info or disconnect it and then pretend to be it (with potential for all sorts of issues). 

@WhitefordIf this is just the rear tyres - you could wire up a switch that causes an open circuit in both Rear Wheel Speed Sensors -> ABS module wiring -> CAN Data now broadcast from the ABS for the rear wheels becomes 0xFF(invalid) and an ABS fault is triggered, you lose ABS, TCS and DSC and the cluster doesnt shut up, but you are not in LIMP mode and can race car all day, hit the switch and back to normal. Yes / No ?

Take it a step further and open up the ABS module, get into the firmware and write some software that can edit all the thousands of parameters that are probably in there. Then you can "tune" the antilock braking system. 

Link to comment
Share on other sites

CCA Development Environment (bosch-motorsport.com)

 

"We provide the option to run software code on our ECUs that has been developed by the customer. This code is run in the customer code area (CCA) and is protected against access of anyone else. Within ECUs and VCUs, this feature can be run in parallel to all further functionality.

We deliver it with a full environment for Matlab/Simulink, a compiled Bosch model as library and a package of Matlab/Simulink interfaces to all I/Os."

 

 

Link to comment
Share on other sites

On 9/7/2022 at 6:55 PM, Roland@pcmtec said:

Intercept the oil temp and pull it high eg 255c on failure modes like low fuel pressure or other conditions that rely on external sensors not present on the factory pcm.

I've been doing some reading and making sure the next PCB can support this requirement. I found this information regarding the EOT sensor:470367852_Screenshot2022-09-13165850.jpg.d67863bdca894a809ca0609f1442fd33.jpg

Unless we can change the behaviour of the PCM on receiving an "out of range" or "abnormal" reading, the EOT will be ignored and the desired outcome of protecting the engine will not be achieved. Am I reading this correctly?

Edited by 2X044
errors...
Link to comment
Share on other sites

4 hours ago, 2X044 said:

I've been doing some reading and making sure the next PCB can support this requirement. I found this information regarding the EOT sensor:470367852_Screenshot2022-09-13165850.jpg.d67863bdca894a809ca0609f1442fd33.jpg

Unless we can change the behaviour of the PCM on receiving an "out of range" or "abnormal" reading, the EOT will be ignored and the desired outcome of protecting the engine will not be achieved. Am I reading this correctly?

 

It is just saying if the sensor output seems unlikely to be true the PCMs failure strategy is to ignore the sensor and replace that value with that of the cylinder head temp sensor value - keeping the engine runnning pretty much as it was before the failure - so trying to fuzz this signal to the pcm wont work - as it will just ignore it. You probably want to cause a condition where the pcm sees 140-160 degrees celcius at the CHT - as it will start shutting down cylinders and dumping fuel in to try cool it down. Roland  has mentioned it in these forums before i'm sure, all the parameters are in the software, you can set the failsafe point temps as they rise and fall.

Link to comment
Share on other sites

21 hours ago, Roland@pcmtec said:

Not exactly cheap. Can buy an aftermarket PCM for the price of a Bosch Motorsport configurable ABS module. They are designed for 300k track cars. 

Mate I have a 5.4, it is a 300k track car. Almost. 

 

Link to comment
Share on other sites

  • 3 weeks later...
On 9/12/2022 at 1:56 PM, Roland@pcmtec said:

I'm sure the ABS module can be read/written using the standard UDS protocols which are publicly available. It would not be rocket science to look for the MSG IDs, trace these back and find the wheel slip % and start modifying things. The code may not even be checksummed.

@jakka351 why don't you give it a crack?

 

On 9/12/2022 at 10:44 AM, Whiteford said:

Seeking a non-invasive solution

There is a diagnostic routine that can disable the safety software - it may be possible to actually do this with minimal effort, just need to test it in practice. Test it in the red herring mobile.

  • Like 1
Link to comment
Share on other sites

On 10/3/2022 at 7:07 PM, jakka351 said:

There is a diagnostic routine that can disable the safety software - it may be possible to actually do this with minimal effort, just need to test it in practice. Test it in the red herring mobile.

Anymore information on what the "Safety software" is? There are a lot of failsafes in the ABS module that you wouldn't want to disable. Make sure you test it somewhere safe.

Link to comment
Share on other sites

50 minutes ago, Roland@pcmtec said:

Anymore information on what the "Safety software" is? There are a lot of failsafes in the ABS module that you wouldn't want to disable. Make sure you test it somewhere safe.

at this stage unsure, its something that may be better tested with modules on a bench and a simulator rather than in a vehicle.

Link to comment
Share on other sites

Doing skids in gravel car parks takes me back to my youth...

Finally got the progressive shift light working though not installed properly, I've halved the rpm that the lights are coming on so I don't have to rev the berries out of the car for the demo. First light will come on at 3000rpm and they all go red at 6000. Interesting to see how much lag is in the tacho.

https://vimeo.com/757148325

Edited by 2X044
broken link
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...