Jump to content
LegacyGT.com

Hardware AEM Wideband Failsafe Gauge to Logging Adapter


utc_pyro

Recommended Posts

If any of you have ever looked into the AEM Wideband failsafe, it's an impressive peace of kit that can save your bacon. This is especially true on Subarus that run open loop while in boost, if there is something causing you to go lean while under boost the ECU will never know!

 

The glaring issue with this thing is it doesn't support legacy logging platforms like RomRaider, Accesstuner, or BTssm. It doesn't have a serial output like the old UEGO's did, instead it uses a proprietary USB communications method. There is a bridge program out there, but it requires a lot of fussing to set up.

 

I noticed that it had a CANBUS interface with a published message format. So instead of dealing with the bridge, bought a generic MCP2515 board and Sparkfun ProMicro clone to build a canbus to legacy UEGO converter. Total cost of maybe $15.

 

0d34c9dfaaa92fe147af41fbd702db05.jpg

 

This will work on both RomRaider on my laptop and BTSSM on the S5 embedded in the cubby door. Additionally it has an audible beeper alarm for any time the failsafe trips.

 

// This converts AEM Wideband AEMnet messages to serial for logging application to read.
// This will output ether Lamba or AFR depending on the USB host requested speed.
// Credit to coryjfowler and his MCP_CAN libary

#include <mcp_can.h>
#include <SPI.h>

long unsigned int rxId;
unsigned char len = 0;
unsigned char rxBuf[8];
unsigned int raw_LAMBA;
long unsigned int baud;
int alarm;
float LAMBA;
float AFR;

#define CAN0_INT 10                              // Set INT to pin 18
#define buzzer 2
MCP_CAN CAN0(21);                               // Set CS to pin 10


void setup()
{
 Serial.begin(9600);
 // Initialize MCP2515 running at 8MHz with a baudrate of 500kb/s and the masks and filters disabled.
 // Filters would be more efficient, but for a single application process like this the hardware is already overkill
 if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ) == CAN_OK)
   Serial.println("MCP2515 Initialized Successfully!");
 else
   Serial.println("Error Initializing MCP2515...");


 CAN0.setMode(MCP_NORMAL);                     // Set operation mode to normal so the MCP2515 sends acks to received data.

 pinMode(CAN0_INT, INPUT);                            // Configuring pin for /INT input

 pinMode(buzzer, OUTPUT);

 Serial.println("Starting wideband emulation:");
}

void loop()
{
 if(!digitalRead(CAN0_INT))                         // If CAN0_INT pin is low, read receive buffer
 {
   CAN0.readMsgBuf(&rxId, &len, rxBuf);             // Read data: len = data length, buf = data byte(s)


   if(rxId == 0x80000026)                           // ID of the only message we really care about
   {
     raw_LAMBA = (rxBuf[0] << 8) | rxBuf[1];        // Combine bits...
     LAMBA = raw_LAMBA * 0.0001 + 0.02;          // Scaling
     AFR = raw_LAMBA * 0.00147;                     // Scaling. Note: In the NASCAR spec manual they state they referance 14.65:1 as lamba for gas, may need to adjust this (AFR/10000 = scalar)
     baud = Serial.baud();                          // Check USB host requested baud rate

     //If in failsafe mode, sound alarm
     if((rxBuf[7] & 0x80) == 0x80)
         digitalWrite(buzzer, HIGH);
     else
         digitalWrite(buzzer, LOW);

     //Output AFR or Lamba to USB -> Serial for logging
     if(baud == 9600)
         Serial.println(AFR, 3);  
     else if(baud == 19200)
     {
         Serial.print(LAMBA, 3);
         Serial.print("\t");
         Serial.print("Ready");
         Serial.print("\t");
         Serial.print("No-errors");
         Serial.print("\r");
     }
   }
 }
}

 

It works on the bench, need the car back to see how it'll work in reality.

Link to comment
Share on other sites

I depinned the MCP and Pro Micro tonight an repacked everything for installation. The gap between the boards and wires is filled with high temperature hot glue and the whole thing encased in clear heatshrink. It pulls less than 0.1 A @5v peak so there aren't any issues leaving it USB powered.

 

module.thumb.jpg.88e6f8b7956c9deb69c47a8376db79ef.jpg

 

Here is the output with baud rate set to 9600:

 

afr.JPG.73a6b5fc32c2e095de5df45eeee8f8a5.JPG

 

And here is is set at 19200:

 

lamba.JPG.5181abc0cbc318fcd4a97ce567065c39.JPG

 

Looking at the RomRaider source code it looks like you could just toss the lamba with a carriage return at it and it'd know what was going on, but I wanted to maintain compatibility with any other logging programs that might know how to talk to that speed.

Link to comment
Share on other sites

  • 1 month later...

If you want to make your own here are some additional details.

 

BOM:

NiRen MCP2515_CAN

Arduino Pro Micro (5V)

JST Pins for AEM harness (SPUD-001T-P0.5 x2)

Generic 5V buzzer

 

The MCP2515 board is pretty much ready to go, just close J1 to enable the terminating resistor. As long as your wiring isn't more then ~1M, you don't need one on each side.

 

The buzzer is optional, put it between P2 and GND if you want to use it. It beeps when the failsafe trips.

 

If you use my code verbatim, connect the module like this:

 

Pro Micro 	 MCP2515
P10 	————>	 CS	
P16	————>	 SCK
P14	————>	 SO	
P15	————>	 SCK
A0	————>	 INT
VCC	————>	 VCC
GND	————>	 GND

 

INT and SC are defined in the code, so you can move them around if needed.

 

Edit

For the sake of people running across this on Google, this will let RomRaider, EvoScan, or Accesstuner Race log the AEM Wideband Failsafe (30-4900) or Fled Fuel Wideband Failsafe (30-4910 or 30-4911).

Link to comment
Share on other sites

Im not very electronically minded (the coding end is up my alley though), but I may give this a shot in the name of learning anyways haha.

 

Just to clarify, this takes the output wire (white) from the failsafe and allows you to connect to via mini usb (converter side) to standard usb (laptop side)? And then accesstuner would pick it up via a com port?

 

I have a pretty janky (sub $30) soldering iron, I imagine I'll need something a bit nicer to make this work properly?

 

Sorry for the rudimentary questions, but this does seem like a project I would like to undertake!

Link to comment
Share on other sites

Just to clarify, this takes the output wire (white) from the failsafe and allows you to connect to via mini usb (converter side) to standard usb (laptop side)? And then accesstuner would pick it up via a com port?

 

Close. You're adding two pins to the harness to hook up to AEMnet or CAN Bus. See the AEMnet Harness 30-3439 Instruction here for how to add the pins.

 

These two connections are wired to the MCP2515. The MCP2515 converts that to SPI bus, then the Arduino converts that to a com port over USB for your logging software to read.

 

I have a pretty janky (sub $30) soldering iron, I imagine I'll need something a bit nicer to make this work properly?

 

Sorry for the rudimentary questions, but this does seem like a project I would like to undertake!

 

Nope, that'll get the job done. This is basic through hole stuff, you could do it with a 150W soldering gun or a propane torch if you were careful enough. If you've done some coding and want to learn about electronics this would be a good starter project. It's more software than hardware, so fairly straight forward.

Link to comment
Share on other sites

Close. You're adding two pins to the harness to hook up to AEMnet or CAN Bus. See the AEMnet Harness 30-3439 Instruction here for how to add the pins.

 

These two connections are wired to the MCP2515. The MCP2515 converts that to SPI bus, then the Arduino converts that to a com port over USB for your logging software to read.

 

 

 

Nope, that'll get the job done. This is basic through hole stuff, you could do it with a 150W soldering gun or a propane torch if you were careful enough. If you've done some coding and want to learn about electronics this would be a good starter project. It's more software than hardware, so fairly straight forward.

 

Very nice, I follow you now. I was wondering if that aem net stuff served a purpose without other guages to daisy chain too, and indeed it does. I had it pegged as sort of a defi link type thing that would only really apply to aem ems.

Good news on the lack of a need for a better iron too!

Link to comment
Share on other sites

  • 8 months later...

IMG_5983.thumb.JPG.d7faa520c6bd58e23d40937332572df5.JPG

 

Just an update: this is intact working with BTSSM in my car now. I had to add a Prolific USB-serial converter though as BTSSM couldn’t talk to the Arduino Pro Mini or the FT232RL on the Arduino Nano.

 

AEM gauge is also reading ~0.25 rich from the front wideband. Not sure what’s Up with that, but it could explain my crap gas mileage.

Link to comment
Share on other sites

Update on gauge accuracy: AEM support says this gauge reads 14.4 stoich, so everything appears to be working fine. Waiting to hear back what the correct Lamba to AFR transfer function is and the code will be updated so the readings match the stock sensor.
Link to comment
Share on other sites

Update on gauge accuracy: AEM support says this gauge reads 14.4 stoich, so everything appears to be working fine. Waiting to hear back what the correct Lamba to AFR transfer function is and the code will be updated so the readings match the stock sensor.

 

 

Stoich for E10 is actually 14.13 or so. Why not just stick to lambda (for both sensors)?

Link to comment
Share on other sites

Stoich for E10 is actually 14.13 or so. Why not just stick to lambda (for both sensors)?

 

AFR is just a fake number anyway, O2 sensors only read lambda and the logging software applies a fake AFR to it. ECU also thinks in Lambda, the definitions just convert it to AFR.

 

In the case of the AEM sensor, it's actually reporting lambda wrong. This is true on both the gauge, and the value output on AEMNet. Per tech support it's a known issue with no fix. They said offset is constant so add 0.01 to my code for accurate logs, but 0.02 is a closer match.

 

I've set that gauge up to show boost as a number, and AFR on the LED graph. Thus it's not accurate enough to see the offset anyway, and my program applies the Lambda offset so BTSSM shows the corrected numeric value.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

Terms of Use