Inductive sensors are great for sensing metals. Thats why this guy is used in almost every instance of 3D Printing Autobed Leveling.
But its not only reserved for this. You could use this for triggering all sorts of things using an MCU such as an Arduino or ESP Units.
Simply place the metals near its orange tip and it will send a positive voltage out the signal pin relative to the input voltage of the device.
This sensor is a smaller version of this sensor:
But the specifications are identical.
Voltage: DC 6-36V
Detection distance: 4mm - Please bare in mind that the lower the voltage, the closer the detection distance will become and vice versa for higher voltages.
Output current: 300mA
Ouput Status: Normally Open
Response frequency: DC:0.5kHz AC:25Hz
Pin Outs vs Wire Colours:
Brown = Positive
Blue = Negative
Black = Signal
Cable length: 1.2m