This is a generic full enclosure for an optical endstop used for a Filament Runout Sensor (FRS) on my Robo 3D printer and the latest Marlin 1.1.0 firmware and RAMPS 1.4 board. Full details are found at link below. However, this is generic and can be used with any printer running RAMPS and a version of Marlin with the filament runout sensor feature enabled. I used pins D20 for ease of setup. I designed this case to fully protect the optical endstop and to make connecting and disconnecting as easy as possible. This is for 1.75 filament, but can be drilled out to us 2.85 mm if wanted. This mod also requires an LCD controller to be able to respond to the prompts for the filament change. You can print via USB, SD card, or other means and the sensor will still work just fine.
Supports are need just for the main body. I printed with the opened part facing up and support needed for the overhang.