Inductive Sensor NPN TL-W5MC1 above 5v

I bought some units of the TL-W5MC1 to use with my Arduino

Specification:

1.Product Name:Proximity Switch
2.Type:DC 3-wire NPN NO
3.Theory:Inductance Sensor
4.Output:Switching Transducer
5.Sensing Distance:5mm±10%
6.Sensing Object:Metal
7.Sensing Object:Iron 18x18x1mm
8.Rated Voltage:DC 6-36V
9.Rated Current:200mA

As my cnc structure is made of aluminum, I did some tests and saw that it detects between 2 ~ 3mm instead of 5mm when the material is iron.

If I use 12v or 24v the distance is a little longer than 6v for example. So I would like to use them with 24v, but the black cable responsible for the signal will burn (if not in hours, it will be in days/months) my arduino

How do I do to be able to connect the sensor to the pins of the limit switches? using the resistors?

They have open collector outputs. Connect the sensor output to an Arduino pin configured as INPUT_PULLUP. Connect the ground of the sensor to the ground of the Arduino.

Also to be absolutely safe you can add a signal diode in series with the sensor so it can only pull down.

Use physical 2k2 pull-up resistors to 5V on the Arduino, not the built-in pullups, as you need a strong pullup in an electrically noisy environment with long wiring looms carrying stepper motor and limit-switch wiring together.