just hotglue glue this spacer and pfte tube together for a good time.
Cheap Optical Encoder / Endstop
here is what the one i used looks like
i used the milky white ptfe tube, the clearer stuff might work too.
i had to add a little peice of electrical tape around the top ir sensor on the green led side to make it shut off. its easy to see it working before gluing it all in place just try with a peice of test filament.
also is a good idea to test this with white filament ... not even sure if clear works with it yet.
well i supose it can be fiddled with but mine gives false reading sometimes. would probably be better to use a mechanical switch instead.
https://www.thingiverse.com/thing:2443425 something like this