npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tessel-thermalprinter

v0.3.0

Published

A2 micro panel thermal printer module for Tessel

Downloads

18

Readme

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

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