Electronics project notes/Thermal printer notes

From Helpful
Jump to: navigation, search
This is for beginners and very much by a beginner. It's meant to try to cover hobbyist needs, and as a starting point to find out which may be the relevant details for you, not for definitive information.

Some basics and reference: Volts, amps, energy, power · Ground · batteries · resistors · changing voltage · transistors · fuses · diodes · varistors · capacitors · inductors · transformers · baluns · amplifier notes · frequency generation · skin effect


And some more applied stuff:

IO: wired local IO wired local-ish IO · · · · Shorter-range wireless (IR, ISM RF, RFID) · bluetooth · 802.15 (including zigbee) · 802.11 (WiFi) · cell phone


Sensors: General sensor notes, voltage and current sensing · Knobs and dials · Pressure sensing · Temperature sensing · humidity sensing · Light sensing · Movement sensing · Capacitive sensing · Touch screen notes

Actuators: General actuator notes, circuit protection · Motors and servos · Solenoids

Some stuff I've messed with: Avrusb500v2 · GPS · Hilo GPRS · JY-MCU · DMX · Thermal printer

Audio notes: basic audio hacks · microphones · amps and speakers · device voltage and impedance, audio and otherwise ·

Less sorted: Common terms, useful basics, soldering · Microcontroller and computer platforms · Arduino and AVR notes · ESP series notes · Electronics notes/Phase Locked Loop notes · mounts, chip carriers, packages, connectors · signal reflection · pulse modulation · electricity and humans · Unsorted stuff


See also Category:Electronics.

These are primarily notes
It won't be complete in any sense.
It exists to contain fragments of useful information.

I once got thermal printers (Point of Sale style, typically for receipts) to play with, so here are my notes.


Hardware notes

Wiring

The wiring and signaling can be slightly specific to a model, so read the manual.

I have a serial printer (Parallel also exists, and transport via USB and ethernet is similar).

In my case, Having Ground, Rx, Tx, and a single hardware flow control pin ('my buffer is full, pause please') was enough.

Keep in mind this may be the +15V/-15V variant of serial. If you want to connect to TTL level (0-5V) serial port you'll need a MAX232 or similar.

Higher port speeds are nice if you want to print fine bitmap graphics not-very-slowly.


EPL2 notes

ESC/POS notes

ESC/POS is a standard from Epson, with a series of revisions. Some commands are new, some outdated, so not all ESC/POS printers support everything.

Characters special in some way:

  • Many commands start with ESC (0x1B),
  • a bunch with GS (0x1D)
  • a few with FS , relating to non-volatile memory
  • LF (0x0a) and FF (0x0c) have similar but specific meaning depending on whether the printer is in standard or page mode


Cut

GS V m
GS V m n

For m

  • 0 or '0' - full cut (if supported)
  • 1 or '1' - partial cut
  • 65 - feed n lines according to current pitch, then full cut
  • 66 - feed n lines according to current pitch, then partial cut


If the cutter is after the print head, cutting without movement would cut off perhaps three lines of of what we just printed. This is why some feed is part of the command (you could of course manually feed too, if you want more control).

If cutting is not supported, the feed-and-cut commands still feed.

Mixed content

When you mix text, bit images, barcodes (and variants, such as double-height text),

...there are various well-defined details to how these will be printed alongside (or not) and how far they will extend horizontally and vertically. Read the standard :)


text

ASCII is typically printed as-is.

Non-ASCII is typically handled through codepages.

You can also often define your own character set.(verify)


Line wrapping is applied automatically (though for e.g. receipts it may be less messy if you can avoid this).

Be aware of potentially different handling between:

  • regular text
  • magnified text
  • HRI (Human Readable Interpretation), the text under a barcode
  • chinese characters


Magnification: GS ! n n is two nibbles, for horizontal and vertical where. Bitwise:

0000 for 1, though to 0111 for 8
1000-1111 undefined

Standard mode and page mode handling of text

Short version:

  • Standard mode prints lines, that is, it acts when it sees a LF character in the text data
  • Page mode buffers incoming text data, but does not act until it gets
    • ESC FF (print and stay in page mode)
    • FF (print and switch to standard mode)
  • There are a few commands that are ignored, completely or selectively, in one of the modes
In most cases it's fairly obvious (e.g. switching to the already active mode, printing bit images in page mode)
in other cases it is more interesting, e.g setting text direction


Switching between the modes:

  • ESC L: switch to page mode
  • ESC S: switch to standard mode (presumably clear page mode's leftover buffer(verify))



Print region, direction

ESC W - set margin ESC T - set print direction



Bit graphics

GS v 0
(0x
1d7630
)
  • now obsolete, but is typically still supported
  • takes data from
  • useful for one-time use
GS ( L
GS 8 L


Download bit images

GS *
sets current download image
GS /
prints current download image
  • Useful for e.g. store logo
  • Size restrictions:
    • x in 1..255 (units of 8 dots)
    • y in 1..48
    • (x*y) must be <= 1536
So, for example, if the print width is 576 dots, x=72, so y must be <=21



Download bit images are meant for re

Status and such

  • ESC @ (0x
    1b40
    )
    • Clears the print buffer, download bit images
    • Retains reception buffer, DIP settings, macros, NV bit images,
    • leaves the printer in standard mode