How to hack OBD-II to measure steering angle of a CAR?

I am trying to find a definitive way of measuring steering angle of a car, The subject car is equipped with power steering and has adaptive cruise control so I believe it will have the ability to be manipulated via OBD-II port and capture real time steering angle capturing, Also I currently am in possession of an ESP32 microcontroller so I was thinking how can I first connect to the car's micro controller and read and filter data to find the steering angle?

I am aware of this being on of the hardest challenge and also am aware of it being the hardest to manipulate. I would love any guidance/help from the community as there is almost to no literature on the web for the same.

I moved your topic to an appropriate forum category @noorchauhan.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Cruise control is for speed regulation, steering is for steering. I don't see the connection.

1 Like

I bought an OBD reader, did poke around in a suggested library and code. I don't remember any steering parameter being read. At the tablet for now and all stuff mentioned sits iles away.....

It is beyond the capabilities of most OBD readers I know and I think this involves a bit of reverse engineering:

There's this youtube video I found but no code explanation mentioned anywhere, you can check the video here: https://youtu.be/nzKzee-Mhnc?si=zpYrDI51nrXpEE7X

any ideas how the code was implemented / manipulated?

That would be in the documentation for OBD-II for that self driving car. Are you using the same car?

No it is not a self driving car, it is a normal car, I am trying to capture steering angle for a dataset manipulation use case

Then find a video that does that for a normal car. Do you have documentation for the car in question? If not, why not start there.

1 Like

see that is the issue, the web has almost to no points for the same, the hardware is not even a problem, if we tinker around we can find out how to manipulate the same. The documentation here in my country does not specify the customer these things

Ok, then look at it from the other end. DO any of the commercial OBD-II devices show the steering angle of the car?

1 Like

A long shot, a complete guess.... Suppose You can get the ABS wheel sensors values and calculate a steering angle out of the small difference in the valus?
In a curve the wheels rotate at slightly different speeds.

I know almost nothing about OBD...

But I got a reader for when the "check engine" light comes-on. The codes are different for different cars so I have to assume all cars (or all manufacturers) use different codes for everything.

And I'm pretty sure that my 2004 Honda doesn't have a steering angle sensor...

Even with a self-driving car it doesn't seem essential. I don't know the steering angle when I drive... I just need to know when to turn and if I'm headed in the right direction and correct left or right, which way to turn, and if I've turned too-far or not far enough.

I asked a friend who loves messing with cars about this: he told me it's so the ABS can tell the difference between wheels turning at different speeds as a result steering or turning at different speeds because of skidding etc.

1 Like

Maybe a good place to start…

Reading the angle is likely not an issue. I have an Audi and I was able to read al sorts of data, even the brake pressure (in real time).

However I don't think it is possible to modify the parameters in real time and from the OBD-II port. We used to do a lot of testing with the Automotive OE's. They had devices to read and display in real time, however they needed to stop and enter some options then their connected device would "upload" the new variables. Things may have changed but likely its not possible.
We also had a gearhead working for us who was into "chipping" cars. He claimed he could change things like the function of the middle button on my key remote. But this required replacing the program chip in the ECU with a modified one.

Curious, what parameters are you considering changing on the fly?

I am trying to capture data [ corresponding steering angle with images] to feed into my Convolutional Neural Network and then I was guessing if I can send three types of commands to the steering i.e left, right or center [no change] to the steering motor of the car. This has almost to no literature on the web and I guess only community can help me here. It is a simple steering angle prediction project.

From my experience that information is not normally part of the OBDII but may be available from the dealer or OEM (Original Equipment Manufacturer) modes. Before burning a lot of time I recommend you find out if it is in fact on your car and how to access it. Also read the following as you are getting into a very dirty electrical system.
There is a good app note AN2689 by ST on automotive electronics. reading it will help you a lot.
https://www.st.com/resource/en/application_note/cd00181783-protection-of-automotive-electronics-from-electrical-hazards-guidelines-for-design-and-component-selection-stmicroelectronics.pdf
Also take a look at this: Distilled Automotive Electronics Design | Analog Devices and then there is this one.
Transient Voltage Suppression in Automotive Applications

I'm going to guess the OE's have made it really really difficult to change the steering angle remotely. Their goal is to make this impossible due to safety issues.

Every part and every programmable function goes through a FMEA (failure modes and effects analysis). What you are attempting to do is definitely a failure mode for the "normal" driver.

So it turns out it is possible to calculate the steering angle of the car but to manipulate the steering wheel I need to find alternative method [ probably some external device ] to manipulate the steering according to the angle. I think so it is possible to manipulate the CAN bus and reverse engineer it to send control commands if it is electrically wired to do so. Thanks @JohnRob & @gilshultz for the safety guidance.

Any Ideas on manipulating the steering angle using a external motor? I am thinking about how can I possibly tell the motor to spin specific rotations so that the the steering angle is achieved desiarably, it is hard when thinking to power using external sources

Also this guy's comment section says something about seeed code to calculate the steering angle, any clue whats that about?:
https://youtu.be/nzKzee-Mhnc?si=zpYrDI51nrXpEE7X

It appears you want to build an electronic power steering unit. I have been involved with electronic power steering and know many of the pitfalls. There is also the huge liability factor. It took several years for a team to get the first prototypes to actually work. This will require basically a ground up design of the steering system and its components. For NDA (Non Disclosure Agreements) and liability reasons I am backing out of this project.