I seek suggestions for type/method of sensor for measuring the vertical position of a 6mm rod that moves vertically over a 25mm range. The rod moves fairly rapidly (~150mm per second) to a midpoint position, remains fixed for a second and then rapidly fall. It will rest at its lowest position for 10-15 seconds before repeating. The midpoint position will vary slightly ( a few millimetres) and the goal is to determine that variance. Physical space is limited - the entire printed circuit board will be about 22mm wide and about 75mm high, The shaft and circuitry must fit within these dimensions. While initial tests will use a Arduino board connected by wires, the design will eventually move to an on-board battery powered AVR ATtiny84.
Currently, the rod is round but I have considered switching to a square shaft and drilling holes for an optical sensor. However, position determination would probably be too coarse as drilling the holes would necessitate them being several millimetres apart. I have also considered painting alternating white/black lines around the rod and using a reflective optical sensor but I am concerned that an Arduino connected reflective optical sensor might not be able to reliably track given the ~150mm per second movements.
I considered inductive proximity sensors but power requirements and cost make them prohibitive. Space limitations prohibit some other types of sensors, such as ultrasonic.
Currently, I am considering a SS49E Hall Effect transistor mounted on the PCB and a small round magnet glued to the top of the rod. From what I have seen in YouTube videos of 49E tests, it appears that it provide a usable voltage reference. I don't need to measure anything but the voltage value when the rod is at its midpoint one-second stay.