I presume the "arm" is made of metal. I would suggest using inductive proximity sensor(s). Try starting out here (https://www.digikey.ca/en/products/filter/proximity-sensors/524?s=N4IgjCBcpgbFoDGUBmBDANgZwKYBoQB7KAbRAGZzZZyAWEAy6sABhAF0CAHAFyhADKPAE4BLAHYBzEAF85QA )
You could get away with one and use a divide by 2 circuit but you need to be able to initialise the system and you need to be sure that you don't get multiple edges as the metal moves past the sensor.
It would be better to use two proximity sensors close to each other. Depending which sensor becomes active first would let you know the direction of motion. If you use a micro, then it is simple enough to do this in software. But it is not difficult to do in logic hardware. I would suggest driving a Set/Reset latch, set from one sensor and reset from the other. You would then need a method of holding the latch when both are active, and a delay when either or both go inactive. (just thinking aloud). Also you would need to consider if the edges will have multiple transitions.
This is a simple implementation of a "quadrature encoder". You can Google it.