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

@elkamarado/remote-voltmeter

v1.0.3

Published

TypeScript library for GW Instek GDM-9061 Digital Multimeter SCPI communication

Downloads

54

Readme

Remote Voltmeter - TypeScript SCPI Library

Professional TypeScript library for working with the GW Instek GDM-9061 digital multimeter using SCPI protocol (Standard Commands for Programmable Instruments) through network connection.

📋 Features

  • ✅ Full SCPI command support for GW Instek GDM-9061
  • ✅ TCP/IP connection support (RS232 through network gateway)
  • ✅ Complete TypeScript typing (types and interfaces)
  • ✅ Asynchronous API with Promise
  • ✅ Error handling and timeouts
  • ✅ Automatic reconnection
  • ✅ Events (connected, disconnected, error, timeout)
  • ✅ Support for multiple measurement modes
  • ✅ Trigger and display control

� Documentation

�📦 Installation

npm install

🏗️ Build

npm run build

📖 Usage

📟 Command-line Interface

A small CLI is provided with the package after installation. It wraps the primary driver and allows quick interaction without writing TypeScript code.

npx remote-voltmeter --help          # show global options and commands
npx remote-voltmeter info -h         # show per‑command help
npx remote-voltmeter info            # query instrument identification
npx remote-voltmeter measure vdc     # take DC voltage reading

The executable name corresponds to the bin field in package.json and will be installed globally if the package is installed with -g.

Basic Example

import VoltmeterDriver from '@elkamarado/remote-voltmeter';

const voltmeter = new VoltmeterDriver({
  host: '10.0.5.55',
  port: 3001,
  timeout: 5000,
});

// Connection
await voltmeter.connect();

// Get device information
const info = await voltmeter.getDeviceInfo();
console.log(info.model); // GDM-9061

// Measure DC voltage
const result = await voltmeter.measureVoltageDC();
console.log(`${result.value} V`);

// Disconnect
await voltmeter.disconnect();

🔧 API Methods

Connection and Initialization

// Connect to device
await voltmeter.connect();

// Disconnect from device
await voltmeter.disconnect();

// Get device information
const info = await voltmeter.getDeviceInfo();

// Reset device
await voltmeter.reset();

// Check connection
const connected = voltmeter.isConnected();

Voltage Measurements

// DC Voltage (constant)
const vdc = await voltmeter.measureVoltageDC('10V');
// Result: { value: 5.123, unit: 'V', function: 'VDC', timestamp: ... }

// AC Voltage (alternating)
const vac = await voltmeter.measureVoltageAC('100V');

// Automatic range (default)
const auto = await voltmeter.measureVoltageDC('AUTO');

Current Measurements

// DC Current (constant)
const idc = await voltmeter.measureCurrentDC('1A');

// AC Current (alternating)
const iac = await voltmeter.measureCurrentAC('10A');

Resistance Measurements

// Resistance
const resistance = await voltmeter.measureResistance('1kΩ');
// Result: { value: 1234.56, unit: 'Ω', ... }

// Continuity test (buzzer mode)
const continuity = await voltmeter.continuity();

// Diode test
const diode = await voltmeter.diodeTest();

// Frequency measurement
const frequency = await voltmeter.measureFrequency();

Range Control

// Set range manually
await voltmeter.setRange('100V');

// Enable automatic range selection
await voltmeter.enableAutoRange();

// Disable automatic range selection
await voltmeter.disableAutoRange();

Trigger Operations

// Configure trigger
await voltmeter.setTrigger({
  source: 'MANUAL',      // 'BUS', 'INTERNAL', 'EXTERNAL', 'MANUAL'
  delay: 0,              // delay in seconds
  count: 1,              // number of measurements
});

// Initiate trigger
await voltmeter.triggerInitiate();

// Get value from trigger memory
const value = await voltmeter.triggerFetch();

Display Control

// Display text on screen (max 6 characters)
await voltmeter.displayText('HELLO');

// Clear display
await voltmeter.clearDisplay();

// Display control (on/off, brightness)
await voltmeter.setDisplay({
  enabled: true,
  text: 'TEST',
  brightness: 100,
});

Diagnostics and Status

// Get operation status
const opStatus = await voltmeter.getOperationStatus();

// Get questionable status
const questionStatus = await voltmeter.getQuestionableStatus();

// Get and clear error
const error = await voltmeter.getError();
await voltmeter.clearErrors();

📊 Data Types

MeasurementFunction

type MeasurementFunction =
  | 'VDC'        // DC Voltage
  | 'VAC'        // AC Voltage
  | 'IDC'        // DC Current
  | 'IAC'        // AC Current
  | 'RESISTANCE' // Resistance
  | 'CONTINUITY' // Continuity
  | 'DIODE'      // Diode test
  | 'FREQUENCY'  // Frequency
  | 'PERIOD'     // Period
  | 'TEMPERATURE'// Temperature
  | 'CAPACITANCE'// Capacitance

MeasurementResult

interface MeasurementResult {
  value: number;              // Numeric value
  unit: string;               // Unit of measurement
  function: MeasurementFunction;
  timestamp: number;          // Measurement time (ms)
}

ConnectionOptions

interface ConnectionOptions {
  host: string;               // Device IP address
  port: number;               // SCPI port (usually 3001)
  timeout?: number;           // Command timeout (ms)
  reconnect?: boolean;        // Automatic reconnection
  reconnectInterval?: number; // Reconnection interval (ms)
}

🎞️ Events

voltmeter.on('connected', () => {
  console.log('Device connected');
});

voltmeter.on('disconnected', () => {
  console.log('Device disconnected');
});

voltmeter.on('error', (err) => {
  console.error('Error:', err);
});

voltmeter.on('timeout', (err) => {
  console.error('Timeout:', err);
});

voltmeter.on('unsolicited', (data) => {
  console.log('Unsolicited data:', data);
});

💡 Examples

Example 1: Simple Measurement

const voltmeter = new VoltmeterDriver({
  host: '10.0.5.55',
  port: 3001,
});

try {
  await voltmeter.connect();
  
  const result = await voltmeter.measureVoltageDC();
  console.log(`Voltage: ${result.value} V`);
  
  await voltmeter.disconnect();
} catch (error) {
  console.error('Error:', error);
}

Example 2: Multiple Measurements

const measurements = [];

for (let i = 0; i < 10; i++) {
  const result = await voltmeter.measureVoltageDC();
  measurements.push(result.value);
  
  // Pause between measurements
  await new Promise(resolve => setTimeout(resolve, 1000));
}

const average = measurements.reduce((a, b) => a + b) / measurements.length;
console.log(`Average value: ${average} V`);

Example 3: Event Handling

voltmeter.on('connected', () => {
  console.log('✓ Connected');
});

voltmeter.on('error', (err) => {
  console.error('✗ Error:', err.message);
  // Automatic reconnection may occur
});

await voltmeter.connect();

🔌 SCPI Commands

The library supports the following SCPI commands:

  • Identification: *IDN?, *RST, *CLS
  • Configuration: CONFigure:VOLTage:DC/AC, CONFigure:CURRent:DC/AC, CONFigure:RESistance, etc.
  • Measurements: MEASure?, MEASure:VOLTage:DC?, MEASure:CURRent:DC?, etc.
  • Range: RANGE, RANGE:AUTO ON/OFF
  • Trigger: TRIGger:SOURce, TRIGger:DELay, TRIGger:COUNt, INIT, FETCh?
  • Display: DISPlay, DISPlay:TEXT, DISPlay:CLEar, DISPlay:BRIGhtness
  • Status: STATus:OPERation?, STATus:QUEStionable?, STATus
  • System: SYSTem:ERRor?, SYSTem:TIME

The complete list of commands is defined in the ScpiCommand enum in src/types.ts.

⚙️ Technical Details

SCPI Protocol

  • Interface: TCP/IP (RS232 through network gateway)
  • Port: 3001 (typical for GDM-9061)
  • Encoding: UTF-8
  • Command separator: \n (added automatically)

Command Processing

  • All commands are asynchronous and return Promise
  • Commands are queued when sent
  • Device responses are matched with sent commands
  • Default timeout is 5000ms for each command

🐛 Error Handling

try {
  await voltmeter.connect();
  const result = await voltmeter.measureVoltageDC();
} catch (error) {
  if (error.message === 'Not connected') {
    console.log('No connection to device');
  } else if (error.message.includes('timeout')) {
    console.log('Command took too long to execute');
  } else {
    console.log('Unknown error:', error);
  }
}

📝 License

MIT

👨‍💻 Author

Created for the Remote Voltmeter Control System project

🔗 Links

  • GW Instek GDM-9061 Manual
  • SCPI standard: IEEE 488.2