Using AFR instead of Volts with AEM Wideband in AFR Target Table
#1
Thread Starter
Boost Pope
iTrader: (8)
Joined: Sep 2005
Posts: 33,556
Total Cats: 6,933
From: Chicago. (The less-murder part.)
Using AFR instead of Volts with AEM Wideband in AFR Target Table
This has been posted before, but comes up often. So I'm putting all the info in one place and adding it to the Super Important sticky.
By default, if you select "AEM Linear" in the MegaTune Configurator, your AFR Targets table is scaled to volts, and you must reference the AEM documentation to find the correct values. You can change this so that your AFR Targets table is scaled properly in AFM instead.
First, go into the \Program Files\MegaSquirt\MegaTune2.25\mtCfg\ directory, and open the file msns-extra.ini in notepad.
2015 curly edit: For TS, you'll want to open you TS project folder\projectCfg\mainController
Scroll down until you come to a section labeled
page = 7 ; TARGET AFR table 1 BINS FOR VE 1 (First find which sensor used)
This is to ensure that we're altering AFR Target Table 1, which for most folks is the only one in use.
Look for the following lines in that section:
The next time you open MegaTune and look at your AFR Targets table, you'll find that it is scaled in AFR rather than Volts. The contents of the table will be garbage so if you already had values in here you'll need to re-create them, but from now on you can work in meaningful units.
Now, a lot of folks have reported problems with the default calibration, in that it can be a few tenths out in terms of the MS agreeing with the AEM. It seems that there is some variance from one AEM unit to the next. If you find yourself in this group, you can correct it by opening up the file file "lambdasensors.ini" which you'll find in the same directory as before. Locate the following section, and note that I've highlighted a certain pair of values in red:
To alter the calibration, you need to change the 9.72s to something else. And this, sadly, is where the fudge factor comes into play. Some people have reported success in scaling the value up (to 10, for example) others report needing to insert lower values (9.5, in one instance). You're going to have to play with it and see what works. Just turn off EGO correction and eyeball the laptop display vs. the gauge at idle. Find a value that works for you.
Sources cited in compiling this info:
forums.plastikracing.net :: View topic - MegaSquirt Tips and Tricks
forums.plastikracing.net :: View topic - Fixed algorithm in Megatune for the AEM UEGO
MiataTurbo.net :: View Topic - For those using AEM Linear with MS
Addendum:
A lot of folks have been reporting trouble with this. It seems that all these folks have non-standard Megatune installs, wherein there are multiple copies of the msns-extra.ini file in various locations.
If this is you, then you need the find the one that's actually important. My guess is that if, when you open MegaTune you are presented with the "Select a Project" window, then you need to edit the copy of msns-extra.ini in the appropriate Project folder, and not the main one.
As an example, I installed the MSPnP software package, and I now have six project folders, two each (with and without AFM) for 9093, 9495, and 9697. If I edit the one in C:\Program Files\MegaSquirt\MSPNP MM9093 without AFM then I see AFR as units when I start MegaTune and select that project, but if at startup I select the "MSPNP MM9093 with AFM" project, I see units in volts.
So check that.
By default, if you select "AEM Linear" in the MegaTune Configurator, your AFR Targets table is scaled to volts, and you must reference the AEM documentation to find the correct values. You can change this so that your AFR Targets table is scaled properly in AFM instead.
First, go into the \Program Files\MegaSquirt\MegaTune2.25\mtCfg\ directory, and open the file msns-extra.ini in notepad.
2015 curly edit: For TS, you'll want to open you TS project folder\projectCfg\mainController
Scroll down until you come to a section labeled
page = 7 ; TARGET AFR table 1 BINS FOR VE 1 (First find which sensor used)
This is to ensure that we're altering AFR Target Table 1, which for most folks is the only one in use.
Look for the following lines in that section:
#elif AEM_LINEAR
afrBins1 = array, U08, 0, [8x8], "Volts", 0.0196, 0, 0.0, 5.0, 2
You want to make the following changes, which I've highlighted in red:afrBins1 = array, U08, 0, [8x8], "Volts", 0.0196, 0, 0.0, 5.0, 2
#elif AEM_LINEAR
afrBins1 = array, U08, 0, [8x8], "AFR", 0.038666, 255.0, 10.0, 20.0, 1
If you wish, you can just copy and paste the second line into your file. afrBins1 = array, U08, 0, [8x8], "AFR", 0.038666, 255.0, 10.0, 20.0, 1
The next time you open MegaTune and look at your AFR Targets table, you'll find that it is scaled in AFR rather than Volts. The contents of the table will be garbage so if you already had values in here you'll need to re-create them, but from now on you can work in meaningful units.
Now, a lot of folks have reported problems with the default calibration, in that it can be a few tenths out in terms of the MS agreeing with the AEM. It seems that there is some variance from one AEM unit to the next. If you find yourself in this group, you can correct it by opening up the file file "lambdasensors.ini" which you'll find in the same directory as before. Locate the following section, and note that I've highlighted a certain pair of values in red:
#elif AEM_LINEAR
afr = { 9.72 + egoADC * 0.038666 }
lambda = { afr / 14.7 }
TargetAFR = { 9.72 + afrtarget * 0.038666 }
TargetLambda = { TargetAFR / 14.7 }
afr = { 9.72 + egoADC * 0.038666 }
lambda = { afr / 14.7 }
TargetAFR = { 9.72 + afrtarget * 0.038666 }
TargetLambda = { TargetAFR / 14.7 }
To alter the calibration, you need to change the 9.72s to something else. And this, sadly, is where the fudge factor comes into play. Some people have reported success in scaling the value up (to 10, for example) others report needing to insert lower values (9.5, in one instance). You're going to have to play with it and see what works. Just turn off EGO correction and eyeball the laptop display vs. the gauge at idle. Find a value that works for you.
Sources cited in compiling this info:
forums.plastikracing.net :: View topic - MegaSquirt Tips and Tricks
forums.plastikracing.net :: View topic - Fixed algorithm in Megatune for the AEM UEGO
MiataTurbo.net :: View Topic - For those using AEM Linear with MS
Addendum:
A lot of folks have been reporting trouble with this. It seems that all these folks have non-standard Megatune installs, wherein there are multiple copies of the msns-extra.ini file in various locations.
If this is you, then you need the find the one that's actually important. My guess is that if, when you open MegaTune you are presented with the "Select a Project" window, then you need to edit the copy of msns-extra.ini in the appropriate Project folder, and not the main one.
As an example, I installed the MSPnP software package, and I now have six project folders, two each (with and without AFM) for 9093, 9495, and 9697. If I edit the one in C:\Program Files\MegaSquirt\MSPNP MM9093 without AFM then I see AFR as units when I start MegaTune and select that project, but if at startup I select the "MSPNP MM9093 with AFM" project, I see units in volts.
So check that.
Last edited by curly; 03-02-2015 at 10:37 AM. Reason: Added addendum
#2
I followed your exact instructions and my table still comes up with volts. Is there anything else that should be done?
Thanks.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
Thanks.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
#4
Do not see that anywhere. I just noticed that after doing what Joe says my AFR targets for VE table 3 is in ARF, but targets for table 1 still reads volts.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
#6
Edit:
Nope, says "page = 7 ; TARGET AFR table 1 BINS FOR VE 1 (First find which sensor used)
"
Right above where I made the changes.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
Nope, says "page = 7 ; TARGET AFR table 1 BINS FOR VE 1 (First find which sensor used)
"
Right above where I made the changes.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
#9
page = 7 ; TARGET AFR table 1 BINS FOR VE 1 (First find which sensor used)
#if NARROW_BAND_EGO
afrBins1 = array, U08, 0, [8x8], "Volts", 0.0196, 0, 0.0, 5.0, 2
#elif WB_1_0_LINEAR
afrBins1 = array, U08, 0, [8x8], "Volts", 0.0196, 0, 0.0, 5.0, 2
#elif WB_UNKNOWN
afrBins1 = array, U08, 0, [8x8], "Volts", 0.0196, 0, 0.0, 5.0, 2
#elif AEM_LINEAR
afrBins1 = array, U08, 0, [8x8], "AFR", 0.038666, 255.0, 10.0, 20.0, 1
#elif AEM_NON_LINEAR
afrBins1 = array, U08, 0, [8x8], "Volts", 0.0196, 0, 0.0, 5
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
#10
I got it. I had to make the changes in the msns-extra configuration settings file.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
#12
#14
Megatune 2.25\mtCfg\msns-extra configuration settings. Look for page 7.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
#17
Thread Starter
Boost Pope
iTrader: (8)
Joined: Sep 2005
Posts: 33,556
Total Cats: 6,933
From: Chicago. (The less-murder part.)
Originally Posted by levnubhin
I got it. I had to make the changes in the msns-extra configuration settings file.
Everyone, this is being made out to be more complex than it is.
Assuming you already have your AEM sensor working and being correctly read by the MS, there is only one file that you need to edit. Assuming your MT directory structure is "normal", that file is located in:
C:\Program Files\MegaSquirt\MegaTune2.25\mtCfg\
Note that it does not matter what version of code you are using, or where your car-specific config files are stored. This is a global setting for all of MegaTune, and global settings are stored in \mtCfg\.
The name of the file is msns-extra.ini.
Open it in notepad.
Scroll down until you come to a section labeled
page = 7 ; TARGET AFR table 1 BINS FOR VE 1 (First find which sensor used)
Then find the entry for #elif AEM_LINEAR and make the changes.
That is all.
#19
sorry I didn't have the directory right at hand, I only have MS installed on my laptop. Changing stuff in the directory you specified first showed only volts, then I poked around and found a similar ini file in Megatune2.25\mtCfg\msns-extra, and after I did the same changes to it, it worked.
#20
sorry I didn't have the directory right at hand, I only have MS installed on my laptop. Changing stuff in the directory you specified first showed only volts, then I poked around and found a similar ini file in Megatune2.25\mtCfg\msns-extra, and after I did the same changes to it, it worked.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote