1.0.4 • Published 8 months ago

@kortoaus/cas-scale v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

@kortoaus/cas-scale

A lightweight TypeScript library for interfacing with CAS PD-II electronic weighing scales over RS-232 serial communication.
Automatically requests and parses weight data from the scale, using the serialport package under the hood.

Tested and confirmed to work with CAS PD-II in ECR-TYPE 2 (STX/ETX protocol mode) only.


✨ Features

  • ✅ Automatically sends weight request commands (W)
  • ✅ Parses 7-byte responses from CAS PD-II scale
  • ✅ Emits weight in kilograms via callback
  • ✅ Works with Node.js & TypeScript
  • ✅ Tiny, dependency-light wrapper

📦 Installation

npm install @kortoaus/cas-scale

🚀 Usage

import { initializeScale } from "@kortoaus/cas-scale";

initializeScale("/dev/tty.usbserial-B002EF3X", (weight) => {
  console.log("Weight:", weight, "kg");
});

Optional error callback:

initializeScale(
  "/dev/tty.usbserial-B002EF3X",
  (weight) => {
    console.log("Weight:", weight);
  },
  (err) => {
    console.error("Scale error:", err);
  }
);

⚙️ Scale Setup Instructions

Ensure your CAS PD-II scale is configured as follows:

SettingValue
ECR Type2
Baud Rate9600
Data Bits7
ParityEven
Stop Bits1

To change ECR Type:

  1. Turn off the scale
  2. Hold ZERO + TARE and power on to enter setup mode
  3. Navigate to Ecr setting and set to 2
  4. Use TARE (long press) to save and proceed

🧪 Tested On

  • CAS PD-II with firmware version supporting ECR-TYPE 2
  • macOS + USB-to-Serial adapter (FTDI, CH340 confirmed)
  • Node.js 18+

📝 License

MIT — © kortoaus

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago