Example Code for Arduino-Label Mode Printing
Last revision 2026/01/28
This article guides readers through setting up an Arduino-based label mode printing system using a thermal printer, complete with a wiring diagram and sample code to facilitate the printing process.
Hardware Preparation
- DFRduino UNO R3 with IO Expansion Shield and USB Cable A-B
- [Embedded Thermal Printer V2.0](Embedded Thermal Printer V2.0)
- 9-24V adapter or power supply x1
Software Preparation
Wiring Diagram
TTL interface wiring method
| Printer | Arduino UNO |
|---|---|
| DTR red line | Floating |
| TXD black line | Pin 10 |
| RXD blue line | Pin 11 |
| GND green line | GND |

Sample Code
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
uint8_t Com[7] = { 0x1F, 0x2F, 0x0B, 0x00, 0x01, 0x01, 0x01 }; //Switch to tab mode
uint8_t Com1[2] = { 0x1F, 0x63 };//Label verification
const char QRx[200] = {
0x1B,0x40,
0x1A,0x5B,0x01,0x00,0x00,0x00,0x00,0x90,0x01,0x40,0x01,0x02,
0x1A,0x31,0x00,0x05,0x02,0x1E,0x00,0x1E,0x00,0x04,0x00,0x77,0x77,0x77,0x2E,0x64,0x66,0x72,0x6F,0x62,0x6F,0x74,0x2E,0x63,0x6F,0x6D,0x00,
0x1A,0x54,0x01,0xC8,0x00,0x14,0x00,0x18,0x00,0x00,0x11,0x44,0x46,0x52,0x4F,0x42,0x4F,0x54,0x00,
0x1A,0x54,0x01,0xC8,0x00,0x37,0x00,0x18,0x00,0x00,0x11,0x53,0x4B,0x55,0x3A,0x44,0x46,0x52,0x30,0x35,0x30,0x33,0x2D,0x43,0x4E,0x00,
0x1A,0x54,0x01,0xC8,0x00,0x5A,0x00,0x18,0x00,0x00,0x11,0x77,0x77,0x77,0x2E,0x64,0x66,0x72,0x6F,0x62,0x6F,0x74,0x2E,0x63,0x6F,0x6D,0x00,
0x1A,0x5D,0x00,
0x1A,0x4F,0x00
};
void setup() {
mySerial.begin(115200);
Serial.begin(9600);
mySerial.write(Com, 7); //Switch to tab mode
delay(1000);
mySerial.write(Com1, 2);
while (Serial.read() >= 0) {}
}
void loop() {
mySerial.println();
mySerial.write(QRx, 200); //Send a print command to the printer
mySerial.println();
delay(10000);
}
Result
The printer will print the following content every 10 seconds:

Was this article helpful?
