Nano ESP32 and Thermal Printer QR701

Hi all,
I despair of controlling the Thermal Printer QR701 via TTL using the Nano ESP32. I have tried pretty much everything, neither the Adafruit Thermal Printer Library nor the BinaryWorlds Library work with the Nano ESP32. As it is for a small school project, every help is highly appreciated :slight_smile:

Printer Selftest is succesfull.

Schematic:
Printer RX to Nano ESP32 RX0
Printer TX to Nano ESP32 TX1
Printer and Nano ESP32 are both powered from 5V / same Ground

As I want to use the BinaryWorlds Library I am referring to this here:

Basically I just uploaded it to the Nano ESP32 and nothing happens :frowning: Maybe the community can support me a bit to get something out of the printer :smiley:

Best,
Eric

Normally its RX to TX and TX to RX , , did you try swapping TX/RX

I've recently used a few of those with my students and we had a hard time bringing them up.
We found out that using a 9V external power supply worked.
The supplied USB cable doesn't do anything to power the printer, so try using a power supply for the power line, then connect RX to the Arduino TX and TX to the Arduino RX.
Do not forget GND

After that with the Adafruit library it should work as long as the serial port used is the correct one.
I can't remember if the AF library uses SoftwareSerial, and if it does I'm not sure it's supported properly on the ESP32, never used it

Hi there,

thank you very much for your answers.

@sumguy : yes - I tried to swap them, but nothing happens.
@ubidefeo : thank you for your tip, I've connected now 9V, so the selftest prints faster, but still nothing from the ESP. I've played around with the script a bit, but nothing :frowning:

#include <Arduino.h>
#include "TPrinter.h"

const byte rxPin = 0;
const byte txPin = 1;
const byte dtrPin = 4;  // if used
// const int printerBaudrate = 9600;  // or 19200 usually
const int printerBaudrate = 19200;  // or 19200 usually

HardwareSerial mySerial(1);
Tprinter myPrinter(&mySerial, printerBaudrate);
// you can assign here other stream like Serial1, Serial2, Serial3 etc

void setup() {
  micros();
  Serial.begin(printerBaudrate);                                         // monitor
  mySerial.begin(printerBaudrate, SERIAL_8N1, rxPin, txPin);  // must be 8N1 mode
  myPrinter.begin();                                          // you can edit what be happen in Tprinter.cpp, like delay time(2s)
  myPrinter.enableDtr(dtrPin, LOW);                           // pinNR, busyState;
  myPrinter.println("Hi :-)");
}

void loop() {
  myPrinter.printFromSerial();  // open monitor and print something
}

Are RX and TX pins D9 and D10 for serial(1) ?

@sumguy oh dear - I have so much to learn :smiley: yes indeed, that was the problem. Thank you very much, you made my day!

1 Like

so it works now?

I have looked into it, but the include file is wrong if you were using the Adafruit_Thermal library.
I am not aware of that TPrinter file, which also looks to be local to your sketch rather than an installed library.

Anyway, hope it's working for now :slight_smile: