Jump to content

Poor mans real time tuning


hjtrbo

Recommended Posts

Hey all, one for the home brew guys. Making a little tool that connects up to your rear o2 sensor and sweeps 0-1V over 256 DAC steps (resolution 4mV :)). The idea is you set up a flex fuel OS, set up a map pair you’d like to dial in. A good example is cam shafts. In 98 fuel intake cam, set all -10°, E85 set all to 50°, then load the engine up and sweep from 0 to 1V to find the optimal angle for the map cell you’re working in. Sweep time is adjustable and there is a manual mode. All settings are saved to flash so you’re not having to re-set up the tool every power cycle.

The code is written in C using Microchips MPLAB X IDE. Definitely possible to port to Arduino with a little bit of effort and care. Project folder attached. Handy little bit of gold in the LCD code, made a function that scrolls 1 line of text whilst keeping the other line fixed.

Software is done and tested on a development board. The final board layout and component BOM are the next steps.

Downloads if you want to play along…

IDE https://ww1.microchip.com/downloads/en/DeviceDoc/MPLABX-v5.35-windows-installer.exe

Compiler https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc8-v2.41-full-install-windows-x64-installer.exe

MCC Plugin https://ww1.microchip.com/downloads/en/DeviceDoc/com-microchip-mcc-4.0.2.zip

Source code (spacing weird, tabs vs spaces interpretation issues when github gets it, looks fine on my machine) hjtrbo/Map-Sweeper (github.com)

Screenshot2023-07-17100053.jpg.b8e7a24ed4815a44cf54ffe7af4a0c07.jpg

Edited by hjtrbo
extra info
  • Like 4
Link to comment
Share on other sites

This is brilliant.

Does the chip have CAN support?

You could tie this into your dyno to make a MBT plot using an analog output or a specific CANID to do proper OEM style tuning.

If you bundled this all up with a video and some documentation I guarantee you could sell this.

All the modern 15+ Fords have IO control via Forscan so you can lock CAM/Spark timing and adjust it via a slider, however getting this data back into the dyno or datalogger would be brilliant as you could get a proper MBT curve per cell. Most common dyno's publish canbus output data and will accept canbus input.

Well done.

Link to comment
Share on other sites

Thanks for the links. Chip is a 8k word 8 bit PIC micro running at 16MHz. It doesn't have native CAN support but I have in a past project bit bashed a CAN MCP2515 transceiver using SPI to communicate with a LINK ECU to pull data out for a custom dash which went really well. If I get bored I can bring those source files into the project and integrate. Chip memory usage is at 82% 😬, but I know I could get that down with some optimisation and compiler tweaks.

  • Like 2
Link to comment
Share on other sites

@Roland@pcmtec, is this what you were saying?

... For the CAN feature I presume I'd bring in from the dyno:

  • Ignition Trim 
  • Lambda Trim
  • Inlet Cam Trim
  • Exhaust Cam Trim

Basically using my tool as a pass through to the rear o2 sensor, I.e. the dyno would control the sweep. 

The user would then set up the flex fuel OS respective map pair in PCMTEC and then run the dyno sweep?

  • Like 1
Link to comment
Share on other sites

Basically you'd set the dyno to steady state and target a load rpm cell, then adjust timing and log torque. You'll get a pretty curve as you approach MBT. 

Now you won't be controlling for ECT or IAT so you would probably want to heat soak the engine and do it in the worst conditions possible, then interpolate backwards. 

That is similar to how the auto tune features work on many aftermarket ECUs. 

You could do all of this on the dyno actually as most dyno will pick up timing via obd or you could use a clamp. 

Link to comment
Share on other sites

I understand how it's done, just need to know how the dyno output on CAN is to be interpreted by my tool... Can also get close to MBT watching fuel trims if you are doing it on the road using cruise control and a mate in the car :) .

But, doing some reading I think I've got the gist. I'm basically just acting as a CAN pass thru to the rear O2 sensor. I'm hunting around for a better chip. Found a couple of candidates with on board CAN that are automotive rated. It's just the models aren't available in Proteus, which makes debugging more time consuming using an in circuit debugger.

  • Like 1
Link to comment
Share on other sites

I'm at a cross road.

1). I spoke with Mainline. I need to output data to them for it to work with their optional ecu data logging module . For example, I would emulate a Link ECU data stream and it will work with their software. But there is a problem: I can only output 1 parameter per tuning session, that being the map we're tuning. All other data points would be static.

2). The dyno operator utilises the OBD-II data stream and my box will run in a standalone mode as originally intended. 

Option 2 leans heavily towards the KISS principal yet still achieves a high level of functionality. I would sure appreciate some detailed comment.

  • Like 1
Link to comment
Share on other sites

Some CAD spam for the fiends out there. Added CAN-BUS hardware to future proof, no software support at this stage. Next iteration will be to add an aerial and enable the transistor radio function. Plan to get the layouts off to the board house for fabbing shortly.

No idea on ETA just yet, next week I'm adding in the functionality to support GM Gen 4 / Gen 5 (VE, VF, Camaro, Cadillac etc) vehicles as their flex fuel sensor is frequency based and is easily implemented with just plain old vanilla HP Tuners. If they don't have a physical flex sensor, they would need to buy the ECM wiring kit from a third party (e.g. $110 from Ultimate Conversion Wiring in Australia).

I'll need a couple of testers at some point if any one is interested... I also will be testing it on my own car. 

No technical reason why it couldn't be left permanently connected either. Have your tune setup so the box functions effectively as an on the fly variable engine power output box, mild to wild incremented at up to 256 steps lol... 

It's going to be small, the enclosure measures 105 mm x 65 mm x 30 mm. And could be made smaller again if I could be bothered hand soldering surface mount components and changed out the LCD for an OLED.

Master-Assembly.png

 

Master-Assembly3.png

Master-Assembly4.png

Main-board.png

 

 

 

 

 

  • Like 4
Link to comment
Share on other sites

20 hours ago, Puffwagon said:

Yeah man happy to do a whole bunch of testing, gotta keep them tuning skills at least somewhat sharp hey!

I don't have my na territory set up for flex fuel as it is just a daily, but can work something out.

You know it. 

11 hours ago, K44 said:

I'm a long way away from you but I'd love to test or buy when you get it finished. If it works on the tricore mustang ECU.

I don't know much about the can-bus flex fuel setup PCMTEC have worked out for tri-core??? Perhaps later on I might be able to get a hold of the relevant can id and message construct to be able to put my sweep data out onto the bus. Hardware wise it's supported, but would need a major firmware update from my end. Perhaps a conversation with Roland down the track...

  • Like 2
Link to comment
Share on other sites

On 7/30/2023 at 7:09 AM, K44 said:

I'm a long way away from you but I'd love to test or buy when you get it finished. If it works on the tricore mustang ECU.

2015+ you can lock timing and cam angles via Forscan and do live tuning on a steady state dyno that way. 

I haven't got the original video on my phone but its on our fb power users fb group how to do it 

https://m.facebook.com/groups/pcmtec/permalink/702717647594338/?mibextid=Nif5oz

I can send you the can commands to trigger this if you wanted to do auto tuning. People would pay considerable money for this if it can lock a mapped point (eg vct angles) then tune each load site for MBT by sweeping the timing. 

Much simpler than having to rely on what hjtrbo has to do on the Falcon (they don't have built in IO control like the modern Fords do. 

Link to comment
Share on other sites

53 minutes ago, Roland@pcmtec said:

I can send you the can commands to trigger this if you wanted to do auto tuning. People would pay considerable money for this if it can lock a mapped point (eg vct angles) then tune each load site for MBT by sweeping the timing. 

I'm yet to look at the video... Does Forscan allow that functionality I.e simultaneous IO control of 2 (or more) points?

If no:- Can the 2015+ models allow multiple IO control? If yes, I'd like to add feature that to my box.

Link to comment
Share on other sites

Thanks Rolls, I'm watching some of your Mustang flex fuel videos on FB now whilst scrolling through. It is likely my box will work with that flex sensor in "GM Mode", i'll look up the sensor data to double check. (Eager to say: 2015+ Ford with flex fuel install + custom OS now supported)

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...