Adding Wi-Fi to a 35-Year-Old Printer for Making ASCII Art

In a continuation of Clem Mayer's previous project, he's now adding Wi-Fi connectivity for starting prints wirelessly from anywhere.

Outdated technology

The advent of USB and Wi-Fi-enabled printers is still quite recent. Before they were released to the market, these devices could only communicate over far more primitive data links. The classic parallel port is probably the most recognizable one with its two rows of pins that contain an array of ground, data, and control pins that can send simple commands or text to the awaiting printer.

Due to their obsolescence, Clem Mayer from element14 Presents wanted a simple way to print text from his USB-enabled phone to a 35-year-old printer. And after achieving this goal in a previous project, strove to go even further by integrating Wi-Fi for the ultimate upgrade.

Creating the hardware

For this first project, Mayer found a useful Arduino sketch that enables communication with a dot-matrix printer over the Centronics cable standard. Although the connector is slightly different to the aforementioned parallel port, it operates in much the same way. After getting the sketch to work, he designed a simple Arduino Uno shield PCB that routes the required pins to a connector.

Printing text

In simple terms, the printer works by first waiting for the host device, in this case an Arduino Uno, to set the eight bits on the data bus and then toggle the strobe pin, thus letting the printer know to begin reading the data and print the resulting character. While this is happening, the printer sets its busy pin to tell the host not to send any more data until it's available to be read. This process can be repeated until a row of text has been created, after which setting the line feed signal causes the paper to move up one line.

Including a web server

To shrink things down a bit and make the USB-to-parallel converter more portable, Mayer made a second PCB that contains an ESP32, a pair of buttons, and the connector. The inclusion of the ESP32 also meant that its onboard Wi-Fi could now be used to receive data from an external device rather than relying solely on a physical USB cable. The web server presents a very basic page containing a text box in which users can type whatever they want and then send it to be printed.

A strange case of broken Wi-Fi

Upon testing, Mayer ran into a very problematic and confusing issue. The ESP32 would run normally on its own, but attaching the printer would cause the Wi-Fi module to lose connection while the code continued running in the background. The subsequent debugging session and humorous comedy sketch resulted in finding out that the differences in logic levels was causing the ground reference of the Wi-Fi antenna to receive too much voltage.

PCB revisions and assembly

Solving this problem was done by including a couple of logic-level converters that take the incoming 5V and reduce it to 3.3V, and vice-versa. Mayer also replaced the previous USB-C connector with a USB B connector that would only be used for power delivery and occasionally flashing new binaries to the ESP32.

The Python script

Having to manually type every line into a textbox on a webpage would get tedious, especially for more complex text. So after realizing that the ESP32's web server accepted simple GET requests over HTTP, Mayer made a simple Python script, which can read characters from a file and send them over automatically.

Making some art

The final test of the system was a resounding success, as Mayer was able to print both words and some simple ASCII art on his old dot-matrix printer over Wi-Fi. He even tried out the Linux Cowsay package (where an ASCII cow says something within a speech bubble) by piping its output into a file and then reading it in the Python script.

To see more about how Mayer made this project, you can watch his video here on YouTube.

Arduino “having11” Guy
20 year-old IoT and embedded systems enthusiast. Also produce content for Hackster.io and love working on projects and sharing knowledge.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles