Skip to content

Minimalistic access to OBD2 data with an ELM327 compatible adapter

License

Notifications You must be signed in to change notification settings

huirad/rpi_obd2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rpi_obd2

Minimalistic access to OBD2 data with an ELM327 compatible adapter

Connecting to Bluetooth-OBD on my openSUSE laptop

Useful ELM327 commands

Note: all commands must be terminated by \r (CR). Sending just a CR repeats the last command?!

AT commands

  • ATZ Reset (ATD seems to be a synonym)
    • Most (all?) OBD2 dongles will send a version string as response
  • ATDP Display used protocol (e.g. CAN)
    • Bus connection must be initialized first, e.g. by sending 0100
  • ATE0 Disable character echo (default: ATE1: character echo on)
  • ATL0 Disable sending LF after CR (default: ATL1: LF is sent after CR)
  • ATS0 Disable sending spaces between hex characters (default: ATS1: spaces are sent between hex characters)
    • This command is not supported by my OBD2 dongle (apparently only a cheap ELM327 clone)

OBD2 data access: The first command sent after power up will initialize the bus connection and may take longer. The general command format is where

  • SID is the Service ID (in our case always 01) and
  • PID is the Parameter ID (identifying the parameter to read out)

All commands and responses are coded as 2-digit hex numbers without prefix. The response format is <SID | 0x04>

The following commands may be useful (see also https://en.wikipedia.org/wiki/OBD-II_PIDs)

  • 0100 List supported PIDs in range 01..1F
    • returns 4 bytes as bitmask
  • 0104 Engine load
    • returns 1 byte (A): LOAD_PCT[%] = A*100/255
  • 010C Engine RPM
    • returns 2 bytes (A,B): RPM [1/min] = ((A*256)+B)/4
  • 010D Vehicle Speed
    • returns 1 byte (A): VSS [km/h] = A
  • 0110 Mass Air Flow
    • returns 2 bytes (A,B): MAF [g/s] = ((A*256)+B) / 100
    • not availble on my car
  • 011F Run time since engine start
    • returns 2 bytes (A,B): RUNTIM [s] = (A*256)+B
  • 0146 Ambient air temperature
    • returns 1 byte (A): AAT[°C] = A-40

References

?? https://www.modmypi.com/blog/installing-the-raspberry-pi-nano-bluetooth-dongle ?? http://unix.stackexchange.com/questions/92255/how-do-i-connect-and-send-data-to-a-bluetooth-serial-port-on-linux ?? http://stackoverflow.com/questions/15028953/sending-binary-data-over-bluetooth-rfcomm-spp-converts-0x0a-to-0x0d-0x0a

About

Minimalistic access to OBD2 data with an ELM327 compatible adapter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published