Overview

The PC parallel port — also called the LPT port — is a 25-pin D-sub connector found on virtually every desktop PC manufactured before USB became ubiquitous. Originally designed for connecting printers, it exposes 8 bidirectional data lines, 4 control lines, and 5 status lines, making it one of the most convenient interfaces for hardware experimentation.

On the Linux PC Robot, the parallel port is used to interface the Velleman K8000 I²C bus controller board. The K8000 converts the parallel port signals into an I²C bus, which in turn communicates with the on-board DAC/ADC chips that drive the motor H-bridge amplifier.

Parallel Port Pin Assignment

The standard DB-25 parallel port connector has the following pin assignment. The Data pins (D0–D7) are the primary interface used by the K8000.

PinSignalDirectionDescription
1nStrobeOutputStrobe (active low)
2D0BidirData bit 0
3D1BidirData bit 1
4D2BidirData bit 2
5D3BidirData bit 3
6D4BidirData bit 4
7D5BidirData bit 5
8D6BidirData bit 6
9D7BidirData bit 7
10nAckInputAcknowledge (active low)
11BusyInputBusy signal
12PaperOutInputPaper out / PE
13SelectInputPrinter selected
14nLineFeedOutputLine feed (active low)
15nErrorInputError (active low)
16nInitOutputInitialize printer
17nSelectInOutputSelect input (active low)
18–25GNDSignal ground

The Velleman K8000 and I²C

The Velleman K8000 is a kit-based interface board that attaches to the PC parallel port and presents an I²C (Inter-Integrated Circuit) bus to the outside world. I²C is a two-wire serial protocol — a clock line (SCL) and a data line (SDA) — capable of addressing up to 128 devices on a single bus.

The K8000 provides:

  • 8-channel 8-bit DAC output (used to set motor drive voltage)
  • 8-channel 8-bit ADC input (for sensor readings)
  • 16 channels of digital I/O

The robot uses the DAC channels to send signed drive commands to the dual H-bridge motor amplifier. A value of 128 represents zero (stop), values above 128 drive forward, and values below 128 drive in reverse.

Linux Kernel Support

Linux provides two methods for accessing the parallel port:

  • /dev/parport0 — the kernel's IEEE 1284 parallel port abstraction. User-space programs open this device and use ioctl() calls to read/write data and control lines. Safe and portable, but has more overhead.
  • Direct I/O port access — using ioperm() or iopl() system calls, a privileged process can read and write the parallel port hardware registers directly at I/O addresses 0x378 (LPT1), 0x278 (LPT2), etc. Much faster and suitable for bit-banging I²C.

The K8000 Linux driver uses the i2c-parport kernel module, which implements an I²C adapter on top of the parallel port using bit-banging on the data and status lines. Once loaded, standard Linux I²C tools and the /dev/i2c-N device nodes are used to communicate with the K8000's on-board I²C chips.

# Load the I2C parallel port module
modprobe i2c-parport type=1

# Scan for I2C devices on the bus
i2cdetect -y 0

# Write a value to a DAC channel (example)
i2cset -y 0 0x20 0x01 0x80   # channel 1, value 128 (zero/stop)

BIOS Configuration

For direct I/O access or I²C bit-banging to work reliably, the parallel port must be configured in EPP (Enhanced Parallel Port) or ECP (Extended Capabilities Port) mode in the PC BIOS. Standard SPP mode may not support bidirectional data lines on all hardware. The BIOS setting is usually found under Integrated Peripherals → Parallel Port Mode.

Note: The parallel port is absent from most computers manufactured after approximately 2008. If your robot PC lacks an LPT port, PCI or PCIe parallel port expansion cards are inexpensive and work with standard Linux drivers. Alternatively, USB-to-I²C adapters can replace the K8000 entirely on newer hardware.