M20B20 to MegaSquirt build

For all your questions, problems and DIY stories
Post Reply
User avatar
BertjeConti
E21 Mad
Posts: 3007
Joined: Mon Nov 04, 2013 9:49 pm
My E21(s): E12 520-6
Location: nederland , Weert

Re: M20B20 to MegaSquirt build

Post by BertjeConti »

So, there was still one thing to do under the bonnet concerning the swap to MegaSquirt. Not an important issue however.

The car performs well, hadn't had any issues whatsoever the last 2 months :boogie
Cold start goes well, stable idle in the whole temp range, good throttle response and drivability in the whole temp range.
Now both my sons have a driver license the car is used a lot more often. No complain from the boys about the performance of the BMW.

Back to the engine:
Image
As you can see, there is still one item at the engine without a function concerning the Megasquirt ignition and injection, and thats the mechanical fuel pump.
As you can see the gaskets have had their best time, so fuel pump out and an suitable cover in, with new gasket of course.

Image
Last week i made a suitable cover out of 10mm metal strip, using an old fuelpump gasket as template, and cut out a new gasket.

Today took the fuelpump and the M8 studs from the engine and mounted the cover plate and gasket with 2 m8 bolts and a drip loctite to seal the threads:

Image

Image

Image

I'm planning to overhaul my spare cylinderhead, which is a ...731 casting with matching ports to the intake manifold. The car is still running with a ...200 casting head with small intake ports.
Another project i'm planning for the winter is a wideband O2 sensor & controller.


Image
Megasquirted '77 E12 520-6

Aspen Silver '96 E39 523i
steed
Upcoming E21 fanatic
Posts: 66
Joined: Fri Apr 25, 2008 10:57 am
My E21(s): '79 316 manual (4spd)
Location: Southampton

Re: M20B20 to MegaSquirt build

Post by steed »

oooh! its still all go with the megasquirt build. i'll be watching for the O2 sensor in the future
'79 316 (sepiabraun, awesome!)
User avatar
BertjeConti
E21 Mad
Posts: 3007
Joined: Mon Nov 04, 2013 9:49 pm
My E21(s): E12 520-6
Location: nederland , Weert

Re: M20B20 to MegaSquirt build

Post by BertjeConti »

The wideband controller is moved forward in time.

First i want a display in the car that give me constant readouts. There is a DIY kit available, called "megaview", but i want more.
The "megaview" display shows only values that comes from the megasquirt, like RPM, Advance, MAP, CLT, Pulsewidth, and so on.
The most important value i want to read on the display is the "fuel consumption". Fuel consumption can be calculated from the variables Pulsewidth, RPM and injector deadtime, and also needed is a constant which is maxfuel, e.g. fuelconsumption when all injectors are constant opened (fuel consumption @ 100% duty cycle).

With these parameters it is possible to calculate the fuel consumtion in "liter" per "hour", which is nice, but not handy.

To calculate the momentary fuel consumption (in L/100km) you need a extra parameter and thats "SPEED".
The megasquirt has no knowledgw of vehicle speed at all.

To calculate the average fuel consumption (in L/100km) you need an extra parameter which is the distance traveled. And again the megasquirt does not have these parameters.

Thats why i started a display project, designed by myself.
The key components are:
- Arduino nano micro controller (Atmega 328), arduino has a freeware compiler with lots of examples.
- LCD display 4 lines of 20 chars.
- speed pulse sensor (proximity)

First i started gathering info and parts which come cheap from China.
Learning myself programming in C (i'm a basic man)

In the mean time i started creating a proper housing for the display unit, and a dash mounting bracket.

The display housing i've made out of .8 sheet metal, and consists out of 2 main parts:

Image

Image

in the left are three holes for the leds (green, yellow and red) which will be connected directly to the megasquirt led outputs.

Here the housing and mounting bracket are painted matt black:

Image

The mounting bracket is mounted at the central vents.

Image

Image

Image

Luckily i build a genuine bmw cruise control in the car, about ten years ago. the cruise control comes from a E23. For the cruise control a "speed sensor" was needed, which a E12 ofcourse doesn't have, the E12 (like the E21) still has mechanical speed and odo.
To create a decent reliable speed signal i made a bracket at the diff which holds a proximity sensor, and this sensor detects the 4 bolts which connect the propshaft to the diff. A proximity sensor does not need a magnet to detect, a metal object as near as 4mm is enough.
These sensors did not come cheap at that time, but are proven very reliable, water and heat resist, and my sensor still does the job well.
So my car has already a speed/distance sensor fittet, and connecting its signal to the display unit would be simple.

Here are some pictures from the display unit build on a bread board and connected to my "test megasquirt" on the desk.
In this setup i wrote and tested the sofware.
Communication between display unit and megasquirt is RS232.

Image

Image

As you can see on the display, speed, fuel consumption and other values are already readed out.

At the moment these readouds are implemented in the display software:

- vehicle speed in km/h
- traveled distance (trip meter)
- momentary fuel consumption in L/100km
- average fuel consumption in L/100km, calculated over the trip distance
- engine temp
- air intake temp
- RPM
- manifolt pressure (MAP)
- throttle position in %
- O2 voltage
- AFR correction air/fuel in %
- AFR value
- ignition advance
- pulsewidth
- battery voltage
- air pressure

There are lots more parameters/values coming from the megasquirt, but i'm not interested in them

On the back of the display housing comes a pushbutton to toggle throuhg the different parameters and resetting the trip meter.
Image
Megasquirted '77 E12 520-6

Aspen Silver '96 E39 523i
User avatar
Jeroen
Site Admin
Posts: 29199
Joined: Tue Sep 14, 2004 12:23 pm
My E21(s): '81 323i Baur
Location: The Netherlands
Contact:

Re: M20B20 to MegaSquirt build

Post by Jeroen »

Impressive! :shake
Regards/groeten, Jeroen
Dammizi
Upcoming E21 fanatic
Posts: 74
Joined: Tue Dec 16, 2014 12:40 pm
My E21(s): '81 Euro 323i

Re: M20B20 to MegaSquirt build

Post by Dammizi »

Awesome work man! definetley need to speak to you about the pcb you designed, currently i'm in progress of rebuilding an m20b23 engine after it spent 14 years in storage. would really like to swap it over to efi. if you find some time can you send me a copy of the pcb you designed? thx :)
User avatar
BertjeConti
E21 Mad
Posts: 3007
Joined: Mon Nov 04, 2013 9:49 pm
My E21(s): E12 520-6
Location: nederland , Weert

Re: M20B20 to MegaSquirt build

Post by BertjeConti »

No problem, aye you familiair with freePCB and Tinycad?
Image
Megasquirted '77 E12 520-6

Aspen Silver '96 E39 523i
Dammizi
Upcoming E21 fanatic
Posts: 74
Joined: Tue Dec 16, 2014 12:40 pm
My E21(s): '81 Euro 323i

Re: M20B20 to MegaSquirt build

Post by Dammizi »

sent you a pm thx BertjeConti
User avatar
BertjeConti
E21 Mad
Posts: 3007
Joined: Mon Nov 04, 2013 9:49 pm
My E21(s): E12 520-6
Location: nederland , Weert

Re: M20B20 to MegaSquirt build

Post by BertjeConti »

The display unit continues:

Before soldering components on a PCB i went through the whole cirquit, to be shure all components are right and connected the right way.
At the next photo the Display unit is running on a breadboard, used for finetuning the software:

Image

When everthing works fine, i began building the components on a prototyping PCB, designing and manufacturing a PCB for this cirquit would be nice but isn't nessesary.

In the next picture the prototype PCB has been cut to the right size and test fitted in the display housing:

Image

Image

Next thing is soldering and wiring the components to the PCB to make a solid construction:

Image

the bigger blue daughterboard is the Arduino Nano controllerboard (5 dollar from china) and the small one is a TTL to RS232 converter.
On the left bottom of the PCB is the power supply situated, to make a stable 5V out of 12V battery voltage.

Image

Cable wired up with the right connectors so the display connects to the Megasquirt without problems

Next step is mounting the display unit in the car, which didn't give any problems:

Image

Image

Image

All working as it should. made a short test run.
I've changed the functions of the leds (which are still controlled by the megasquirt)
- green = on when warming up e.g. coolant below 75 degrees
- yellow = MAP or TPS greater than 90%, e.g. full throttle
- red = engine hot or batt low
Image
Megasquirted '77 E12 520-6

Aspen Silver '96 E39 523i
User avatar
BertjeConti
E21 Mad
Posts: 3007
Joined: Mon Nov 04, 2013 9:49 pm
My E21(s): E12 520-6
Location: nederland , Weert

Re: M20B20 to MegaSquirt build

Post by BertjeConti »

Started with the overhaul of the "731 casting" spare cylinder head. My stock "200 casting" cylinder head, which i'm running now, has small intake ports, a worn camshaft and some worn valve's due running on LPG for a few years.
First thing to do after dismantling is cleaning the lumb.

Thats where a water base degreaser comes to help. one evening cleaning and brushing gives a satisfied result.

before:

Image

Image

after:

Image

Image

Now all the small parst need a good cleanup.
Image
Megasquirted '77 E12 520-6

Aspen Silver '96 E39 523i
steed
Upcoming E21 fanatic
Posts: 66
Joined: Fri Apr 25, 2008 10:57 am
My E21(s): '79 316 manual (4spd)
Location: Southampton

Re: M20B20 to MegaSquirt build

Post by steed »

thats some smart looking disply you've made there. is that a pair of arduino microcontrollers powering it?
'79 316 (sepiabraun, awesome!)
User avatar
BertjeConti
E21 Mad
Posts: 3007
Joined: Mon Nov 04, 2013 9:49 pm
My E21(s): E12 520-6
Location: nederland , Weert

Re: M20B20 to MegaSquirt build

Post by BertjeConti »

Only one arduino nano board and a ttl to rs232 converter
Image
Megasquirted '77 E12 520-6

Aspen Silver '96 E39 523i
steed
Upcoming E21 fanatic
Posts: 66
Joined: Fri Apr 25, 2008 10:57 am
My E21(s): '79 316 manual (4spd)
Location: Southampton

Re: M20B20 to MegaSquirt build

Post by steed »

ah i see, most impressive. do you find there is a delay in the display or is it failry prompt to catch up with any changes?
'79 316 (sepiabraun, awesome!)
User avatar
BertjeConti
E21 Mad
Posts: 3007
Joined: Mon Nov 04, 2013 9:49 pm
My E21(s): E12 520-6
Location: nederland , Weert

Re: M20B20 to MegaSquirt build

Post by BertjeConti »

The display has a refresh rate of 0.2 seconds and shows the actual values.
No delay at all.
It shows values the same way as values are shown in tunerstudio with your laptop hooked up.(i used the same protocol )
Except distance speed and fuel consumptions which are recalculated each refresh rate, so maximum delay is 0.2 seconds.
Image
Megasquirted '77 E12 520-6

Aspen Silver '96 E39 523i
User avatar
BertjeConti
E21 Mad
Posts: 3007
Joined: Mon Nov 04, 2013 9:49 pm
My E21(s): E12 520-6
Location: nederland , Weert

Re: M20B20 to MegaSquirt build

Post by BertjeConti »

A few days ago i filmed a coldstart from the megasquirted engine.

The car is now sitting on the driveway since december thanks to the dutch tax regulations :protest

Once a few weeks i start the engine and let it run, so i did last saturday, that night we had a -6 freezing temp, but at the time i started the car in the morning it was almost 0 C.

In the movie you'll see how easy the engine starts, without touching anything besides the ignition-key.

Image
Megasquirted '77 E12 520-6

Aspen Silver '96 E39 523i
User avatar
Jeroen
Site Admin
Posts: 29199
Joined: Tue Sep 14, 2004 12:23 pm
My E21(s): '81 323i Baur
Location: The Netherlands
Contact:

Re: M20B20 to MegaSquirt build

Post by Jeroen »

That is a cold start indeed haha, runs really well!
Regards/groeten, Jeroen
Post Reply