[ad_1]
Outdated know-how
The appearance of USB and Wi-Fi-enabled printers remains to be fairly latest. Earlier than they have been launched to the market, these units might solely talk over way more primitive information hyperlinks. The traditional parallel port might be essentially the most recognizable one with its two rows of pins that include 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 strategy to print textual content from his USB-enabled cellphone to a 35-year-old printer. And after attaining this aim in a earlier challenge, strove to go even additional by integrating Wi-Fi for the final word improve.
Creating the {hardware}
For this primary challenge, Mayer discovered a helpful Arduino sketch that permits communication with a dot-matrix printer over the Centronics cable customary. Though the connector is barely totally different to the aforementioned parallel port, it operates in a lot the identical means. After getting the sketch to work, he designed a easy Arduino Uno protect PCB that routes the required pins to a connector.
Printing textual content
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 info bus after which toggle the strobe pin, thus letting the printer know to start studying the info and print the ensuing character. Whereas that is taking place, 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 might 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.
Together with an internet server
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 slightly than relying solely on a bodily USB cable. The net server presents a really fundamental web page containing a textual content field by which customers can kind no matter they need after which ship it to be printed.
An odd case of damaged Wi-Fi
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.
PCB revisions and meeting
Fixing this drawback was accomplished 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 infrequently flashing new binaries to the ESP32.
The Python script
Having to manually kind each line right into a textbox on a webpage would get tedious, particularly for extra complicated textual content. So after realizing that the ESP32’s internet server accepted easy GET requests over HTTP, Mayer made a easy Python script, which may learn characters from a file and ship them over mechanically.
Making some artwork
The ultimate take a look at of the system was a powerful success, as Mayer was capable of 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 challenge, you possibly can watch his video right here on YouTube.
[ad_2]