The Centronics parallel port interface is fairly simple to control in its most basic form - which is useful if you want to drive an old parallel-port printer. This project shows you how to use an Arduino Leonardo (I used an Arduino Pro-Micro clone) to provide a printer with two serial interfaces (CDC-class serial over USB and RS232 over the Arduino's TTL serial port). The Arduino connects directly to the Centronics Parallel port signals as well as taking +5 volts from the printer. In addition to the ability to send character data to the printer, this project adds a few extra features:
- XON/XOFF flow control on two serial interfaces (USB Serial or TTL serial converted to RS232)
- Command to request power and printer paper status
- Command to reset printer and flush buffers
- Notification of printer power (on/off)
- Notification of printer paper status (paper available/paper out)
- Tri-states Arduino signals when printer is not powered but Arduino is powered via USB.
The schematic is very simple. Since the Centronics parallel port is TTL-compatible, we connect the Arduino directly to the 8-bit data bus, the active-low Strobe signal, the active-high BUSY signal, the active-high PAPER EMTPY signal and the active-low RESET/INIT signal. We use a schottky diode to isolate the Arduino (and RS232 interface circuitry) from the printer circuitry. The Arduino can be powered by either an external computer (to load code, for example) or the printer (when using the RS232 interface) without a USB-connected computer back-powering the printer. A resistor-divider provides a sense for the Arduino to know when the printer is powered. Coupled with sensing the paper status signal on the Centronics interface, the Arduino can communicate back to a host system the printer status (powered and paper status).
I put the Arduino and RS232 driver circuitry on a proto-board that fit inside the printer (with some slight modifications to the back panel to allow access to the RS232 DB-9 and USB connectors). I used a TTL-RS232 converter board I found at my hackerspace originally designed for some other development board. A cheap ebay board or one hand-built using any one of a number of converter chips can be substituted. I used a ribbon cable to connect to printer port pins + an internal 5V power line in the printer so my board could be powered by the printer through a schottky diode (allowing power from either USB or the printer). One could also build this circuit in an enclosure and use driver chips to interface with a Centronics interface driven over a cable.
The thing that struck me while building this interface was the parallelism between the old service manuals and our current idea of Open Source Hardware. HP provided a manual (scan attached) that described the printer's operation in great detail including full schematics and parts list. The only thing it didn't include was a listing of the firmware running on the custom micro-controller in the printer. Despite this, the service manual was incredibly useful in building my little hack to allow serial access to the printer. By looking at the schematic I could be assured that my electronics would work. I could tell, for example, that i could only sample the BUSY# signal to tell when it was OK to drive a new data byte instead of also looking at the ACK# signal too since I could see that the printer's circuitry used the same signal to clear the BUSY# signal and drive ACK# after each byte my firmware wrote to it. It's too bad that modern proprietary hardware doesn't come with a service manual. Even if the manufacturer decides to keep some parts (for example, the firmware) private, describing the hardware in detail can be incredibly useful for customers.
Anyway, I think this project could be useful to anyone hoping to re-use an old Centronics parallel port printer with a modern device via a serial interface.