Want to read data from OBD2 Port

Hello,

I am looking to connect to my vehicles OBD2 port (2004 BMW Z4 6 Speed Manual).

I was wondering if I can use an Arduino (Uno R4) to connect to that OBD2 port and read the data off of it while the vehicle is being used.

I'm primarily looking to display my RPM digital light display and calculate the gear ratio to display what gear the vehicle is in.

Thank you for any help!

I think if you Google it, you will find several examples.

If you have an OBD2 scanner, you could watch the engine speed and the vehicle speed in each gear and derive a ratio of RPM / speed for each gear.
For example my old Jeep 5 speed in 5th gear at 1900 RPM is going 50 MPH. 1900 / 50 = 38, so if my RPM / speed < 40 && > 36, I'm in 5th.
In 4th, with RPM 2700 and speed 50 the ratio is 54 and so on.

Thanks, I ended up buying an Uno R4 & this CAN Shield: https://www.microcenter.com/product/655014/inland-ks0411-can-bus-shield.

I was wondering what kind of adapter I should be buying to convert the OBD 2 port to the VGA looking port on the CAN shield. I found some examples on amazon, but some seem to specify RS232 as the serial which is not uart. So wondering if that'll still work, for ex.: Amazon.com: OLLGEN 1.5M 5ft OBD2 OBDII 16 Pin Male to DB9 Serial RS232 Female Port OBD Cable Adapter Diagnostic Extension Cable Connector with Power Switch : Automotive.

I also currently have the Carly OBD scanner.

Thanks

The price of replacing engine ECU is much more than the price of OBD adapter.

Oh, I'm not looking to replace the engine ECU. I'm looking to see what compatible cable I should buy to work with the CAN Shield adapater I linked above.

Thanks!

You're clearly a lot braver and/or automotively savvy than I am. I'd be nervous about interfacing with my 328i's ECU and suspect that's the point @b707 was making?