I used a Fairchild H21A1 photo interrupter to clock the spindle for threading (index in Mach3 language). These are very cheap, so I may use these for home/limit switches as well. I found a simple circuit on the web showing how to hookup this sensor. It needs 5v, so I found an old USB cable, cut off the other end and used the red and black wires to supply the power to the H21A1. For the disk, I made an 80mm diameter aluminium disk 2 mm thick, with a 27mm hole for the spindle, and an 8mm gap milled for the infrared light. Luckily I have a larger lathe and CNC mill to make gear for this little one!
Two resistors were required as well. I hooked it up to a multimeter and I get 4 volts between signal wire and ground in the normal state, and .25v when the beam is interrupted with a piece of paper. Looks like this will work fine. I soldered the ground to pin 5 on the input header, and the output to pin 1, then set port and pins in Mach3 - pin 10 and it worked first time! This is the circuit diagram I used. Here is where I found it: Link
Here is a video showing how this works. I do not have variable spindle speed working yet, not even sure if I need this for a mini lathe, but I will work on this later. To see the spindle tacho, I just switched the spindle on, then clicked the Spindle On button in Mach 3 and the speed shows on the DRO. The lathe does also have a hall effect digital tacho with 4 magnets, and the readings agree pretty much perfectly over the whole range, however, the Hall sensor does have a significant lag when speed is changed, Mach3 with my home grown sensor reacts almost instantly.
Well, things worked well with the cheap Chinese controller, but this does not work with the new Gecko G540 box. The Gecko needs 12V, not 5.5V.
I found 3 opto endstops for a 3D Printer on Ebay really cheap. So, I hooked up one of these and used a 12V power supply from an old printer. Worked like a charm!
I have fitted a chiller double fan to the back of the G540 and it has a 12V regulated power supply available, so I ditched the USB power supply in favour of this one.