Saturday, December 14, 2013

BTHT-V6 TTL/RS232 thermal printer module

Review: BTHT-V6 TTL/RS232 thermal printer module

In this review, I have two thermal printer modules, as shown below:

(they both look the same, so I only showed one in the picture)



Let's call them V6 and V6-simple.  The manufacturer offered different variations inside the same chase(which caused me quite a bit of confusion). The only way to tell their difference is to open the casing and look at the electronics inside.




This one, I call it the normal V6, has a MAX3232 inside to support RS232 connection.

It has both TTL and RS232


The V6-Simple, does not have MAX3232, and the PCB layout is somewhat different.

It has only TTL connection.

Looking carefully, the TTL pin layout is different. This has caused me huge trouble when I was trying out the unit.

It turns out also supports only ANSI character printing.



Common specs:

  • 2.25"(58mm) paper width (48mm printing width)
  • Max paper roll diameter of 1.5" (39mm)
  • Default 19200bps baud rate
  • 9v~24v 15w power input

Difference between the two:


V6 V6-Simple
ANSI Chars Support Support
ESC/POS Support -
Bitmap Support -
Printer Status Support -
TTL Support Support
RS232 Support -

V6-simple can print only ANSI English characters, that's it. Nothing else.



Tests:

I used PL2303 usb-2-TTL cable and MicroRidge ComTest.  If you don't have it, go grab a copy, the software is free.  PL2303 is really cheap on ebay($1.5 shipped).



Powered by my 12v 5A power supply.  It is really handy to have a few of these around.  If you don't have one, no worry.  Chances are your router/monitor/other small appliace already have a 12v power supply, just use it.

If using linux, can do something like this to test printer:
cat file.txt > /dev/ttyS0
# file.txt must end with a Carriage Return{CR} to output immediately.


Test with V6-Simple:
There really isn't much to say. Send ASCII characters down the COM port, it prints out.  The printer will auto wrap text at 32 characters.


Test with V6 (feature rich version):
This one supports ESC/POS command, however the definition is slightly different from the EPSON TM88. For example, the "batch specify print mode" [ESC !] is not available on V6.

*Note: Another little thermal printer sold at sparkfun also has a different command set, but that one is different from standard EPSON too.


Here is a list of supported ESC/POS commands:
- ESC/POS command
(HEX value)
n value
Print and Feed n dots paper ESC
0x1b
J
\x4a
n 1<=n<=255
Set line space ESC
0x1b
1
\31
n 0<=n<=255
Default: 0
Set character space ESC
\x1b
p
\x70
n 0<=n<=255
Default: 0
Set right Margin ESC
\x1b
Q
\x51
n n: number of characters
Default: 0
Set left Margin ESC
\x1b
1
\x6c
n n: number of characters
Default: 0
Grey scale ESC
\x1b
m
\x6d
n 0<=n<=10
Default: 5
Set font Width ESC
\x1b
7
\x37
n 0,1,2,3,4
Default: 0
Set font Height ESC
\x1b
8
\x38
n 0,1,2,3,4
Default: 0
Underline ESC
\x1b
-
\x2d
n 0,1
Default: 0
Overline ESC
\x1b
+
\x2b
n 0,1
Default: 0
Inverse color ESC
\x1b
I
\x69
n 0,1
Default: 0
Reverse Direction ESC
\x1b
c
\x63
n 0,1
Default: 1
Initialize printer ESC
\x1b
@
\x40
Activate/Deactivate printer ESC
\x1b
d
\x64
n 0,1
Default: 1
Report printer status ESC
\x1b
v
\x76
n n=0 check paper
  return value:
  0x00 good
  0x04 no paper

n=128 check printer
  return value:
  bit0: printing
  bit1: no paper
  bit4: overhead
  bit6: feeding paper
Print and carriage return CR
\x0d
Line feed LF
\x0a
All the commands above are supported as advertised.

Here are some examples:
\x1b\x38\x02 double font height
\x1b\x38\x00
\x1b\x37\x02 double font width
\x1b\x37\x00
\x1b\x2b\x01 enable upperline
\x1b\x2b\x00
\x1b\x2d\x01 enable underline


Bitmap Printing:  ESC K ml mh n1 n2...ni...

The bitmap printing function is a bit tricky to use. As the printer does not come with any library, I need to code the drawing part.
  1. The bitmap prints as 1x8 pixel block concatenated as a 8px hight row.
  2. one row per command.
  3. ml & mh specifies how many data [i] is attached for the current row.  On x86 processors I need to take a hex value and reverse its higher/lower byte.
  4. The bitmap can not be printed along, must accompany some text before or after it. (CR or space is okay too) Other wise there is no output.

The following example prints a 12 x 8 pixel image:


Test print 
\x1b\x4b\x30\x00\xff\xff\x00\x00\xff\xff\xff\x00\x00\xff\xff\xff\xff\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff

# To make the image taller, just repeat the command N times.  Do not add {CR} or {LF} in between.
Here is the printout:




Mini-how-to: set baud-rate
Hold down [set] button and power on the unit, it will print out a menu(in Chinese).  If you know how to read Chinese, the rest is easy.

If you don't know how to read Chinese, here is the key sequence to config baud-rate:
1) Press [LF] once to enter baud-rate setting sub-menu
2) Press [set] to display available baud-rate. 2400 ~ 115200
3) Press [LF] multiple times to select desired value.
4) when desired baud-rate is printed, press [set] to confirm it.  Then it will print out the initial menu
5) Press [set] once to save & exit.  Nothing should be printed out now.

+1 to Stewart for bringing this question out.



Final thoughts:

The V6 printer is easy to work with, RS232 + TTL connection is a big plus if I need to attach it to different devices.

It also comes with two cables. The printing quality is good compare to other lower priced printer on ebay (e.g. T5890). 

Only problem is that it could be a challenge to implement QR-code and other barcode.  I wish the manufacturer would supply a bitmap printing library so this becomes much easier.

4 comments:

  1. Hi Reed, my printer defaults to 9600 baud, and I was getting clouds of hanzi until I set that.

    ReplyDelete
    Replies
    1. Can you try this:
      Hold [set] and power on. It should bring out the config menu. What language is there? I often get Chinese/English randomly from manufacturer.

      If it is Chinese, I will get another unit, all set up and send your way.

      Delete
    2. I just updated the blog with a mini-how-to on setting the baud-rate (see above). Let me know if it fixes the problem.

      Delete
  2. Ouch... I forgot to set the baudrate to 19200. Do you still get hanzi after set to 9600? Let me pull out another unit and see how to set the baudrate. It's been a while since I last did this. Most likely I will get back to you tomorrow.

    ReplyDelete