I'm developing an mobile app for OBD2 dongle using BLE, but I am facing trouble in getting the battery voltage of the car. Firstly, I am unable to find any specific PID for battery voltage and second I have tried some PIDs which I found on wiki but they are not giving the appropriate data. Also there is some thing called 'Control module voltage' PID: 42, don't know whether this and battery voltage is same or not.
Asked
Active
Viewed 1.0k times
1 Answers
1
First, welcome to StackOverflow!
One thing to keep in mind when working with OBD2 is that implementation of the actual PIDs is completely optional, i.e. it is up to the vendor whether they want to export these values. That said, there are two ways to gather battery voltage:
1.) Via the control command ATRV. This is useful on ELM327 (and compatible) chipsets. Use it like that:
> ATRV
12.8V
2.) As you have found out, via the PID 0142
(control module voltage is supposed to be the same as the battery voltage). Make sure you check 0140
to find out whether it's implemented or not. If so, you will receive two bytes (A and B), which result in the voltage by computing (256A+B) / 1000.

DrMickeyLauer
- 4,455
- 3
- 31
- 67
-
Thank you so much @DrMickeyLauer, for the input. – Harshit Feb 16 '19 at 08:38
-
@DrMickeyLauery Also I want to ask is there any way to calculate Fuel Economy (Instant & Average) from OBD device, I mean is there any PID or command which gives me that or calculations which I can do to get them. – Harshit Feb 16 '19 at 08:43
-
@harshit275 Unfortunately there is no single PID which delivers this. You can compute this yourself, if the car in question provides the relevant PIDs. I don't have the formula offhand, but the key to the calculation is the value from the Mass Air Flow sensor, the Vehicle Speed, and the proper Air/Fuel Ratio of your vehicles fuel type. – DrMickeyLauer Feb 20 '19 at 10:40
-
1@DrMickeyLauer, Thanks for the answer, but control module voltage and battery voltage are not necessarily the same. – aLoneStrider Apr 09 '19 at 20:37
-
@aLoneStrider True. It is usually _in the same league_, but you are right, it is not the same. See also https://mechanics.stackexchange.com/questions/24175/is-control-module-voltage-and-battery-voltage-the-same for some more details. – DrMickeyLauer Aug 08 '21 at 14:48