MEGAsquirt A place to collectively sort out this megasquirt gizmo

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

Thread Tools
 
Search this Thread
 
Old 11-11-2008 | 03:25 PM
  #1  
Joe Perez's Avatar
Thread Starter
Boost Pope
iTrader: (8)
 
Joined: Sep 2005
Posts: 33,556
Total Cats: 6,933
From: Chicago. (The less-murder part.)
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 10:37 AM. Reason: Added addendum
Old 01-05-2009 | 09:22 PM
  #2  
levnubhin's Avatar
Elite Member
iTrader: (30)
 
Joined: Aug 2007
Posts: 7,329
Total Cats: 12
From: Va Beach
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
Old 01-05-2009 | 09:28 PM
  #3  
N3v's Avatar
N3v
Junior Member
 
Joined: May 2008
Posts: 314
Total Cats: 1
From: Nashville/Knoxville, TN
Default

you have to do it in \Program Files\MegaSquirt\MegaTune2.25\mxextra\mtcfg too.
Old 01-05-2009 | 09:44 PM
  #4  
levnubhin's Avatar
Elite Member
iTrader: (30)
 
Joined: Aug 2007
Posts: 7,329
Total Cats: 12
From: Va Beach
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
Old 01-05-2009 | 09:49 PM
  #5  
johndoe's Avatar
Elite Member
iTrader: (5)
 
Joined: Mar 2007
Posts: 1,970
Total Cats: 1
From: NYC
Default

well are you sure you didn't skip over table 1 in the ini by accident?
Old 01-05-2009 | 09:52 PM
  #6  
levnubhin's Avatar
Elite Member
iTrader: (30)
 
Joined: Aug 2007
Posts: 7,329
Total Cats: 12
From: Va Beach
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
Old 01-05-2009 | 10:07 PM
  #7  
johndoe's Avatar
Elite Member
iTrader: (5)
 
Joined: Mar 2007
Posts: 1,970
Total Cats: 1
From: NYC
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.
Old 01-05-2009 | 10:17 PM
  #8  
miatamania's Avatar
Elite Member
iTrader: (9)
 
Joined: Aug 2006
Posts: 4,160
Total Cats: 6
From: Concord, North Carolina
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.
Old 01-05-2009 | 10:29 PM
  #9  
levnubhin's Avatar
Elite Member
iTrader: (30)
 
Joined: Aug 2007
Posts: 7,329
Total Cats: 12
From: Va Beach
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
Old 01-05-2009 | 10:43 PM
  #10  
levnubhin's Avatar
Elite Member
iTrader: (30)
 
Joined: Aug 2007
Posts: 7,329
Total Cats: 12
From: Va Beach
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
Old 01-05-2009 | 11:16 PM
  #11  
Mach929's Avatar
Elite Member
iTrader: (3)
 
Joined: Oct 2004
Posts: 2,494
Total Cats: 0
From: lansdale PA
Default

i never could get this to work, still can't
Old 01-05-2009 | 11:17 PM
  #12  
levnubhin's Avatar
Elite Member
iTrader: (30)
 
Joined: Aug 2007
Posts: 7,329
Total Cats: 12
From: Va Beach
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
Old 01-05-2009 | 11:19 PM
  #13  
Mach929's Avatar
Elite Member
iTrader: (3)
 
Joined: Oct 2004
Posts: 2,494
Total Cats: 0
From: lansdale PA
Default

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

Megatune 2.25\mtCfg\msns-extra configuration settings. Look for page 7.
__________________
Best Car Insurance | Auto Protection Today | FREE Trade-In Quote
Old 01-05-2009 | 11:42 PM
  #15  
Mach929's Avatar
Elite Member
iTrader: (3)
 
Joined: Oct 2004
Posts: 2,494
Total Cats: 0
From: lansdale PA
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
Old 01-06-2009 | 01:03 AM
  #16  
miatamania's Avatar
Elite Member
iTrader: (9)
 
Joined: Aug 2006
Posts: 4,160
Total Cats: 6
From: Concord, North Carolina
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.
Old 01-06-2009 | 01:23 AM
  #17  
Joe Perez's Avatar
Thread Starter
Boost Pope
iTrader: (8)
 
Joined: Sep 2005
Posts: 33,556
Total Cats: 6,933
From: Chicago. (The less-murder part.)
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.
Old 01-06-2009 | 10:34 AM
  #18  
Mach929's Avatar
Elite Member
iTrader: (3)
 
Joined: Oct 2004
Posts: 2,494
Total Cats: 0
From: lansdale PA
Default

for sure it doesn't work for me, i give up again
Old 01-06-2009 | 01:36 PM
  #19  
N3v's Avatar
N3v
Junior Member
 
Joined: May 2008
Posts: 314
Total Cats: 1
From: Nashville/Knoxville, TN
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.
Old 01-06-2009 | 01:45 PM
  #20  
levnubhin's Avatar
Elite Member
iTrader: (30)
 
Joined: Aug 2007
Posts: 7,329
Total Cats: 12
From: Va Beach
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



All times are GMT -4. The time now is 06:23 AM.