Detecting orientations with sensors

I'm robotizing my son's RC construction excavator vehicle (added a wireless camera, and wired the controller to an Arduino that is controlled via my computer - currently with a joystick, but will eventually be automated around the house).

The upper cabin of the excavator rotates independently of the wheel base, and I'm trying to track the orientation of the cabin to the wheels via software. I plan to show graphically on the computer how the cabin is rotated in relation to the wheels, as not knowing can be disorienting while driving. Knowing this data would also allow me to, on command, re-center the cabin so its facing the same direction as the wheels.

I have an idea to mount an Arduino on the cabin, and place some RGB color sensors underneath the rotating cabin. Then on top of the wheel base, place a circular color coded sheet. Depending on which color sensor is detecting which colors on the sheet, I should be able to calculate what angle the cabin is rotated.

Does anyone have any alternate suggestions to this idea? Am i just overthinking it here, and there is a much simpler solution out there?

Maybe with a Hall position sensor for zero position and added gear with a rotary encoder.

Isn't a motor or servo under your control responsible for the rotation? If there is gearing, a hole in a gear can be used as an indexing point, and detected by an opto-interruptor.

Hi, @lookitsash1

I my workplace makes a real world version of what you are looking at doing.
I'm not sure how big your RC Excavator is, but we use two inductive pickups doing the same thing as @jremington has suggested.
We mount the sensors so they are separated by 1/4 of the gear teeth pitch, that way you generate a quadrature signal.
Plus a third pickup for reference point.
That we you have turn angle and direction.

Tom... :grinning: :+1: :coffee: :australia: