Thursday, September 29, 2011

Thermistor calibration tables

I removed my MAT sensor and checked the calibration, which improved the indicated air temperature accuracy.  That also made a small difference in the A/F ratios.  I had replaced my M54 MAT with an M50 MAT for the OBD1 conversion but I've forgotten if I did the same with the coolant sensor...




Tuesday, September 27, 2011

VANOS integrated and working

The M54 has dual, variable-VANOS and I got it working nicely with Megasquirt.

Not the way you would think, I don't have it working natively through the Megasquirt (that's still in development) but I have it working through my own VANOS controller. 

Remember, this is a temporary solution until I started using the integrated VANOS control that is now part of the Megasquirt code.

Seattle Circuit VANOS control board


The board operates 90% independentally from the ECU and only needs one signal from the ECU to operate.  It also shares the TPS, Crank and Intake Cam signals.




The VANOS enable signal was originally the On/Off VANOS signal from the 413 ECU.  The 413 triggered the intake cam advance whenever load was above about 20% and the coolant was warm enough.  Advancing the intake cam at colder temperatures causes the engine to stumble and just run poorly.  It needs to be warm.

While the VANOS control board can handle calculating the load factors, it doesn't have the CLT sensor signal.  Easier to rely on the ECU for that.

Configuring the proper trigger in Megasquirt was easy. 

Nitrous 1 configured as the VANOS enable signal

Friday, September 23, 2011

Tachometer output

Added the internal jumper I need to get the tachometer working.

Connect JS11 with SPR4 (pin 6 on DB37)



Turned Tacho on through SPR4 and my tach works great!

more stock ECU measurements

It's quick and easy to get data off the stock ECU. 



Cranking spark very close to TDC.  Dwell at 6.5ms.

This is spark #1 cylinder vs crank position on the stock ECU.  TDC is 324 degrees after tooth #1.  The middle of the tooth is where the trace is going down through zero.  Spark is 3 teeth ahead, or 18 degrees BTDC.

I set idle to 18 degrees BTDC on the Megasquirt and compared the O-scope plot to the stock above.  THEY MATCHED EXACTLY!



This is interesting... injector #1 cylinder vs crank.  Idle fuel is injected 525 degrees BTDC.  It's injected near the bottom of the power stroke and sits on the closed intake valve for about 150 degrees before it opens. 

Wednesday, September 21, 2011

Adjusting VR bias and getting a nice idle

I got the motor idling and starting nicely.  Cranking advance changed to 8 degrees, cranking pulsewidth changed so that I got 8ms, same as what I measured on the stock ECU.  Adjusted idle VE slightly and it was starting and idling very nicely!   ...and it's not even closed loop yet.

Problem is that when I blipped the throttle it would bog and die.  Three or Four times in a row...  I changed the dashboard to show lost synchs and saw that the count was going up right as it was stalling.  I had a VR sensor problem.

This is where I discovered how powerful Megalog Viewer can be.  I logged one of the stalls and got this plot:


The very top line is RPM.  Right as I blip the throttle the RPM dips to zero but then instantly recovers.   Due to noise, I guess, but not sure why I was getting noise from blipping the throttle.  Anyway,  I was getting a lost synch reason 2.  Missing tooth out of sequence.  The reason it was stalling wasn't because of the lost synch, but because going to zero RPMs and back up was triggering After Start Enrichment (ASE) which you can see where the blue line goes up.  The ECU saw the rise from 0 to 750 rpms as a start and increased fuel!

I adjusted the R52 bias screw 3 1/2 turns to the right from full-left and tried again.  Revs nicely now and no synch drops!

O-scope of the VR conditioner with car idling.  The zero-crossing down looks great, but why is the ouput returning to ground at a negative voltage?  Isn't the hysteresis bias on the (+) OpAmp pin??

I took the Megasquirt back in my shop and ran the signal generator through the VR input.  The first thing I noticed is that R52 and R56 don't behave the way I expected.  That is, after turning both 6 turns to the left to ensure that they were on the stops it took around 3-4 turns clockwise on either one of them to get anything to happen.  I adjusted them so I have a good hysteresis margin, but not so much that a 4v peak-to-peak cranking signal would keep the car from starting.   The conditioner trips at about +1 volts and - 1/2 volts, well within the margin of a cranking signal but well above any noise (I hope)

This is only 40Hz and a few volts peak-to-peak.  The actual VR signal is near vertical at the threshold points.
Mystery of the negative voltages solved... this is a scope of an input signal and the output of the first stage of the VR conditioner.  The transistor biases the voltage of the input up by about 1.2 volts.  This is why a negative input voltage was tripping the zero crossing detector.. it was at zero volts by the time it got to the comparator.
I also found that the behavior of the hysteresis pot, R52, is very non-linear.  The first 3 turns did almost nothing to hysteresis.  Turn 4 starting increasing it.  Turn 5 started increasing it quickly.  After turn 6 it started to go off the chart very quickly.
The bottom line

I would take both R52 and R56 and turn them to the left about 10x to get them set to zero.  Leave R56 alone.  Turn R52 5x to the right.

The motor starts and revs with ZERO lost synch counts now.


Tuesday, September 20, 2011

Stock engine measurements

In an effort to make the car run like stock, I need to know what stock looks like.  (plus if I don't document it here I'll loose my scribbles..)


Stock priming pulse 12ms at 110F
Stock injector cranking  PW time for a 170F warm car is 18.0ms***
Stock injector on time at idle for a 170F warm car is 2.1ms

Those values are measured with an O-scope off an injector, so taking the .62ms dead time in account the actual opening times would be 1.5ms and 17.38ms.

***Cranking PW seems to taper-down with the number of cranking injection cycles.  First two are 18, then 15, then 12 and after it's been cranking for a while it's 10ms.  I will need to look at this some more, because even at the same temperature it changes by 2ms from the first measurement to the second.

cranking IAC PWM , all temperatures   50%

cranking ignition advance.                      0 degrees BTDC

idle IAC   PWM      cool, 80F              36%
idle IAC   PWM      warm, 170F          34%

Now I won't loose it.

Siemens DEKA injector latency/dead time

Nick Glantzis from Technique Tuning was nice enough to share the factory ECU injector latency chart for the stock Siemens DEKA injector on the M54b30.   Crunching them results in .620ms at 13.2 volts.  I thought that was very fast for a factory injector.


I believe in "Trust but Verify", so I sent one for lab testing and the results were different.  1.08ms at 13.2 volts, a more typical value.


I will be using these values.  1.08 ms at 13.2 volts

The 3-wire ICV

MS3 has native support for 3-wire ICV's, so no more conversion circuits.  I had my motor started and idling, but the idle was horribly unstable and oscillating like crazy.  I activated the "Test Idle Valve" feature and reduced the PWM all the way down to 0% but it was still idling like it had a massive vacuum leak. 

I physically pinched the ICV hose and the idle fell to acceptable levels.  Then stalled..

I had an ICV control problem, I only had control on the "open ICV" wire so I couldn't get below 50%.

After continuity checks and more trouble shooting, I finally figured-out that I had the port for the second idle wire wrongly configured.  Chris' wiring chart has it running through the VVT pin (why?) but I had the wire configured for the IDLE pin.

Once I got that straightened-out I found that the motor idled nicely at around 40% on the ICV.

It runs!

I plugged the Megasquirt 3 into my car, powered it up and didn't get any smoke.  That's a good start!  All of the sensors indicated normally.  Coolant temp, MAP, etc.   Calibrated the throttle idle and WOT positions.

Removed the fuel pump relay and cranked the car to check rpm and synch.  Nothing...

Checking the crank sensor input to the Megasquirt.  Polarity is correct.. looks good.

I connected some more wires inside the Megasquirt case to check the output of the VR conditioner against the input signal.  The VR conditioner has two pots that adjust the trigger level and the hysteresis.  If the trigger level on R56 is too high it will never trip.
Trigger level and hysteresis.  Picture by DIYautotune.com

After adjusting R56 to the left I tried again and got a nice scope picture.

Yellow is the sensor input and blue is the VR conditioner ouput.  Looks consistent, no noise.  VR signal is only 5v peak-to-peak but this was while cranking.  I'm using 10x probes.

While cranking to get his picture, the motor kept trying to start even though the fuel pump relay was removed.  It was catching on residual fuel.

I re-installed the fuel pump relay, removed some of the crap from the top of the engine and cranked. 

It started... and fell into a high galloping idle.




Monday, September 19, 2011

Wiring the harness adapter

I finished wiring the harness adapter this weekend.  My goal was to make this plug compatible with my existing harness so I could swap the Megasquirt in and out as I felt like it.  Keeps the project from being an "all or nothing" conversion.


 
The covers are removed left and right, exposing the fuel injector drivers on the left and the 6 coil drivers on the right. 
 
Once the circuit card is removed, the injector drivers can be harvested easily by using a heat gun on the back of the board.  Heat the back of the board while gently tugging on the driver.  It will pull out when the solder softens.


Remove 88 pin connector with the heat gun, or carefully clip each lead.  The 88-pin attaches to the rail from the bottom with Torx screws.  Notice that the coil driver rail has an insulating cover.

The coil drivers clip back into place on the rail.  Here I've wired the output to the 88-pin and the grounds are tied together.  I use de-solder wick for the ground.  The power-on circuit is on the left.


The power on circuit (credit to Goat Thumper).  The transistor uses power from Ign to switch the main relay on.  I couldn't find a 2n2222a at Fry's so I used a generic NPN low power transistor.  I measured total current through the coil and transistor at 100mA.  If the transistor has .6v of voltage drop it dissipates .06 Watts, so don't worry about the heat.  The resistor limits current through the base, the diode is flyback from the relay coil.  The capacitor keeps small glitches in IGN power from resetting the ECU.
UPDATE (27 Nov 2011):  I finally solved my remaining starting problems by identifying a fault with my power-on circuit.  The symptom was that in colder weather the motor would never fire on the first attempt, or it wouldn't fire at all.  It was totally sporadic and difficult to identify, but what was happening is that the cold reduced my battery voltage sufficiently so that cranking caused enough of a voltage drop that the transistor no longer had enough current through the resistor to keep it saturated.  IT WAS TURNING OFF THE MEGASQUIRT!   I solved the problem by reducing the resistance on my 7.5kOhm resistor to match my transistor.  If you stick with the 2n2222a as specified you'll be fine.  I need a new battery, too!

 

 

Added the wiring for the main connector.  I used the 18" labeled wires from DIYautotune.  Only 1/2 of the labels matched because it was meant for bank injection, but it's still nice having different  wire colors.  I cut 10mm off the bar on the right to route the wires out the same direction that the 88-pin connector wires go.
Wiring for M3X plug added.  I used the stock DB37 solder cup connectors but if I did this again I would use crimp connection DB37 connectors.  Also added cable retention clamp where the bundle exits the case.
Done for now.  When I'm sure that I won't need to re-arrange or add wires I'll add a conduit for the wires.
 


 Chris didn't screw this up too bad, so I followed his wiring guide.  Since I didn't mount the power-on circuit on the Megaquirt proto area, I didn't use the two connections that I crossed out.  (credit to Chris Seigman.. he has some great info at www.325ix.com)


A note about grounds- they're not all the same.  Just because your 88-pin plug connection is labeled "ground" doesn't mean it's a ground.  Some are grounded to, well, ground and some are the ground connection for a sensor.  You can't connect a Megasquirt ground to a sensor ground, it needs to connect to the chassis.  Know the difference.  Pins 6, 28, 34, 53 and 87 connect to the chassis.  Of those, pins 6, 28 and 55 are on a larger pin with more capacity.


Bosch coil driver.  These are bullet-proof and you save $48.00 for 6 over purchasing BIP337s.

Friday, September 16, 2011

Timing settings

I've been looking at what to use for crank timing settings.  There's a difference in the 60-2 timing wheels between the non-VANOS M20 & M50 and the VANOS M50, M52, S50, S52 & S54.  For some reason, the S54 was put back into the non-VANOS camp.

The notch in the wheel is offset by 120 degrees between the two. 

Megasquirt 3 needs to know the degrees of rotation from the #1 tooth BTDC to the point where the motor is at TDC.  The #1 tooth is the first tooth that the sensor sees after the long gap.  The angle is measured by counting the gaps between the teeth and multiplying by 6.  There are 14 gaps between the tooth at TDC and tooth #1 on the M20 wheel, 14x6=84.

The bottom line is that for non-VANOS motors the number is 84 degrees BTDC and for VANOS it's 324 degrees.


A comparison of the two types of BMW DOHC timing wheel
Also of interest, the internal crank-mounted wheels on the M52, S52 and M54 have the same timing as the ones pictured.

There is a 1 1/2 degree difference between Hall sensors and VR sensors; a Hall sensor reads the edge of a tooth while a VR sensor reads the middle of a tooth.  I don't think it makes a difference since tooth #1 is read the same as the TDC tooth.


Thursday, September 15, 2011

Starting the blog..

I'm starting the blog today to document my progress in converting the M54b30 form the OBD1 413 ECU to a Megasquirt 3 system with the MS3X expansion board.

Goals of this project are for me to develop my understanding of Megasquirt, to get the motor running as well (or better) than the 413 and to lay the foundation for an eventual S54 project.

Keep in mind, since I'm using an M50 harness and an M50 ECU this applies to almost any BMW DOHC motor, I just happen to have an M54, which means I can play with the Megasquirt VVT features later.

I will also document all hardware and software settings as well as possible.

The victim.  1990 325is
M54b30.  ZHP cams, S50b32 headers (euro).   Converted to OBD1 with an M50 harness and a 413 ECU.   Dual-variable VANOS and DISA is handled by the Seattle Circuit VANOS controller.
Dyno plot.  What's noteable is the that peak torque is at 3200rpm!

Overall, the motor has been fantastic in the almost 3 years I've had it as a daily driver in the e30.