Adding PID's

Inquiry and support for Freematics products
Post Reply
Nicholas
Posts: 6
Joined: Mon Mar 28, 2016 8:37 am

Adding PID's

Post by Nicholas »

Hi there,

The obd adapter is working great, no issues and update speed is decent!

Im wanting to add a few extra PID's, basically only fueling. Requested lambda and actual lambda. So if you can guide me on the right track it would be awsome.

I started with defining the PID in the header file: (Fuel–Air commanded equivalence ratio)

#define PID_AIR_FUEL_EQUIV_RATIO 0x44

Then in the source file, i added:

case PID_AIR_FUEL_EQUIV_RATIO:
result = getLargeValue(data) * 2 / 65536;
break;

And obviously in my arduino code i added what was necessary.

Its giving me a value of zero though so im guessing its not supported or what ive done is incorrect.

Please let me know if im on the right path,

Thanks!
Nick
stanley
Site Admin
Posts: 1018
Joined: Sat Mar 01, 2014 3:15 am

Re: Adding PID's

Post by stanley »

Don't divide by 65536 here and divide in function caller.
stanley
Site Admin
Posts: 1018
Joined: Sat Mar 01, 2014 3:15 am

Re: Adding PID's

Post by stanley »

Just added that PID for you. Check out the latest OBD library from github.
Nicholas
Posts: 6
Joined: Mon Mar 28, 2016 8:37 am

Re: Adding PID's

Post by Nicholas »

Thanks so much! Really appreciate it!

Unfortunately its still not working, my car must have a random pid address or something.

I've tried oxygen sensor voltages, oxygen fuel–air equivalence ratio, demanded fuel–air equivalence ratio and none of them are returning any values. Only short term and long term fuel trims are working.

If i log the car with vagcom then all those values are there, (Requested lambda, and actual lambdas). Car is a 2005 Audi 3.2.

If anyone has any info on finding the PID's needed for those values please let me know. Its the main function that i wanted in my logger.

Oh and one more thing, how do i return values for 'C and D' in the PID's?

Thanks for the help Stanley!
Nicholas
Posts: 6
Joined: Mon Mar 28, 2016 8:37 am

Re: Adding PID's

Post by Nicholas »

Ok i got the Lambdas working! :D :D , one lambda is PID 34 and the other 38.

I just made it 'long int' in the source file, and it seems to be working great!

result = (long int)getLargeValue(data) * 200 / 65536;
break;

I still cant get commanded air fuel equiv ratio to work though...but il keep at it.

Also il send some vids and pics of my logger when i get a chance! :mrgreen:
jim_reich
Posts: 4
Joined: Sun May 22, 2016 3:28 pm

Re: Adding PID's

Post by jim_reich »

Great. I'm also playing around with an Audi, and I also have a VAGCOM. I guess you made the result a long int, but what about the PID number? Did you ever try any values over 255? I guess you'd have to get rid of the OR with 0x100? I'd really like to get at some of the NOx sensors up at 491-495 as well as SCR dosing, oil levels, and mileage...
dsmith658
Posts: 7
Joined: Sun Jun 18, 2017 8:05 am

Re: Adding PID's

Post by dsmith658 »

Thanks for posting the solution to this. You saved me a ton of time!
Post Reply