The Cylinder, Threaded - M18 package already includes it for your convenience. When the operating temperature is -25°C~70°C, proximity sensors will work well. Electronic components with pins 4 are available. If you want proximity sensors to perform at their best, you should set their supply voltage to 24V.