Single track Gray codes is totally new for me. Very interesting, Thanks!
The valve opening position feedback is not high precision 0-100% in 5% steps
So that's just 20 steps ?
I found some higher precision examples
This one is an encoder disk for 9 sensors, equal spaced 360 steps, so each sensor need to be 40°, That's impressive for 1° absolute resolve.
https://www.thingiverse.com/thing:4590077but I personally prefer the other solutions with sensors more packed, as they can fit into a ~ half circle (slightly less than 180°, as N+1 fits into 180° )
That allows more practical construction, and also support linear track sense.
Here is a nice built solution of
60 step, Six sensors, on a 30 degree pitch (150° total ) https://www.instructables.com/Absolute-Position-Encoder-With-Single-Track-Gray-C/They used reflective optos there, which are cheap and easy to source and mount.
The track code as ASCII string is
'000000000000111000000110000001111111111111000111111001111110'Makes me wonder if it's possible to use a Hall-Effect Sensor?
There are magnetic angular sensors, but they usually rely on the magnet being above the centre of the sensor.
You could get that with gears.
There are also commercial linear track magnetic absolute sensors, quite clever, but not low cost.
There are magnetic sensors like TLV493D-A1B6, that give 3 axis raw readings over i2c, so
maybe that's enough to sense say 8? tiny magnets of varying orientations spaced around a circular disk on your axle ?
It would not be very linear, but you just need it to be monotonic.