Update: see https://www.youmagine.com/designs/improved-filament-run-out-sensor for a better design...
Simplest possible filament out sensor- the filament keeps the switch lever pushed down. When the filament runs out the lever pops up and contacts open/close. You can wire it to a switch input on your printer's controller board to pause the print until you change filament and restart.
The switch fits comfortably into the slot. The screw holds the switch in place. Insert a piece of filament, push the switch into the slot until it clicks, then tighten the screw to hold the switch. Pull the filament out and you should hear the switch click. Put the filament back and the switch should click again. You're done. Wasn't that easy?
The design can easily be adapted to any lever-type microswitch you happen to have handy.
I designed this in two pieces- the main body sits on top of my printer's 1" PIR foam cover. Antirotation spikes keep it from turning. The nut goes on inside the printer enclosure. This device creates only a tiny bit of friction so your extruder should not have any trouble pulling filament through it.
Former electrical engineer, I became a dentist in 2011. I designed and built my printer, Son of MegaMax, using surplus machine parts at the Milwaukee Makerspace.
My newest printer design, Ultra MegaMax Dominator, is a coreXY machine with a 300...