This inductive sensor can detect metallic objects within 5mm and behaves like a switch that connects to a digital input.