I did that long time ago and this project definitely needs some improvements. This time I used an Aduino Uno, Servo motor and... some unused toilet paper in order to create a finger model. At first, I did it out of cardboard, but servo motors apeared to be too weak to move it properly.
The program takes a middle finger as a reference and calculates the ratio between lines 9-12 and 0-12 (take a look at Hand Landmarks Detection). Needless to say that the hand is seen by computer in 2D.