M20B20 to MegaSquirt build
-
- 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
that is a cold start, but a good one! loving the whisky tin tube is it?
'79 316 (sepiabraun, awesome!)
- BertjeConti
- E21 Mad
- Posts: 2871
- Joined: Mon Nov 04, 2013 9:49 pm
- My E21(s): E12 520-6
- Location: nederland , Weert
Re: M20B20 to MegaSquirt build
Two beer cans, they're "my favorite Germain "weizen Bier" cans.steed wrote:that is a cold start, but a good one! loving the whisky tin tube is it?
i've also used one for a nice exhaust end tip



Megasquirted '77 E12 520-6
Aspen Silver '96 E39 523i
-
- Upcoming E21 fanatic
- Posts: 57
- Joined: Thu Feb 26, 2015 9:51 am
- My E21(s): groene 315 van 1982
- Location: Zichem België'
Re: M20B20 to MegaSquirt build
Awesome work, I've read the whole thread
Realy nice and à clean build up
With respect
Realy nice and à clean build up
With respect

- BertjeConti
- E21 Mad
- Posts: 2871
- Joined: Mon Nov 04, 2013 9:49 pm
- My E21(s): E12 520-6
- Location: nederland , Weert
Re: M20B20 to MegaSquirt build
MS Display update
The display unit works fine, only i wasn't happy with the populair blue/white LCD display because:
- you can't read it when backlight is off, so backlight is always on
- in the dark the white backlight gives a lot of disturbing light in the cockpit.
- in sunny daylight the backlight isn't strong enaugh to give a good readout
- the refresh rate of this display is very slow.
So i ordered a oldfashioned black on green display, which gives a good contrast with or without backligt.
I also was't happy with the experimental pcb, it works wel at the moment but i doupt it's reliability on the long term.
So i've designed last week a real pcb and used SMD components as much as possible. The design is a single sided PCB.
The PCB is manufactured at home without fancy/expensive tools.
Firs the design is mirror printed on photo paper with my laser printer and then the toner is tranferred from the photo paper to the copper PCB with the help of a laminator:

Then the PCB is etched in a solution of Hydrochloric and hydrogen peroxide:

After that the toner is removed with thinner:

test fit some components:

next step is aplying a solder mask which protects the bare copper from corrosion, to do you'll have to mask the solder pads before aplying the solder mask paint, the paint i used is a glass-porcelian paint which needs to cure at 150 degrees for 20 minutes:
solder pads masked with yellow transparrent tape (nerve wrecking job):

solder mask applied:

And cured:

Then the PCB was finaly ready for drlling and soldering the components.
As a drill tool i used my wifes electric pedicure hand drill/mill machine. The proxxon drills i use fit perfectly in this profesional machinery.
After soldering i cleaned the PCB with white spirit to remove the resin deposits which is used in the solder as a flux.

PCB and display assembled:


experimental PCB versus the final PCB:


Test run on the bench:

And finaly build the whole assembly back in is enclosure:


The display unit is back in the car and works like it should.

in the background there is my homebuild tripmaster:

another job done.
The display unit works fine, only i wasn't happy with the populair blue/white LCD display because:
- you can't read it when backlight is off, so backlight is always on
- in the dark the white backlight gives a lot of disturbing light in the cockpit.
- in sunny daylight the backlight isn't strong enaugh to give a good readout
- the refresh rate of this display is very slow.
So i ordered a oldfashioned black on green display, which gives a good contrast with or without backligt.
I also was't happy with the experimental pcb, it works wel at the moment but i doupt it's reliability on the long term.
So i've designed last week a real pcb and used SMD components as much as possible. The design is a single sided PCB.
The PCB is manufactured at home without fancy/expensive tools.
Firs the design is mirror printed on photo paper with my laser printer and then the toner is tranferred from the photo paper to the copper PCB with the help of a laminator:

Then the PCB is etched in a solution of Hydrochloric and hydrogen peroxide:

After that the toner is removed with thinner:

test fit some components:

next step is aplying a solder mask which protects the bare copper from corrosion, to do you'll have to mask the solder pads before aplying the solder mask paint, the paint i used is a glass-porcelian paint which needs to cure at 150 degrees for 20 minutes:
solder pads masked with yellow transparrent tape (nerve wrecking job):

solder mask applied:

And cured:

Then the PCB was finaly ready for drlling and soldering the components.
As a drill tool i used my wifes electric pedicure hand drill/mill machine. The proxxon drills i use fit perfectly in this profesional machinery.
After soldering i cleaned the PCB with white spirit to remove the resin deposits which is used in the solder as a flux.

PCB and display assembled:


experimental PCB versus the final PCB:


Test run on the bench:

And finaly build the whole assembly back in is enclosure:


The display unit is back in the car and works like it should.

in the background there is my homebuild tripmaster:

another job done.

Megasquirted '77 E12 520-6
Aspen Silver '96 E39 523i
- Jeroen
- Site Admin
- Posts: 28532
- Joined: Tue Sep 14, 2004 12:23 pm
- My E21(s): '81 323i Baur
- Location: The Netherlands
- Contact:
Re: M20B20 to MegaSquirt build
And an impressive one! 

-
- 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
oh very nice, the colour/contrast is much better in the green that's for sure. I have been toying with buying a proxxon pretty much for the reason you have used your bits for. I've never seen solder mask applied like that before, is it a film layer of do you paint it on? how do you stop it from sticking to the contacts you want exposed?
'79 316 (sepiabraun, awesome!)
- BertjeConti
- E21 Mad
- Posts: 2871
- Joined: Mon Nov 04, 2013 9:49 pm
- My E21(s): E12 520-6
- Location: nederland , Weert
Re: M20B20 to MegaSquirt build
The Soldermask is painted with a brush on the PCB, before painting i've masked the solder pads with tiny pieces of tape, as i explained earlier.steed wrote:oh very nice, the colour/contrast is much better in the green that's for sure. I have been toying with buying a proxxon pretty much for the reason you have used your bits for. I've never seen solder mask applied like that before, is it a film layer of do you paint it on? how do you stop it from sticking to the contacts you want exposed?
In this photo you can see the masked solder pads, it is hard to see because of the yellow transparent tape i used.

After applying and drying the paint i've removed the tape from the solder pads and after that i cured the paint at 150 degrees for 20 minutes.
The paint i used is intended for creative glass painting, and gets hard like porcelain when cured in a oven.

Megasquirted '77 E12 520-6
Aspen Silver '96 E39 523i
-
- 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
That is a genius use of porcelain glass paint. I think I shall steal this technique!
Also, love the shark
Also, love the shark
'79 316 (sepiabraun, awesome!)
- BertjeConti
- E21 Mad
- Posts: 2871
- Joined: Mon Nov 04, 2013 9:49 pm
- My E21(s): E12 520-6
- Location: nederland , Weert
Re: M20B20 to MegaSquirt build
Oil pressure an temperature sensors
The Megasquirted M20 still performs like it should. So it seems a reliable solution when build with care and good planning.
Since last post in this topic we did some classic car rally's with it and the whole system performed without any problems at all. And because we want to do some more rally's and rally's aren't always driven on smooth roads im adding a sump guard to the car. the sump guard will take some cooling air away from the sump, and thats why i want to install al oil temp sensor.
So while adding a oil temp sensor the next logical step is adding a oil pressure sensor also.
The Megasquirt V2 software cannot handle these extra parameters, but my display can, so i've added al little PCB which add's 4 extra analog inputs. 1 for oil temp, 1 for oil pressure and 2 spare for future plans.
here are some photos of it:
little daughter PCB etched:

and again made a solder mask with glass paint:

then fitted the daughterboard to the main board:

put it all back together:

wrote updated firmware and loaded in the display and testing:

Seems to work well on bench testing, display hooked up to test megasquirt:
Next step is building a little wire loom to the sensors, sensors come in a sandwich adapter plate between oil filter and engine block.
Another nice feature i'm planning is a "eco -fun" switch, with this switch its possible to choose between two fuel and ignition tables in the megasquirt, normaly driving in "eco" mode, but when "fun" mode is selected, some extra advanced is introduced and when lifting the throttle (very low MAP) the ingition advance wil be very low and mixture rich, so the exhaust wil give nice popping sounds between gear change or overrun situations.
The Megasquirted M20 still performs like it should. So it seems a reliable solution when build with care and good planning.
Since last post in this topic we did some classic car rally's with it and the whole system performed without any problems at all. And because we want to do some more rally's and rally's aren't always driven on smooth roads im adding a sump guard to the car. the sump guard will take some cooling air away from the sump, and thats why i want to install al oil temp sensor.
So while adding a oil temp sensor the next logical step is adding a oil pressure sensor also.
The Megasquirt V2 software cannot handle these extra parameters, but my display can, so i've added al little PCB which add's 4 extra analog inputs. 1 for oil temp, 1 for oil pressure and 2 spare for future plans.
here are some photos of it:
little daughter PCB etched:

and again made a solder mask with glass paint:

then fitted the daughterboard to the main board:

put it all back together:

wrote updated firmware and loaded in the display and testing:

Seems to work well on bench testing, display hooked up to test megasquirt:
Next step is building a little wire loom to the sensors, sensors come in a sandwich adapter plate between oil filter and engine block.
Another nice feature i'm planning is a "eco -fun" switch, with this switch its possible to choose between two fuel and ignition tables in the megasquirt, normaly driving in "eco" mode, but when "fun" mode is selected, some extra advanced is introduced and when lifting the throttle (very low MAP) the ingition advance wil be very low and mixture rich, so the exhaust wil give nice popping sounds between gear change or overrun situations.

Megasquirted '77 E12 520-6
Aspen Silver '96 E39 523i
- Jeroen
- Site Admin
- Posts: 28532
- Joined: Tue Sep 14, 2004 12:23 pm
- My E21(s): '81 323i Baur
- Location: The Netherlands
- Contact:
Re: M20B20 to MegaSquirt build
I want a Fun switch as well!
May fit nicely in this dash as well

May fit nicely in this dash as well

- BertjeConti
- E21 Mad
- Posts: 2871
- Joined: Mon Nov 04, 2013 9:49 pm
- My E21(s): E12 520-6
- Location: nederland , Weert
Re: M20B20 to MegaSquirt build
Nice dash Jeroen, love it...

Megasquirted '77 E12 520-6
Aspen Silver '96 E39 523i
-
- 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
this is impressive, how are you including the separate sensor inputs on the code? I recall that you extract the MS data via a serial interface and then display its values, but am I right in thing that the daughterboard is it interface the separate analogue sensors? if so how are you going about including their update display sequence in a timely fashion (how frequently does this new set of values update o the display?)
'79 316 (sepiabraun, awesome!)
- BertjeConti
- E21 Mad
- Posts: 2871
- Joined: Mon Nov 04, 2013 9:49 pm
- My E21(s): E12 520-6
- Location: nederland , Weert
Re: M20B20 to MegaSquirt build
Hello Steed, de separate sensor inputs are hooked up to two analog inputs which are already on the microcontroller board. The daughterboard was needed to make a proper interface and connector to the controllor board. The daugtherboard is layed out for 4 analog inputs, two used for the oil pressure and temp sensors and 2 spare for eventualy future plans.steed wrote:this is impressive, how are you including the separate sensor inputs on the code? I recall that you extract the MS data via a serial interface and then display its values, but am I right in thing that the daughterboard is it interface the separate analogue sensors? if so how are you going about including their update display sequence in a timely fashion (how frequently does this new set of values update o the display?)
Reading analog values from inputs in a microcontroller is the most easy task, it takes only 1 line of code.
Converting the analog value to the desired value to show takes some more coding, but al in al it's relative easy to do.
I'm asking and getting the logging values from the megasquirt via the serail connection every 200mSec, in this same sequense i'm reading the 2 analog inputs, so all the values on the display are refreshed every 200mS. This is including all the necessary calculations and conversions needed.
Getting the logging values from a Megasquirt is fairly easy too, connect the serial port with the same settings as in the megasquirt (default 115200baud) and send the character A, the megasquirt responds with a string of 209 bytes which contains all the available data. The trickiest part is to extract all the wanted values from the data string.
The speed signal from the sensor hooked up to the diff causes a interrupt at each puls, so it doesn't interfere with the rest of the code. The executed code handled by the interrupt needs to be as short as possible.
Hopefully this explains your questions

Megasquirted '77 E12 520-6
Aspen Silver '96 E39 523i
- BertjeConti
- E21 Mad
- Posts: 2871
- Joined: Mon Nov 04, 2013 9:49 pm
- My E21(s): E12 520-6
- Location: nederland , Weert
Re: M20B20 to MegaSquirt build
in my offtopic thread i've showed the wiring to the sensors and a short video showing the readouts on the display, in the video i toggle the select button to show next set of readouts:
Pastellblau 520/6 Display update
At this time the firmware in the display is updated again, showing the readouts a little nicer and got rid of the bootloader in the controller, so it starts right away.
Pastellblau 520/6 Display update
At this time the firmware in the display is updated again, showing the readouts a little nicer and got rid of the bootloader in the controller, so it starts right away.

Megasquirted '77 E12 520-6
Aspen Silver '96 E39 523i
-
- 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
you stripped out the bootloader! you definitely know your onions if you've gone that far for the sake of presentation.
it is exactly as you say, the refresh rate is ideal for the amount of information being displayed against. have you thought about a graphical representation? I know absolute values are better for measurement purposes but when I'm driving I like the 'needle in a zone' appearance, or possibly the filled bar display for instant feedback. obviously you wouldn't be able to display as much information but I wonder if you had thought about it?
Its all very impressive nonetheless.
it is exactly as you say, the refresh rate is ideal for the amount of information being displayed against. have you thought about a graphical representation? I know absolute values are better for measurement purposes but when I'm driving I like the 'needle in a zone' appearance, or possibly the filled bar display for instant feedback. obviously you wouldn't be able to display as much information but I wonder if you had thought about it?
Its all very impressive nonetheless.
'79 316 (sepiabraun, awesome!)