Many times it is necessary to monitor a contact closure using a PC. Some applications include monitoring a relay closure on a machine to record on-off times, or simply as an alarm to notify someone of an open freezer door.
It is very economical to use a digital I/O board in a PC. Some cost as low as $49 for 24 digital I/O! Most digital I/O cards will accept a TTL input. A typical value used for TTL inputs is 0-5 V. (0 is LOW and 5 is High). Basically, what this means is that if you put 0V, or a short, between a digital input and ground, it is a logic 0. When you put 5V between the digital input and ground, it is a logic 1. This is fine if you are using a sourcing device, however, if a contact closure such as a mechanical relay is used, then it is necessary to employ a pull-up resistor.
A pull-up resistor is used to PULL UP the voltage on the digital input when it is open. A typical value for a pull-up resistor is 10k Ohms. One side of the resistor is connected to the digital input, and the other end is connected to +5V, which is usually available on the digital I/O board. This way, when a short is connected between digital input + and ground, it is forced to a logic 0. When that short is opened, the digital input is PULLED to +5V, which is a logic 1. The following diagram will demonstrate this.
NOTE: If you are using an external power supply, make sure you connect the power supply (-) to the ground on the board.