Saturday, October 29, 2011

Adapting 4A-G(Z)E MAP Sensor to Megasquirt I

Some of us Megasquirters choose to go the difficult way of using non-standard sensors. Megasquirt comes stock with MPX4250 sensor which is a 2.5 Bar MAP sensor capable of reading boost to around 1.5 Bar. While convenient, you simply plug in the vacuum line to the on-board sensor and tune away, some of us may choose to save a few bucks and use whatever sensor we already have. In my case, when my engine was setup for NA, i already have a stock 4A-GE MAP sensor and now that i'm going for turbo, i chose to go with 4A-GZE MAP sensor simply because it's cheaper, matches the 4A-GE plug and built to be mounted in the engine bay.

The problem with using non-standard sensor is having to tell Megasquirt about it. Megasquirt (and i believe all ECU) works by reading the sensor voltage output, convert it to MS readable value using ADC (usually 0-5 volt is converted to a span of 0-255 in binary value) and, in the case of MAP sensor, convert the corresponding ADC value to a certain kPa value based on the lookup table we provided when we burn the firmware to MS CPU. Now you see where the problem lies: MPX4250 may and most likely has different ADC to kPa lookup table with other MAP sensors. In easier terms, the voltage output on MPX4250 when reading, say, 100 kPa, maybe different with other MAP sensors. This also applies when you use Toyota's 4A-GE and 4A-GZE MAP sensor.

The steps in adapting non-standard MAP sensor to your MS are:

1. Find the kPa to voltage characteristics of your MAP sensor. This is usually the hardest part but if you're lucky, the internet is your salvation. Since you're reading this, yes, you got lucky. I will share this later below. You need at least two kPa to volt mapping values, assuming your MAP sensor is linear (most of them are).

2. Using a spreadsheet application, make three colums: ADC, Volt, kPA and fill the rows. Put 0 to 255 under ADC. Under Volt column, put 0 volt next to 0 ADC, 5 volts next to 255 ADC and fill up the rows in between. Each cell is (5/255) volts above the preceding value. Round it to two digits. So directly below 0 volt, this would be 0.02 volt. Below this would be 0.04 volt etc.

3. With the values you obtain in number 1, fill kPa column with the corresponding voltage output. As i said, you need at least two values. Then fill up the rest of the rows by extrapolating. Round to zero digits. Change any value below zero to 100.

4. With MS-1 CPU, you change the lookup table values by altering kpafactor and barofactor inc files. These files will be converted to assembly language when you compile the firmware source and burned to MS when you download the firmware. I'm using MS1-extra code 029y4 and it has two sets of kpafactor-barofactor inc files that you can alter: kpafactor4115.inc-barofactor4115.inc and kpafactor4250.inc-barofactor4250.inc. You can find these files under /src folder on your firmware code files. These files contain the lookup value if you are to use MPX4115 and MPX4250 MAP sensor. Since you are not, choose one set that you will alter. I altered the 4115 set for the 4A-GE MAP sensor and 4250 for the 4A-GZE MAP. There's no way i can use stock MS MAP sensors without reflashing the firmware now.

5. Alter the values in kpafactor inc with the one you have under column kPa on step 3. You need to add "T" next to the values. Some of us don't alter the barofactor inc and get away just fine. I don't really understand the purpose of this file but i think it's only useful if you have barometric correction activated on your MS which requires you to have a second MAP sensor to continuously read the atmospheric pressure. Correct me if i'm wrong. However, if you choose to alter the barofactor as well, the values are simply mapped from the kpafactor using this formula:
100*(1-0.0047*(kpafactor value-100))

6. Compile these files to obtain the altered S19 file. Download to MS and you're done.

7. If you're using Megatune, don't forget to copy the same inc files to /mtCfg folder inside your corresponding project folder. Megatune use the same files to ensure the MAP gauge are showing the same kPa values as read by your MS CPU.

8. Ensure when you turn on your MS, Megatune MAP gauge shows approximately around 100 kPa if you live close to sea level. Any value within 4-5 kPa is fine.

If this sounds too complicated, below is the link to download my inc files to save you from the hassle.

Download link.

Remember, i altered the 4115 set for 4A-GE MAP sensor and 4250 set for 4A-GZE MAP sensor. My 4A-GZE MAP sensor is part number 89421-12110 and i believe Supra's 1JZ/2JZ uses the same sensor. If you're upgrading from a working MAP sensor, i suggest you keep the inc files for the working MAP and alter the other. As always, use the files at your own risk. The values for the lookup table are obtained from the following links (as in, don't blame me if my values are off):
- 4A-GE MAP sensor values are from this link.
- 4A-GZE MAP sensor values are from this link.

Damn, another text-only post. Oh well..

No comments:

Post a Comment