Filament runout detection is something I’ve gone without because I thought it would be harder to implement than it is. The truth is you can do it easily with printed parts and a microswitch worth less than a dollar. This guide takes you through printing, assembly, wiring and firmware setup to get filament runout detection working with a Marlin 3D printer. My Tevo Tornado was easy, as it has a MKS GenL mainboard.
The Ender 3 was a little trickier but ultimately I was able to get it compiled and working using the little known pin 29, retaining pin 27 for the BLtouch. As always, the limitations of the Melzi 1284P board arise but I have included a guide on what Marlin tweaks are needed to get it to compile. If you just want the mid print M600 colour change, then enable the nozzle park and advanced pause but not the filament runout.