+ Post New Thread
Results 1 to 6 of 6
  1. #1
    Newbie level 5
    Points: 1,856, Level: 10
    Achievements:
    7 years registered

    Join Date
    Dec 2009
    Location
    Macedonia
    Posts
    8
    Helped
    0 / 0
    Points
    1,856
    Level
    10

    EPSON M-T532 on Arduino Uno

    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

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 53,243, Level: 56

    Join Date
    Apr 2011
    Location
    Minneapolis, Minnesota, USA
    Posts
    13,015
    Helped
    2588 / 2588
    Points
    53,243
    Level
    56

    Re: EPSON M-T532 on Arduino Uno

    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.

    https://files.support.epson.com/pdf/...l/escp2ref.pdf


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  3. #3
    Advanced Member level 5
    Points: 12,739, Level: 27
    Achievements:
    7 years registered

    Join Date
    Apr 2010
    Posts
    1,935
    Helped
    416 / 416
    Points
    12,739
    Level
    27

    Re: EPSON M-T532 on Arduino Uno

    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.


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  4. #4
    Newbie level 5
    Points: 1,856, Level: 10
    Achievements:
    7 years registered

    Join Date
    Dec 2009
    Location
    Macedonia
    Posts
    8
    Helped
    0 / 0
    Points
    1,856
    Level
    10

    Re: EPSON M-T532 on Arduino Uno

    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
    }
    Last edited by BradtheRad; 23rd November 2019 at 19:43. Reason: Put code in window



  5. #5
    Newbie level 5
    Points: 1,856, Level: 10
    Achievements:
    7 years registered

    Join Date
    Dec 2009
    Location
    Macedonia
    Posts
    8
    Helped
    0 / 0
    Points
    1,856
    Level
    10

    Re: EPSON M-T532 on Arduino Uno

    Now I try to print ticket with some text's in several rows and real time and date data,
    code is:

    Code C - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    
    #include <DS3231.h>
    DS3231  rtc(SDA, SCL);  // I use DS3231 RTC
     
    void 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



    •   AltAdvertisement

        
       

  6. #6
    Super Moderator
    Points: 29,856, Level: 42
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,914
    Helped
    1128 / 1128
    Points
    29,856
    Level
    42
    Blog Entries
    9

    Re: EPSON M-T532 on Arduino Uno

    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 ?
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )


    1 members found this post helpful.

--[[ ]]--