Hi there, I try to use Epson T-M532 thermal printer with Arduino Uno,
I need advice about connection between, printer use RS232 communication,
I made RS232 to TTL board with MAX232, DB9 connector need to use only Txd, RxD and GND pins? I need something else to connect?
also can somebody help with advice about code to print some text in several row's
thanks
regards
I persuaded my VIC-20 computer to send to my Macintosh over 2 wires (a null modem arrangement). I did not need to use the handshaking lines. Likewise it may be possible for your setup. You might need to connect certain pins to a supply rail, in order to mimic handshaking protocol.
ASCII 27 ('Esc' key) is a frequent command code for Epson-compatible printers. You follow it by sending additional characters telling the printer to change a setting, etc. It's useful to know some of these basic commands for your device (example, enable or disable 'paper out' detector).
Normally you send simple ascii codes for each character you wish to print. To start a new line, send 13 (carriage return) and 10 (line feed). In some cases it's sufficient to send 13 or 10 alone.
the baud rate must match between Uno and Epson , in addition to no of bits/stop/parity bits.
printer have a DIP switch setting to set the protocol.
refer M532 manual for the details.
Thanks for info,
I share my connection and code to test the printer (work fine but printer response / speed is slow)
Arduino Uno side:
Pin11 of MAX232 to PINTx of Arduino
Pin12 of MAX232 to PINRx of Arduino
Pin10 of MAX232 to some PWN pin of Arduino
Pin9 of MAX232 to some PWN pin of Arduino
DB9 side:
Pin1 and Pin4 of DB9 together to Pin7 of MAX232
Pin2 of DB9 to Pin13 of MAX232
Pin3 of DB9 to Pin14 of MAX232
Pin6 and Pin8 of DB9 together to Pin8 of MAX232
Pin5 of DB9 to GND
testing code: (print A to Z with delay 1 sec)
Code dot - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void setup (){
Serial.begin(19200); //Epson default printer settings for baud rate}
void loop(){
printFromAtoZ();
delay(1000); //delay for 1 second}
void printFromAtoZ(){
unsigned char caracter = 'A';
Serial.write(0x1B); //ESC POS command
Serial.print('@'); //ESC POS initialize followed after command
for(uint8_t i =0; i<=25;i++){
Serial.write(caracter++);
}
Serial.write(0x0A); //Print and Line Feed from Buffer}
#include <DS3231.h>
DS3231 rtc(SDA, SCL);// I use DS3231 RTCvoid setup (){
Serial.begin(19200);//Epson default printer settings for baud rate
rtc.begin();// The following lines can be uncommented to set the date and time//rtc.setTime(15, 36, 0); // Set the time to 15:36:00 (24hr format)//rtc.setDate(19, 11, 2019); // Set the date to 19 Noemvri 2019}void loop(){
Serial.write(0x1B);//ESC POS command
Serial.print('@');//ESC POS initialize followed after command
Serial.write(0x1B);//bigger font
Serial.write(0x21);
Serial.write(0x00);
Serial.write(0x1B);//bigger letter distance
Serial.write(0x20);
Serial.write(0x05);
Serial.write("Text1");
Serial.write(0x0A);//Print and Line Feed from Buffer
Serial.write("Text2");
Serial.write(0x0A);
Serial.write("Text3");
Serial.write(0x0A);
Serial.write("Date and Time: ");
Serial.write(0x0A);
Serial.print(rtc.getDateStr());//print date
Serial.print("--");
Serial.print(rtc.getTimeStr());//print time
Serial.write(0x0A);
Serial.write(0x1B);//command for full paper cut
Serial.write(0x69);while(1){}}
Printer print all row's (all text's and real date and time), but cut command is done after row with text Date and Time, not after printed real date and time,
can somebody advice where is the problem?
thanks
regards
In the assumption that printing/cutting tasks are made asynchronous each other, did you try to add some delay right before the cut command, just to make sure there wasn't enough time to print all the characters ?