utc_pyro Posted August 3, 2017 Share Posted August 3, 2017 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. 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 More sharing options...
utc_pyro Posted August 6, 2017 Author Share Posted August 6, 2017 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. Here is the output with baud rate set to 9600: And here is is set at 19200: 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 More sharing options...
sleepydave Posted September 15, 2017 Share Posted September 15, 2017 Brilliant man! Ive been struggling with this myseld. Going to try tapping into the fuel temp sensor, but this is a much more elegant solution! Link to comment Share on other sites More sharing options...
utc_pyro Posted September 16, 2017 Author Share Posted September 16, 2017 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 More sharing options...
sleepydave Posted September 16, 2017 Share Posted September 16, 2017 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 More sharing options...
utc_pyro Posted September 16, 2017 Author Share Posted September 16, 2017 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 More sharing options...
sleepydave Posted September 17, 2017 Share Posted September 17, 2017 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 More sharing options...
utc_pyro Posted May 28, 2018 Author Share Posted May 28, 2018 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 More sharing options...
utc_pyro Posted May 30, 2018 Author Share Posted May 30, 2018 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 More sharing options...
solidxsnake Posted June 6, 2018 Share Posted June 6, 2018 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 More sharing options...
utc_pyro Posted June 6, 2018 Author Share Posted June 6, 2018 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.