How to connect a thermal printer to the Arduino | Small Project

Поділитися
Вставка
  • Опубліковано 26 гру 2024

КОМЕНТАРІ • 79

  • @Lagggerengineering
    @Lagggerengineering 5 років тому

    Very nicely shown and explained! I didn't even know that the cutting blade was adjustable :D

    • @GoodElectronics
      @GoodElectronics  5 років тому +1

      Not adjustable, you turn the knob to reset its position when it gets stuck :)

    • @Lagggerengineering
      @Lagggerengineering 5 років тому

      @@GoodElectronics Oh uhh, thanks for the clarification :D

  • @E2ESolutionsDIY
    @E2ESolutionsDIY 4 роки тому +2

    Good explanation dear , keep going 👍

    • @E2ESolutionsDIY
      @E2ESolutionsDIY 4 роки тому

      Hope you also viewed my channel and subscribe it to support back 👍

  • @umbrellainnovation5194
    @umbrellainnovation5194 8 місяців тому

    Thank you very much 😊

  • @hoanganhson4967
    @hoanganhson4967 Рік тому

    Nice job bro, Can you explain the parameter to change the size of the font when they were printed in the paper, I mean, what's the relation to the height of the font (millimeter unit) and the parameter of your programing code? thanks

  • @danielfarkas6334
    @danielfarkas6334 5 років тому +3

    Great demonstration!
    Would you please add the whole arduino code to the desctription?
    Thanks!

    • @GoodElectronics
      @GoodElectronics  5 років тому +9

      You're welcome!
      void setup()
      {
      Serial.begin(9600);
      delay(1000);
      int delTime=0; // delay between each instruction
      begin(); //reset all settings
      justification(0); //left side
      Serial.println("Arduino");
      delay(delTime);
      justification(1); //middle
      size(2); //big text
      Serial.println("TEST V 0.2");
      delay(delTime);
      size(0); //small text
      justification(0); //left side
      color(1); //white text
      Serial.println(" White text ");
      delay(delTime);
      color(0); //black text
      Serial.println("Hello world!!!!!");
      delay(delTime);
      feed(1); //print 1 line below
      Serial.println("Good Electronics Thermal Printer TEST");
      delay(delTime);
      feed(1); //print 1 line below
      justification(1);
      Serial.println("SIMPLE THERMAL PRINTER");
      delay(delTime);
      feed(1); //print 1 line below
      Serial.println("CONNECTED TO ARDUINO");
      delay(delTime);
      feed(1); //print 1 line below
      Serial.println("very very very long text in this line......");
      delay(delTime);
      feed(1); //print 1 line below
      Serial.println("very very very long text in this line again");
      delay(delTime);
      feed(1); //print 1 line below
      Serial.println("Printing complete!");
      cut(); //cut the paper
      }
      void loop()
      {
      }
      void begin()
      {
      Serial.write(27);
      Serial.write(64);
      Serial.write(10);
      }
      void justification(int just)
      {
      Serial.write(27);
      Serial.write(97);
      Serial.write(just);
      Serial.write(10);
      }
      void feed(int lines)
      {
      Serial.write(27);
      Serial.write(100);
      Serial.write(lines);
      Serial.write(10);
      }
      void cut()
      {
      feed(3);
      Serial.write(27);
      Serial.write(105);
      Serial.write(10);
      }
      void color(bool col)
      {
      Serial.write(29);
      Serial.write(66);
      Serial.write(col);
      Serial.write(10);
      }
      void size(int siz)
      {
      Serial.write(29);
      Serial.write(33);
      Serial.write(siz);
      Serial.write(10);
      }

    • @danielfarkas6334
      @danielfarkas6334 5 років тому

      @@GoodElectronics Thanky you!

    • @danielfarkas6334
      @danielfarkas6334 4 роки тому

      @@GoodElectronics For me its just prints a bunch of strange characters.
      My printer settings are the same as yours.
      I dont know what am i doing wrong.
      I use Epson TM-20II.
      Do you have any idea?
      Thank you very much!!

    • @GoodElectronics
      @GoodElectronics  4 роки тому

      @@danielfarkas6334 Do you use the same baudrate in arduino as it is in your printer?

    • @danielfarkas6334
      @danielfarkas6334 4 роки тому

      Good Electronics yes i tried both the printer and arduino with 9600 and 19200 too

  • @garcia3137
    @garcia3137 4 роки тому +2

    thanks a lot! but i have a doubt, where can i find more codes or information about ones ?

    • @GoodElectronics
      @GoodElectronics  4 роки тому +1

      Hi. All of information I got from this documentation page. Sending commends with arduino is my idea, so there isn't much about it.

    • @o0julek0o
      @o0julek0o 3 роки тому

      @@GoodElectronics is there some place where one could find all or most of these lists of commands for each printer? Or are they generally the same across most models?

    • @GoodElectronics
      @GoodElectronics  3 роки тому

      @@o0julek0o They should be the same, but some printers may have some other functions. I think it will work with my commands.

  • @aijax3609
    @aijax3609 5 років тому +1

    Awesome. You’ve just complicated the printer.

  • @Rafael_Bueno
    @Rafael_Bueno 3 роки тому

    great video! what is the instruction to cut the paper at the end?

    • @GoodElectronics
      @GoodElectronics  3 роки тому

      Hi. All these instructions are in the code so you can copy them. The cutting instruction is a bit tricky, because you need to eject some more paper before cutting, because the cutting blade is in the front of the printer

  • @amitnamdeo7446
    @amitnamdeo7446 Рік тому

    can we do it on citizens barcode printer ?

  • @bonaventureokoli7988
    @bonaventureokoli7988 4 роки тому

    Thanks a bunch.

  • @coreykreisel6091
    @coreykreisel6091 3 роки тому

    Hi there! i have purchased this printer and am trying to copy your instructions for the simplified connection method (method 2). Unfortunately the video is not very HD and it is hard to see how things are wired. Could you please share the name of the chip or the pinout diagram and explain with a bit more detail where you have connected the wires? Thank you! Great work!

    • @GoodElectronics
      @GoodElectronics  3 роки тому

      The best way is to look at the chip markings and search for its data sheet, you will be 100% sure about the connections. If you won't find anything, here's some similar chip: www.openimpulse.com/blog/products-page/product-category/max3232-rs232-to-ttl-converter-module/
      Remember to check the connections (the rs232 side needs to be connected to the rs232 port, the ttl side needs to be connected somewhere inside the printer with the main chip), as long as your printer has ttl inside. If you won't find the chip, I think the printer will use rs232, so you need to stay with method 1.

  • @davidorozco971
    @davidorozco971 3 роки тому

    The db9 cable Is a 1 to 1 cable? or what kind of cable is it? Can you send me the link to buy It, please

    • @GoodElectronics
      @GoodElectronics  3 роки тому

      I bought it at a local store, so I can't send you a link. This is non-crossed cable

  • @BilalKhan-do9il
    @BilalKhan-do9il 3 роки тому

    i have a real pos rpt iv classic printer, in which im usnig an RS 232 to ttl converter to connect it with arduino, in my printer it seems that the rx and tx ports are messed up coz when i connect printer to ttl converter using a cable nothing prints on paper, then i used bare connectors and manually soldered tx and rx pin only, in my case rx pin seems to be at pin 1, despite of doing all these stuffs myprinter is only printing some random character, im using adafruit thermal library, can you tell me whats the issue?

    • @GoodElectronics
      @GoodElectronics  3 роки тому +1

      Try changing baudrate and try with every one, that's the only way to figure out the baudrate used in your printer. Most common ones are 9600 and 115200

    • @BilalKhan-do9il
      @BilalKhan-do9il 3 роки тому +1

      @@GoodElectronics yeah its working now very well , baud rate is 9600 and main culprits were rx and tx pin , thanks!

  • @lycheesack
    @lycheesack 4 роки тому

    did the use bluetooth printer network? what id number do the communication chip use?

    • @GoodElectronics
      @GoodElectronics  4 роки тому

      If you meant using a printer via bluetooth, then yes, this is possible, with HC-06 module. It works in the same way as Arduino Serial, so commands are the same. Make sure that the module is set to proper baudrate to work.

  • @sharingtechnical8312
    @sharingtechnical8312 4 роки тому +1

    hi!
    i'm using xpprinter xp-58ii
    it's not support ttl you can help me comunication xpprinter with arduino. thanks so much!

    • @GoodElectronics
      @GoodElectronics  4 роки тому

      I don't know if you can connect this printer to arduino. Maybe you can connect to arduino using USB host shield, but I didn't test it yet, so I can't help you with it. Maybe you will find some code to it.

    • @sharingtechnical8312
      @sharingtechnical8312 4 роки тому

      @@GoodElectronics OKE, Pro if i find it! i will Share with you! thanks u so much.

  • @tobychow4761
    @tobychow4761 3 роки тому

    My printer has a parallel interface card (UB-P02II). How should I go about this project in my case?

    • @GoodElectronics
      @GoodElectronics  3 роки тому

      As well as I know arduino don't support parallel interfaces, maybe there are some converters for rs232, but I don't know if it will work

  • @iamguruman
    @iamguruman 4 роки тому

    Hello. Can you show how to do this with godex g500?

    • @GoodElectronics
      @GoodElectronics  4 роки тому

      Hi. I don't have ability to show you with every model of printer, I showed you how to modify a printer if it has RS232 connector. All printers that have this connector will be built in the similar way.

  • @janm6380
    @janm6380 4 роки тому

    Hi! I have the same epson printer with this stupid db25 port.
    when you connect it to the pc, will it work as normal, so i can install epson driver, print from any pos software and so on? please let me know.

    • @GoodElectronics
      @GoodElectronics  4 роки тому

      I didn't test it, but if you have an rs232 port or rs232 to USB adapter, it will work. It won't work that way I connected it, you must have a direct rs232 to usb (without serial) converter

  • @yordicdelacruz7477
    @yordicdelacruz7477 4 роки тому

    good afternoon, is there any way to print small images?
    Thank you very much in advance

    • @GoodElectronics
      @GoodElectronics  4 роки тому +1

      Hi. I tried to print images, but I didn't find and way to get it to work with arduino.

    • @yordicdelacruz7477
      @yordicdelacruz7477 4 роки тому

      @@GoodElectronics ok u.u thx

  • @lordnoah3366
    @lordnoah3366 3 роки тому

    hey Good Electronics ! please help me !!!! I use " Dump File to Port " in realterm ... exemple". txt" file eject very good but "pdf and outher(-png -jpeg )" file not printig.... why not work .... what would you suggess?

    • @GoodElectronics
      @GoodElectronics  3 роки тому +1

      Hi. I tried to see any documentations how to print images and I also haven't found the solution. I think that png, jpeg won't work, you need at least a bitmap, but I don't know how to prepare it to print with this printer.

    • @lordnoah3366
      @lordnoah3366 3 роки тому

      ​@@GoodElectronics i try bitmap file ..... i searched . maybe work esc/p commands inside page print mode

  • @lovrobebic6059
    @lovrobebic6059 2 роки тому

    @Good Electronics, I have thermal printer with only USB port, Can you explain me how can I communicate with arduino? WIll it work if I use USB to TTL converter?

    • @GoodElectronics
      @GoodElectronics  2 роки тому

      No, it's impossible to connect it that way. I have no idea how you could connect it.

    • @lovrobebic1447
      @lovrobebic1447 2 роки тому

      @@GoodElectronics
      Hi, I have bought the used STAR Micronics TSP650 printer with serial port, and also i have ordered rs232 to ttl adapter and conected everything like you, but I still can't get communication between arduino and printer. Do You have idea what could be problem?

    • @GoodElectronics
      @GoodElectronics  2 роки тому

      Maybe check every baudrate? Or try to swap rx and tx

    • @lovrobebic6059
      @lovrobebic6059 2 роки тому

      @@GoodElectronics Thanks for Your reply.
      I have tried to change baudrates, and swap rx and tx pins, but without any progress. Then I bought USB to RS232 adapter cable to try send commands from Realterm to printer and this works well , so now I'm sure that printer works correctly. Now I'm wondering why it doesnt print when I'm using RS232 to TTL adapter.
      I am total beginer in arduino programing but as I understand just this two lines of code should be enough to send print request to printer:
      Serial.begin(9600);
      Serial.print("Hello world");
      So if that doesn't work I supose that maybe my RS232 to TTL adapter doesn't work well. What do You think?

  • @kaniduperera7681
    @kaniduperera7681 3 роки тому

    why you use Serial.write(10); after every command ?

    • @GoodElectronics
      @GoodElectronics  3 роки тому

      That's the enter symbol, it tells the printer that the command is finished

  • @victorenriquecastillomarti8366
    @victorenriquecastillomarti8366 4 роки тому

    Hi.
    I got an epson printer, model M244A. It has an input for USB and RS232.
    I also have a USB Host Shield for arduino. Can I use the USB connection of the printer with the USB connection of the USB Host Shield, and it works the same as you show in the video?
    I hope you can help me friend, I would appreciate it very much, there is my subscription and I like it

    • @GoodElectronics
      @GoodElectronics  4 роки тому

      Sure, you can use USB, but I didn't test any of these shields. It's harder to do, because with RS232 there's already a Serial in Arduino, but with USB you have to implement USB protocols and so. Simply: USB can work, but Serial is much more simple to use.

  • @tenij000
    @tenij000 8 місяців тому

    do got the arduino code

  • @bonaventureokoli7988
    @bonaventureokoli7988 4 роки тому

    Please can you list the items you used in the conversion to arduino

    • @GoodElectronics
      @GoodElectronics  4 роки тому

      It depends if you prefer the adapter connection or direct soldering connection, and if you want to use a step up converter, write so I will be able to type the list

    • @bonaventureokoli7988
      @bonaventureokoli7988 4 роки тому

      @@GoodElectronics i mean the device for serial to arduino board, that small chip what is it, and also if you dont mind, you can mention others, you can even paste an affiliate link i'll buy them.

    • @GoodElectronics
      @GoodElectronics  4 роки тому

      It's a serial to rs232 converter, all these converters should work in the same way.

    • @bonaventureokoli7988
      @bonaventureokoli7988 4 роки тому

      @@GoodElectronics Thank you very much. that's it.

  • @lapatronale
    @lapatronale 3 роки тому

    hi, i have the same model but it is usb, how can i interface with Arduino? pls Marco

    • @GoodElectronics
      @GoodElectronics  3 роки тому

      Unfortunately, arduino can't control usb devices, the only way is to use external USB host module.

    • @lapatronale
      @lapatronale 3 роки тому

      @@GoodElectronics Ie could I use a usb ttl converter? tks a lot!

    • @GoodElectronics
      @GoodElectronics  3 роки тому

      @@lapatronale no, it won't work.

  • @gasour1
    @gasour1 3 роки тому

    Whats the model of this printer

    • @GoodElectronics
      @GoodElectronics  3 роки тому +1

      It's some Epson printer, I don't know the model, I bought it used

    • @gasour1
      @gasour1 3 роки тому

      @@GoodElectronics thanks also iam ask if you can renewing th link of epson programing guide pdf if you please the old link not working

    • @GoodElectronics
      @GoodElectronics  3 роки тому

      Unfortunately, I don't have the pdf downloaded and I don't know where to search for the other files, but you can try to search for similar models, for example I found this: files.support.epson.com/pdf/general/escp2ref.pdf
      Of course most of the commands won't work, but some basic comands are common to all the printers, so they will work.

  • @jahn_star
    @jahn_star 4 роки тому

    thanx

  • @DucNguyenMinh
    @DucNguyenMinh 4 роки тому

    Can you capture the circuit connected more clearly?

    • @GoodElectronics
      @GoodElectronics  4 роки тому

      Which circuit?

    • @DucNguyenMinh
      @DucNguyenMinh 4 роки тому

      @@GoodElectronics at time 0:17

    • @GoodElectronics
      @GoodElectronics  4 роки тому +1

      It's a simple time logger with DS1307. You can find a video about it on my channel. Simply add a switch to any analog input, and make an if that detects when this button is pushed.
      Like this (you also have to add the time script):
      pinMode(A0, INPUT_PULLUP);
      if(!digitalRead(A0))
      {
      Serial.print(time);
      Serial.print(27 100 3);
      delay(500);
      }

  • @lekhanhsau4536
    @lekhanhsau4536 4 роки тому

    Rx to Rx, Tx to Tx - something wrong here. I Know that "rx to tx and tx to rx".