MEGAsquirt A place to collectively sort out this megasquirt gizmo

Using AFR instead of Volts with AEM Wideband in AFR Target Table

Old 11-11-2008, 02:25 PM
  #1  
Boost Pope
Thread Starter
iTrader: (8)
 
Joe Perez's Avatar
 
Join Date: Sep 2005
Location: Chicago. (The less-murder part.)
Posts: 33,015
Total Cats: 6,587
Default 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:
#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:
#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.

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 }

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 09:37 AM. Reason: Added addendum
Joe Perez is offline  
Old 01-05-2009, 08:22 PM
  #2  
Elite Member
iTrader: (30)
 
levnubhin's Avatar
 
Join Date: Aug 2007
Location: Va Beach
Posts: 7,329
Total Cats: 12
Default

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
levnubhin is offline  
Old 01-05-2009, 08:28 PM
  #3  
N3v
Junior Member
 
N3v's Avatar
 
Join Date: May 2008
Location: Nashville/Knoxville, TN
Posts: 314
Total Cats: 1
Default

you have to do it in \Program Files\MegaSquirt\MegaTune2.25\mxextra\mtcfg too.
N3v is offline  
Old 01-05-2009, 08:44 PM
  #4  
Elite Member
iTrader: (30)
 
levnubhin's Avatar
 
Join Date: Aug 2007
Location: Va Beach
Posts: 7,329
Total Cats: 12
Default

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
levnubhin is offline  
Old 01-05-2009, 08:49 PM
  #5  
Elite Member
iTrader: (5)
 
johndoe's Avatar
 
Join Date: Mar 2007
Location: NYC
Posts: 1,970
Total Cats: 1
Default

well are you sure you didn't skip over table 1 in the ini by accident?
johndoe is offline  
Old 01-05-2009, 08:52 PM
  #6  
Elite Member
iTrader: (30)
 
levnubhin's Avatar
 
Join Date: Aug 2007
Location: Va Beach
Posts: 7,329
Total Cats: 12
Default

Originally Posted by johndoe
well are you sure you didn't skip over table 1 in the ini by accident?
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
levnubhin is offline  
Old 01-05-2009, 09:07 PM
  #7  
Elite Member
iTrader: (5)
 
johndoe's Avatar
 
Join Date: Mar 2007
Location: NYC
Posts: 1,970
Total Cats: 1
Default

wierd. Not to beat a dead horse but your sure you chose aem linear and not non linear? You changed volts to afr? You also have aem linear selected in the configurator? i can't see what else it could be.
johndoe is offline  
Old 01-05-2009, 09:17 PM
  #8  
Elite Member
iTrader: (9)
 
miatamania's Avatar
 
Join Date: Aug 2006
Location: Concord, North Carolina
Posts: 4,160
Total Cats: 6
Default

I was having problems. I have all of my files and version of the high res in Megasquirt/MyStuff file.

I had to change it in the mtcfg file there before it would do anything.
miatamania is offline  
Old 01-05-2009, 09:29 PM
  #9  
Elite Member
iTrader: (30)
 
levnubhin's Avatar
 
Join Date: Aug 2007
Location: Va Beach
Posts: 7,329
Total Cats: 12
Default

Originally Posted by johndoe
wierd. Not to beat a dead horse but your sure you chose aem linear and not non linear? You changed volts to afr? You also have aem linear selected in the configurator? i can't see what else it could be.
Yes, yes and yes.

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
levnubhin is offline  
Old 01-05-2009, 09:43 PM
  #10  
Elite Member
iTrader: (30)
 
levnubhin's Avatar
 
Join Date: Aug 2007
Location: Va Beach
Posts: 7,329
Total Cats: 12
Default

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
levnubhin is offline  
Old 01-05-2009, 10:16 PM
  #11  
Elite Member
iTrader: (3)
 
Mach929's Avatar
 
Join Date: Oct 2004
Location: lansdale PA
Posts: 2,494
Total Cats: 0
Default

i never could get this to work, still can't
Mach929 is offline  
Old 01-05-2009, 10:17 PM
  #12  
Elite Member
iTrader: (30)
 
levnubhin's Avatar
 
Join Date: Aug 2007
Location: Va Beach
Posts: 7,329
Total Cats: 12
Default

Originally Posted by Mach929
i never could get this to work, still can't


Try what I did.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
levnubhin is offline  
Old 01-05-2009, 10:19 PM
  #13  
Elite Member
iTrader: (3)
 
Mach929's Avatar
 
Join Date: Oct 2004
Location: lansdale PA
Posts: 2,494
Total Cats: 0
Default

i don't really understand what you did, where is that file?
Mach929 is offline  
Old 01-05-2009, 10:24 PM
  #14  
Elite Member
iTrader: (30)
 
levnubhin's Avatar
 
Join Date: Aug 2007
Location: Va Beach
Posts: 7,329
Total Cats: 12
Default

Megatune 2.25\mtCfg\msns-extra configuration settings. Look for page 7.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
levnubhin is offline  
Old 01-05-2009, 10:42 PM
  #15  
Elite Member
iTrader: (3)
 
Mach929's Avatar
 
Join Date: Oct 2004
Location: lansdale PA
Posts: 2,494
Total Cats: 0
Default

no worky on my desktop or my laptop, i really don't know what i could be doing wrong, when i tried this months ago i couldn't get it right either
Mach929 is offline  
Old 01-06-2009, 12:03 AM
  #16  
Elite Member
iTrader: (9)
 
miatamania's Avatar
 
Join Date: Aug 2006
Location: Concord, North Carolina
Posts: 4,160
Total Cats: 6
Default

Could be my problem.

My maps/files are in a subfolder...I had to change the mtcfg file in that folder rather than the megatune folder.


If yours is anything like that, try it.
miatamania is offline  
Old 01-06-2009, 12:23 AM
  #17  
Boost Pope
Thread Starter
iTrader: (8)
 
Joe Perez's Avatar
 
Join Date: Sep 2005
Location: Chicago. (The less-murder part.)
Posts: 33,015
Total Cats: 6,587
Default

Originally Posted by N3v
you have to do it in \Program Files\MegaSquirt\MegaTune2.25\mxextra\mtcfg too.
In a typical installation of MegaTune, no such directory exists.

Originally Posted by levnubhin
I got it. I had to make the changes in the msns-extra configuration settings file.
What the hell file were you editing before?



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.
Joe Perez is offline  
Old 01-06-2009, 09:34 AM
  #18  
Elite Member
iTrader: (3)
 
Mach929's Avatar
 
Join Date: Oct 2004
Location: lansdale PA
Posts: 2,494
Total Cats: 0
Default

for sure it doesn't work for me, i give up again
Mach929 is offline  
Old 01-06-2009, 12:36 PM
  #19  
N3v
Junior Member
 
N3v's Avatar
 
Join Date: May 2008
Location: Nashville/Knoxville, TN
Posts: 314
Total Cats: 1
Default

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.
N3v is offline  
Old 01-06-2009, 12:45 PM
  #20  
Elite Member
iTrader: (30)
 
levnubhin's Avatar
 
Join Date: Aug 2007
Location: Va Beach
Posts: 7,329
Total Cats: 12
Default

Originally Posted by N3v
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.
Thats exactly what worked for me.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
levnubhin is offline  

Thread Tools
Search this Thread
Quick Reply: Using AFR instead of Volts with AEM Wideband in AFR Target Table



All times are GMT -4. The time now is 02:57 PM.