Q:

Simplest way to connect a proximity sensor to a PC

I want to interface a PC with a proximity sensor. The one I've been thinking about is this one.
I can see that the output is "NPN, 3 wire, NO" which I'm kind of unfamiliar with. I also see it outputs a signal of 300 mA. Will a 4-20 mA analog input be fried if I connect this one? Could some input relay (if they exist) be the most appropriate solution here? An RS232 connection would be optimal.
As you can see, I'm not an electronics expert. If you have other simpler suggestions for proximity control with a PC I'm all ears :)

A:

To use this sensor, connect ground and power (6..36V). The third wire will be connected to ground when something is detected, otherwise it will be floating.
Note that it does not output 300 mA, that figure is the maximum current it can handle (sink to ground).
If you have a 4-20mA input you could use a resistor to supply 20mA to it, and use the output wire to ground the 4-20mA input to ground, so it will get 0 mA (or at least a good deal less than 20) when the sensor detects something.
You could use a serial port if you know how to read a handshake signal in your programming language.

A:

That 6 V is a nuisance, but we'll have to live with it. A typical way to interface a logic signal like the sensor outputs is to send the data over USB to the PC. This is easy with boards like this one:  

This only needs a USB connection and you have 8 logic level inputs and outputs. Handy, because you'll often use more sensors, or outputs from the PC.
Unfortunately USB is 5 V, so you'll have to use a separate power supply to feed the sensor. The easiest here is a 12 V wall wart.

The sensor with the NPN mentioned in the spec is drawn at the left, with power supply and the open-collector output. An open-collector allows to connect the output to a different voltage than the power supply, which we'll do here. Connect a 4 kΩ pull-up resistor to the USB's board 5V, as drawn. If the transistor is off the resistor will pull "A" to the 5 V, so that's logic "1". If the transistor is on it will switch the output "A" to ground, that's a "0". The output "A" goes to one of the board's inputs. Ground of the sensor (coming from the wall-wart) goes to the board's ground.  
FTDI, which manufactures the IC on the board, has downloadable drivers for different PC operating systems which allow you to access the ports with most current programming languages.

