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 🙏

© 2026 – Pkg Stats / Ryan Hefner

mtbc-reader

v1.2.0

Published

Provides extensive support for interfacing with Mettler Toledo BC scales.

Downloads

26

Readme

mtbc-reader - Provides extensive support for interfacing with Mettler Toledo BC scales.

Installation

npm install mtbc-reader
const scale = require("mtbc-reader");

Currently tested for OS: Windows 10, Ubuntu 18 (with libusb)

Currently tested for hardware: MT PS60 scales

Examples

A basic example application is provided in the src/ directory.

image

Usage

Reference the scale reader

const scale = require('mtbc-reader')

Manual registration of the scale is never required, the library handles all scale/usb registration, connect, and disconnect events - you only need to reference the library to use it.

Getting the weight from the scale

There are two methods of obtaining the weight from the scale.

The simplest method is .getWeightLb()

var weight = scale.getWeightLb();
console.log("Weight on scale is: "+weight+" pounds.")

Additionally, .getWeightKg() and .getWeightOz() can be used as well.

The second method is via the events system.

scale.events.on("change", function(weight) {
    //weight = scale.getWeightKg(); or manual conversion if you need something other than pounds
    console.log("The weight on the scale has changed! The weight is: "+weight+" pounds.")
});

The event is better suited for live visual interfaces or any other situation where you might consider polling the first method.

The event stream can be paused with scale.pause() and resumed with scale.resume()

  • Note: if the scale is unplugged or otherwise unregistered the event will simply stop firing, it will not disconnect or throw any errors - .isPluggedIn() can be used to check status if required.
  • Note: The event only returns in pounds, you can either call .getWeightKg(), .getWeightOz() in the event callback, or manually convert to another unit.

Getting the scale's status

A number of helper functions are included in the library to obtain more information about the scale.

Tell whether or not the scale is plugged in

scale.isPluggedIn() Can be used to determine whether the scale is plugged in or not.

if (scale.isPluggedIn()) {
  console.log("Scale is plugged in!");
} else {
  console.log("Error: Scale is not plugged in!");
}

Further helper functions are listed in the full API below.

Raw status

Additionally, you can just get the raw scale status and process it yourself:

var status = scale.getStatus();

switch(status) {
    ...
}

The status format is as follows:

  • 1: Fault,

  • 2: Stable @ 0,

  • 3: In motion,

  • 4: Stable,

  • 5: Under 0,

  • 6: Over-weight,

  • 7: Requires calibration,

  • 8: Requires re-zeroing

  • Note: 0 will be returned by the reader if getStatus() is accessed while the scale is unplugged or otherwise unregistered

Complete API

.getWeightLb()

  • Returns the scale weight in pounds, to the hundredth decimal point.
  • Note: If the scale is unplugged, any attempts to get the weight will return 0.

.getWeightKg()

  • Returns the scale weight in kilograms, to the hundredth decimal point.
  • Note: If the scale is unplugged, any attempts to get the weight will return 0.

.getWeightOz()

  • Returns the scale weight in ounces, to the hundredth deceimal point.
  • Note: If the scale is unplugged, any attempts to get the weight will return 0.

.events

  • EventEmitter for weight change, use event "change".

.isPluggedIn()

  • Returns true if the scale is plugged in.

.isFault()

  • Returns true if the scale is warning that a fault has/is occurring

.isMoving()

  • Returns true if the scale is encountering a load greater than it's official max capacity.

.isUnderZero()

  • Returns true if the scale is returning a value below zero (either negative numbers or simply refusing to display anything on the LCD)
  • Note: If the scale is below zero, any attempts to get the weight value will round up to 0.

.isOverweight()

  • Returns true if the scale is encountering a load greater than it's official max capacity.

.getStatus()

  • Obtain the raw status of the scale in IDs 1-8 Status format is as follows:
1: Fault,
2: Stable @ 0,
3: In motion,
4: Stable,
5: Under 0,
6: Over-weight,
7: Requires calibration,
8: Requires re-zeroing

.pause()

  • Pause sending of the weight change events.

.resume()

  • Resume sending of the weight change events.

.getByte()

  • Returns the raw data byte from the scale. Byte format for scale is as follows:
Byte 0: Report ID
Byte 1: Scale status 
Byte 2: Weight unit 
Byte 3: Data scaling
Byte 4: Scale Weight LSB
Byte 5: Scale weight MSB