The aim of the project is to make the microscope smart. That is, it will refocus automatically depending on what you want to look at. It will do this by detecting your eyes trying to refocus, which occurs subconsciously. So, it's almost like a connection to one's mind.
The neat thing about this project is that the technique can be applied to a variety of devices, not just microscopes. Also, there is another closely related idea, which I don't plan to do now: by sensing the direction the eye is looking to, it is possible to shift the microscope laterally, kinda autoscrolling.
I plan to put a sensor into an eyepiece of my microscope. The sensor is to detect the focusing state of the eye, and based on that an Arduino will drive a stepper motor attached to the focusing wheel of the microscope.
The sensor is to be based on red-eye effect. Consider an LED shining into an eye. If the eye is focused, a small area of retina corresponding to the optical image of the LED will be illuminated. That area acts as a secondary light source, bouncing some light back out of the eye and focusing it almost exactly back into the LED. This return light, the red-eye light, can be intercepted by placing a semitransparent mirror in the path.
If the eye is not focused on the LED, a) the image will blur, reducing its intensity, b) the image won't be refocused on the detector, reducing the signal even more.
Next step is to quickly sweep the focusing back and forth, in a search for a peak of the red-eye effect, indicating the focused position. The easiest way to do it is to move the LED-photodiode structure back and forth, since the eye focusing range collapses into mere 5 mm when it is behind a strong lens of the eyepiece.