obd

obd is a ruby gem that lets you communicate with a car's OBD-II port via an adapter that supports the ELM327 command set. A great choice is the STN1110-based OBD-II UART board from sparkfun (and cable).

Usage

Simply install the gem:

1
gem install obd

And you're ready to roll:

1
2
3
require 'obd' obd = OBD.connect "/dev/tty.obd"

We can send hex commands and get a response:

1
2
obd.send("01 0C") #=> "41 0C 26 0D"

But, that's not very useful. Fortunately, the obd gem will translate the result for us, as well as make it available with a simpler syntax:

1
2
obd[:engine_rpm] #=> "2435.25rpm"

You can also turn off that pesky “Check Engine” light:

1
2
obd.send("4") #=> "OK"

Grab the source code on github.