node package manager

tessel-thermalprinter

A2 micro panel thermal printer module for Tessel

Thermal printer module for Tessel

Support for the A2 micro panel thermal printer module for Tessel.

This module is based on xseignard's thermalprinter package

Important Information Specific to Module

  • Needs a seperate 5v - 9V, 2A power supply. The Tessel can't power this. 9V is faster.
  • You can do a test print by holding the printer button while powering.

Installation

npm install tessel-thermalprinter
  • A, B, D ports only. C doesn't support UART yet.
  • Wire it up so: Ground (printer) to Ground (Tessel: Pin 0), RX (printer) to RX/G1 (Tessel: Pin 8) add pics later

Examples

var tessel = require('tessel');
var thermalprinter = require('tessel-thermalprinter');
var printer = thermalprinter.use(tessel.port['A']);
 
printer.on('ready', function(){
 
    console.info('Printer ready!');
 
    printer
        .center()
        .horizontalLine(16)
        .printLine("we're printing with")
        .inverse(true)
        .big(true)
        .printLine(' TESSEL! ')
        .lineFeed(3)
        .print(function(){
            console.info('Printer finished!');
            process.exit();
        });
 
});

For the Last.fm example you'll need to add a api key. You can get one here on their website.

Methods

Settings

# printer.setMaxPrintingDots( maxPrintingDotsValue, callback() )
_Set the max printing dots (0-255). Default: 7 (( 7 + 1 ) * 8 = 64dots). Unit: ( n + 1 ) * 8dots

According to section 5.2.9 of the datasheet: "The more max heating dots, the more peak current will cost when printing, the faster printing speed. The max heating dots is 8 * ( n + 1 ).""

# printer.setHeatingTime( heatingTimeValue, callback() )
Set the heating time (3-255). Default: 80 (800µs). Unit: 10µs.

According to section 5.2.9 of the datasheet: "The more heating time, the more density, but the slower printing speed. If heating time is too short, blank page may occur."

# printer.setHeatingInterval( heatingIntervalValue, callback() )
Set the heating interval (0-255). Default: 2 (20µs). Unit: 10µs.

According to section 5.2.9 of the datasheet: "The more heating interval, the more clear, but the slower printing speed."

# printer.setLineSpacing( spacing )
Set the space between each printed line vertically

Main methods

# printer.reset()
Resets printer

# printer.print( callback() )
Runs commands and prints. Run this last.

# printer.printLine( text )
Write text to printer

# printer.lineFeed( amountOfLines )
Feed blank lines out of the printer specified by argument

Printing modes

# printer.bold( onOff )
Makes text bolder

# printer.big( onOff )
Makes text bigger

# printer.underline( onOff )
Makes text underlined

# printer.small( onOff )
Makes text smaller

# printer.upsideDown( onOff )
Makes text upside down

# printer.inverse( onOff )
Makes text black on white

# printer.left( onOff )
Makes text aligned left

# printer.right( onOff )
Makes text aligned right

# printer.center( onOff )
Makes text aligned center

Images

soooooon

Barcodes

# printer.barcodeTextPosition( positionValue )
Set text position relative to barcode. Positions are: 0: Not printed 1: Above the barcode 2: Below the barcode 3: Both above and below the barcode

# printer.barcode( Printer.BARCODE_TYPES.type, barcodeData )
Print barcode. The types you can use are: UPCA, UPCE, EAN13, EAN8, CODE39, I25, CODEBAR, CODE93, CODE128, CODE11, MSI

Other

# printer.indent( amountOfColumns )
Create an indentation for text by an amount of cplumns

# printer.horizontalLine( length )
Draw a horizontal line at a certain length

check the example, will add the rest later

Events

# printer.on( 'ready', callback() )
Emitted upon reset and printing settings on printer.

Further Examples

If you want to set options you can do so like this:

// ... 
 
var printer = thermalprinter.use(tessel.port['A'], {
 
    // baudrate for the printer default: 19200 
    baudrate: 19200,
    /* can be found by doing a print test. hold the button printer while
     * powering the printer on and it should spit out some shit at the
     * bottom is it should say the baudrate
     */
 
    // Max printing dots (0-255), unit: (n+1)*8 dots, default: 7 ((7+1)*8 = 64 dots) 
    maxPrintingDots: 7,
    /* The more max heating dots, the more peak current will cost when printing,
     * the faster printing speed. The max heating dots is 8*(n+1).
     */
 
    // Heating time (3-255), unit: 10µs, default: 80 (800µs) 
    heatingTime: 80,
    /* The more heating time, the more density, but the slower printing speed.
     * If heating time is too short, blank page may occur.
     */
 
    // Heating interval (0-255), unit: 10µs, default: 2 (20µs) 
    heatingInterval: 2,
    /* The more heating interval, the more clear, but the slower printing speed.
     */
});
 
// ... 

Hardware specifications and Advanced Information

  • Datasheet

  • Productsheet

  • Buy in US (Adafruit) / UK (Hobbytronics)

  • Requires 5-9VDC @ 1.5Amp power supply during print

  • Protocol: TTL Serial, 19200 baud

  • Mean Cycles Before Failure: 5 million lines

  • Printing Speed: 50-80mm/s

  • Resolution: 8 dots/mm, 384 dots/line

Dimensions

  • Requires 2.25" wide, 50 ft or shorter thermal paper
  • Effective Printing Width: 48mm
  • Outline Dimension (WxDxH): 111x65x57mm
  • Installation Port Size: 103 x 57mm

Character set

  • Character Set: ASCII,GB2312-80(Chinese)
  • Print Font: ANK:5×7, Chinese: 12x24,24×24

Paper

  • Paper Type: Thermal paper
  • Paper Width: 57.5 ±0.5mm
  • Paper Roll Diameter: max 39mm

Temperatures

  • Operating Temp: 5°C ~ 50°C
  • Operating Humidity: 10% ~ 80%
  • Storage Temp: -20°C ~ 60°C
  • Storage Humidity: 10% ~ 90%

Other libraries

Don't have a Tessel? As this uses serial it works with most things:

Licensing

MIT or Apache 2.0