Air Fuel Ratio or Lambda

Inquiry and support for Freematics products
Post Reply
patrick_93
Posts: 3
Joined: Mon Sep 17, 2018 1:54 am

Air Fuel Ratio or Lambda

Post by patrick_93 »

Dear All,

I use a freematcs OBD-II UART Adaptor with a Arduino mega and with the telematics shield and it's works fine for indicate the temperature of the coolant, the speed, the rpm...
My car is a BMW 523i, N53B30 engine and this engine use lean phase (with Air Fuel Ratio (or lambda) > 1 to reduce consumption) alternate with phase with lambda = 1.
But I didn't succeed to display the value of the lambda. To do it, I add in the file OBD.h, the lines:
#define PID_OXYGEN_SENSOR_1 0x38

I try several addresses like 0x34, 0x38, 0x24…
And I add in the file OBD.cpp:
case PID_OXYGEN_SENSOR_1:
result = (long int)getLargeValue(data) * 2 / 65536;
break;
In the program.ino, I added:
int AFR; //Unit: Ratio
if (obd.readPID(PID_OXYGEN_SENSOR_1, AFR)){
lcd.print("LAMBDA : ");
lcd.printInt(AFR, 6);
}

On Wikipedia, the lambda is determined with the relation 2/65536(256A+B). I think that the instruction getLargeValue calculate 256A+B.
So the calculation should be correct but on the screen It's display 0 or 1 !!
Do you know how to fix the problem?
One solution could be to use the mode 6. I have a software OBDfacile and I could see the value of lambda on the PC. But I don’t know how to add a PID on the mode 6.
Do you know how to add a PID on the mode 6?
Thanks and Best regards,
Patrick
stanley
Site Admin
Posts: 1018
Joined: Sat Mar 01, 2014 3:15 am

Re: Air Fuel Ratio or Lambda

Post by stanley »

Simply define "result" variable as float
patrick_93
Posts: 3
Joined: Mon Sep 17, 2018 1:54 am

Re: Air Fuel Ratio or Lambda

Post by patrick_93 »

Thanks !
Post Reply