Skip to: Site menu | Main content

Blog > Talking to an engine management system with ... PHP!

>> Talking to an engine management system with ... PHP!

Mon, Nov 3rd 1:51pm 2008: Tech Toys

I feel a disturbance in the Force, a disturbance created by a million hackers reading the title of this post and crying out "Noooooo! For the love of God, NO!" at once.

But I've done it, and once done it cannot be undone ;-)

Last week I finally received a little ELM327-based dongle that connects to the OBD port in my RX-8 and exposes the vehicle bus as a serial connection via USB. And anyone who has been to one of my conference talks about hardware hacking can guess what comes next!

"ser2net" to expose the serial port as a network socket: check.

PHP script to open a socket connection to that port: check.

Several hours spent figuring out how to talk via CANbus: check.

More hours writing handlers for the hex response values: check.

A loop to poll the EMU once per second: check.

A MySQL database to store response values: check.

A little PHP thing to call Fusion Charts with the result: check.

So now you can see, in 1 second increments, my trip around the block yesterday afternoon. You can see the throttle blip while in neutral, then another blip in reverse to get the car up to 3 - 4 km/h out of the driveway, then the intake air temperature falls rapidly as I drive up the street, etc. What's really interesting is that about 2/3rds of the way along I'm stationery for about 8 seconds waiting at an intersection, and you can see the intake air temp rise almost linearly by about 7 degrees in that time.

See the graph here.