Is there anybody who tried the Thermal Printer Either with ESP32 or with ESP8266 I want to try a new project in which I send the user details using Nextion display input field to the Microcontroller and Thermal Printer will print it. If anybody have already worked on in then share me the code.
Thanks in Advance
what have you tried ?
Have you asked Adafruit if their printer and library works on ESP, they might know.
The communication with the printer is just plain Serial communication at 19200 or 9600 bauds. The library lets you provide in the constructor the Serial instance to use to discuss with the printer in the form of a Stream instance (or subclass then such as hardware or software serial).
// Constructor
Adafruit_Thermal::Adafruit_Thermal(Stream *s, uint8_t dtr) : stream(s), dtrPin(dtr)
{
dtrEnabled = false;
}
The Adafruit_Thermal inherits from the Print Class as can be seen in the declarationclass Adafruit_Thermal : public Print {
and thus just implements the necessary write method for all high-level printing
size_t Adafruit_Thermal::write(uint8_t c)
Timing (important because a paper printer is slow) seems to be managed using real time and not connected to micocontroller speed so should not present an issue.
So from a first analysis perspective, you should be fine from a software perspective using the second hardware serial of your ESP32 to discuss with the thermal printer.
Now as These printers use TTL serial to communicate, one must worry about voltage. One Tx pin (5V or 3.3V) is required to send data to the printer. A second pin can OPTIONALLY be used to poll the paper status, but not all printers support this, and the output on this pin is 5V which will be damaging an ESP32 and thus would require a voltage adaptor. You’ve been warned
Of course all this is theory and the best way to go is connect everything, including the voltage adapter, and give it a go