The arrival of USB and Wi-Fi-enabled printers continues to be fairly latest. Earlier than they have been launched to the market, these gadgets might solely talk over way more primitive information hyperlinks. The basic parallel port might be probably the most recognizable one with its two rows of pins that comprise an array of floor, information, and management pins that may ship easy instructions or textual content to the awaiting printer.
Attributable to their obsolescence, Clem Mayer from element14 Presents needed a easy option to print textual content from his USB-enabled telephone to a 35-year-old printer. And after reaching this purpose in a earlier mission, strove to go even additional by integrating Wi-Fi for the final word improve.
For this primary mission, Mayer discovered a helpful Arduino sketch that permits communication with a dot-matrix printer over the Centronics cable commonplace. Though the connector is barely completely different to the aforementioned parallel port, it operates in a lot the identical method. After getting the sketch to work, he designed a easy Arduino Uno protect PCB that routes the required pins to a connector.
In easy phrases, the printer works by first ready for the host system, on this case an Arduino Uno, to set the eight bits on the information bus after which toggle the strobe pin, thus letting the printer know to start studying the information and print the ensuing character. Whereas that is occurring, the printer units its busy pin to inform the host to not ship any extra information till it is accessible to be learn. This course of will be repeated till a row of textual content has been created, after which setting the road feed sign causes the paper to maneuver up one line.
To shrink issues down a bit and make the USB-to-parallel converter extra moveable, Mayer made a second PCB that accommodates an ESP32, a pair of buttons, and the connector. The inclusion of the ESP32 additionally meant that its onboard Wi-Fi might now be used to obtain information from an exterior system moderately than relying solely on a bodily USB cable. The net server presents a really fundamental web page containing a textual content field during which customers can sort no matter they need after which ship it to be printed.
Upon testing, Mayer bumped into a really problematic and complicated subject. The ESP32 would run usually by itself, however attaching the printer would trigger the Wi-Fi module to lose connection whereas the code continued working within the background. The following debugging session and humorous comedy sketch resulted to find out that the variations in logic ranges was inflicting the bottom reference of the Wi-Fi antenna to obtain an excessive amount of voltage.
Fixing this drawback was finished by together with a few logic-level converters that take the incoming 5V and scale back it to three.3V, and vice-versa. Mayer additionally changed the earlier USB-C connector with a USB B connector that might solely be used for energy supply and sometimes flashing new binaries to the ESP32.
Having to manually sort each line right into a textbox on a webpage would get tedious, particularly for extra advanced textual content. So after realizing that the ESP32’s net server accepted easy GET requests over HTTP, Mayer made a easy Python script, which might learn characters from a file and ship them over mechanically.
The ultimate take a look at of the system was a powerful success, as Mayer was in a position to print each phrases and a few easy ASCII artwork on his previous dot-matrix printer over Wi-Fi. He even tried out the Linux Cowsay package deal (the place an ASCII cow says one thing inside a speech bubble) by piping its output right into a file after which studying it within the Python script.
To see extra about how Mayer made this mission, you may watch his video right here on YouTube.