This post is part of the Rack box project series.

Get 5 inputs and 8 outputs from a computer printer port using only a few transistors and resistors.

Table of contents


With this unit a regular computer parallel (printer) port will give you 5 inputs and 8 outputs to use for something fun. And it’s very simply to build; one transistor and one resistor per output, and a single resistor for each input.

The parallel port is pretty simple to access in most programming languages. The module has a 36 pin Centronics connector, making it easy to connect to the computer using a regular printer cable.

By connecting the module to the parallel port of a Linux server, and using some scripts, signals and alarms can be triggered. Making it possible to create a Linux server status panel.

With a web server you can set up a PHP website controlling your module, and with your cell phone you can access this site. But I’ve only managed to use the outputs in Linux.

I’ve even made a data sheet for this module: MJ-8050.pdf


The parallel port has 5 status pins that can be used as inputs by pulling them low with a 120 ohm resistor to ground. Some experimentation might be needed as not all the status pins have the same behavior with regards to high and low state.


The parallel port also has 8 data pins with TTL-level, meaning active 5V and inactive 0V. Using an NPN transistor with a 4.7K resistor will give you a open collector output. Each output has an LED indicator.

I later made a multiplexer module to get more outputs.

Some history

This was the first computer controller I/O module I built. I originally made it in a wooden box; with LEDs in the front, a xenon strobe on top, and car relays on the back.

I got the schematics and QBasic code on a Usenet newsgroup, and used salvaged parts. Unfortunately I don’t have any photos of it, and I don’t exactly remember what year this was. But I think it in my last years on primary school, so probably around 1995 or 1996.

In 2002 I moved the “electronics” (if you can call it that 😛) into a new enclosure, replaced the LEDs and removed the relays.

The module has been used in multiple projects over the years, like my wooden rack and the rack box.


Terminal connectors

  1. Output 1
  2. Output 2
  3. Output 3
  4. Output 4
  5. Output 5
  6. Output 6
  7. Output 7
  8. Output 8
  9. Input 1
  10. Input 2
  11. Input 3
  12. Input 4
  13. Input 5
  14. When-on
  15. +12V
  16. 0V

Parallel port

DB-25 pin-out

The data pins (D0-D7) are outputs, and the status pins (S3-S7) inputs. The green pins (18-25) are ground. See table below for details.

DB-25 to Centronics

Description DB25 pin Centronics pin
Strobe 1 1
Data bit 0 2 2
Data bit 1 3 3
Data bit 2 4 4
Data bit 3 5 5
Data bit 4 6 6
Data bit 5 7 7
Data bit 6 8 8
Data bit 7 9 9
Acknowledge 10 10
Busy 11 11
Paper out 12 12
Select 13 13
Autofeed 14 14
Error 15 32
Reset 16 31
Select 17 36
Signal ground 18 33
Signal ground 19 19 + 20
Signal ground 20 21 + 22
Signal ground 21 23 + 24
Signal ground 22 25 + 26
Signal ground 23 27
Signal ground 24 28 + 29
Signal ground 25 16 + 30
Shield Cover Cover + 17

Bash scripts


Done every 5 minutes, using crontab, and sends a signal to a monitoring unit. One 0.5 second pulse is sent to binary address 8.

/var/www/ctrl_files/set_port 1 8 0.5 0.5 > /dev/null

Reset alarm

Sends life-signal to a monitoring unit and closes additional alarm outputs.

/var/www/ctrl_files/turn_port 1 0 > /dev/null
/var/www/ctrl_files/turn_port 2 0 > /dev/null
echo "signal closed to ltcu"
/var/www/ctrl_files/set_port 1 8 0.5 0.5 > /dev/null
echo "life-signal sent to mmu"

Turn port

Turns an output on or off.

PORTSTATUS=`cat /var/www/ctrl_files/port_status`
PORTSTATUSBIT=`cat /var/www/ctrl_files/$1`

if [ $2 -eq 0 ]
  if [ ! $PORTSTATUSBIT -eq $2 ]
  echo $OFF > /var/www/ctrl_files/port_status
  echo $2 > /var/www/ctrl_files/$1
  /usr/sbin/parout $OFF > /dev/null
  echo "$1 off"

if [ $2 -eq 1 ]
  if [ ! $PORTSTATUSBIT -eq $2 ]
  echo $ON > /var/www/ctrl_files/port_status
  echo $2 > /var/www/ctrl_files/$1
  /usr/sbin/parout $ON > /dev/null
  echo "$1 on"

Set port

Gives a pulse on an output.

while [ $COUNTER -lt $1 ]; do
  PORTSTATUS=`cat /var/www/ctrl_files/port_status`
  echo $ON > /var/www/ctrl_files/port_status
  /usr/sbin/parout $ON > /dev/null
  echo "$2 on"
  sleep $3
  PORTSTATUS=`cat /var/www/ctrl_files/port_status`
  echo $OFF > /var/www/ctrl_files/port_status
  /usr/sbin/parout $OFF > /dev/null
  echo "$2 off"
  sleep $4

Web ping

Gives visual alarm if the ping is higher then 400ms, and sound alarm if above 800ms. If no reply then the “internet failure” alarm will sound.

WEBPING=`ping -c 10 -W 10 |grep rtt |awk -F '/' '{print $5}' |sed -e 's/time=//' |sed -e 's/\.[0-9]*//'`
PORTSTATUS=`cat /var/www/ctrl_files/port_status`

if [ $WEBPING ]
  echo $WEBPING > /var/www/ctrl_files/ping

  if [ $WEBPING -gt $MAXPING ]
    /var/www/ctrl_files/set_port 1 2 3.6 0.5 > /dev/null
    if [ $WEBPING -gt $OVERPING ]
      /var/www/ctrl_files/set_port 1 16 0.75 0.25 > /dev/null


if [ ! $WEBPING ]
  /var/www/ctrl_files/turn_port 2 1 > /dev/null
  /var/www/ctrl_files/set_port 3 16 0.25 0.25 > /dev/null
  echo "failed" > /var/www/ctrl_files/ping

PHP Script

Controlling the Parallel I/O module using php and GPRS.

if(isset($Lamp)) {
echo "<b>Lamp signal sent to LCU.</b><br>";
$output = shell_exec('/var/www/ctrl_files/set_port 1 32 1.5 0.5'); }


The first program I made to control this module was in QBasic, but I don’t have any screenshots or code from that unfortunately.


DVC Port Kontroll (port control) was written in Pascal using Delphi. It was pretty simple, it could control the outputs, read the inputs, and had a simple security system functionality. I don’t really remember much about it, or why it was called DVC 😛

Main control window in DVC, labels in Norwegian
I/O settings, labels in Norwegian


HEBO was a collaboration between myself (hebron) and a friend (bonedawg). It was written in Visual Basic and allowed the parallel port to be controlled using network socket.

HEBO status window
HEBO options

Socket communication with the I/O module, through HEBO:

  • Read output byte value
  • Read input byte value
  • Set output byte value
READ &H378
READ: &H378 255

READ 889
READ: 889 127

WRITE &H378 5
WRITE: &H378 5 5

Web and WAP

My very first IoT attempt used the parallel I/O module, PHP and some bash scripts. It wasn’t pretty, but it kind of worked.

Toggling outputs, in the browser
Also available on WAP!


Front of the parallel I/O module
Centronics connector and terminal blocks on the backside
A really messy inside
A really messy inside
Still using the salvaged parts from the original build
Still using the salvaged parts from the original build

Server status

7 LEDs connected to the I/O module, showing statuses on my Linux server
7 LEDs connected to the I/O module, showing statuses on my Linux server

Rack box

Parallel I/O module mounted in the rack box
Parallel I/O module mounted in the rack box

Schematic drawing

Schematics for the parallel I/O module

Parts used

  • 1 × Centronics, chassi, 36-pin
  • 1 × Enclosure, plastic (1591 FL), 150x80x50mm, flange
  • 1 × LED 3mm, Green, 2.1V, 20mA, 3.5mcd, 38°
  • 8 × LED 3mm, Red, 2.1V, 20mA, 1.0mcd, 38°
  • 1 × LED 3mm, Yellow, 2.0V, 20mA, 2.5mcd, 38°
  • 10 × LED holder 3mm, Chromed metal
  • 5 × Resistor, carbon film, 0.25W, 120 Ω, 5%
  • 8 × Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
  • 10 × Resistor, metal film, 0.6W, 1 kΩ, 1%
  • 2 × Switch, toggle, 1-pole, micro, on-on
  • 16 × Terminal block, screw, 2.5 mm
  • 8 × Transistor, NPN, 100 mA, 45V, 0.5W, BC547B

Last commit 2023-02-05, with message: Add series for the rack box project.