Skip to main content

SCPI Control of PRM3

Back to Main Power Relay Module (PRM3) Product Page.

SCPI introduction

SCPI (pronounced "skippy") stands for "Standard Commands for Programmable Instruments" and uses ASCII encoded strings. Com mands are entered one line at a time. Each line must end with a carriage-return (ASCII code 13) and/or line-feed character (ASCII code 10). Line length (including line terminators) is limited to at most 64 characters. Commands are caseinsensitive, so RELAY has the same meaning as relay, for example.

Most SCPI commands may be abbreviated to the first four characters. Required command characters are shown in upper case, optional ones in lower case. For example, MODBus indicates that the command may be abbreviated to just MODB.

Each SCPI command returns a single response-line which is terminated by a carriage-return line-feed sequence. The response is INVALID COMMAND if there was an error processing the command. If the command was processed successfully the response is OK or a command-specific response.

While SCPI convention normally would allow specifying multiple commands in a single line by separating the commands with a semicolon, the Power Relay Module does not support this convention and always expects a single command per line.

Connection and Power

The eGauge PRM3 unit communicates SCPI and gets power over the USB-A connection. The USB connection provides a CDC ACM virtual serial port for the host to communicate with using serial.

Serial Settings

The SCPI interface uses the following serial parameters:

  • 19200 baud
  • 1 start bit
  • 8 data bits, LSB first
  • no parity
  • 1 stop bit

SCPI commands

he SCPI commands supported by the Power Relay Module are shown below. The first column shows the syntax of the command, the second column the response type, and the third is a description of the command.

For response type devid, the return value consists of a string containing the manufacturer name, model name, product serial-number, and the product version, separated by commas. For example, the returned devid might be eGauge,PRM3,3N013453,1.00.

For response type status, the return value consists of either OK or INVALID COMMAND. For response type decimal, the return value consists of either INVALID COMMAND or a decimal integer number string. For response type parity, the return value consists of either INVALID COMMAND or a single character, where the character n indicates no parity, e indicates even parity, and o indicates odd parity.

When controlling polyphase loads, the mask commands should be used for simultaneous opening and closing of the multiple relay inputs.

Command Response Description
*IDN? devid Return device identifier
EPRom? decimal Return number of times the EEPROM has been written.
RELAy:n? decimal Query status of relay n. Returns string 0 if relay is open, 1 if it is closed.
RELAy:n cv status Open or close relay n. If cv is 0 or OFF, the relay is opened, if 1 or ON, the relay is closed.
RELAy:n:COUNt? decimal Return number of times relay n has been switched (opened or closed).
RELAy:MASK? decimal Query status of all relays. The returned number has bit (n-1) set if relay n is closed, cleared otherwise. For example, return value 6 would indicate that relay 1 is open and relays 2 and 3 are closed.
RELAy:MASK m status Open or close relays as indicated by mask m. If bit (n-1) is set, relay n is closed, otherwise it will be opened.
RELAy:MASK:SET m status Close relays as indicated by mask m. If bit (n-1) is set, relay n is closed, otherwise relay n will remain in its current state.
RELAy:MASK:CLR m status Open relays as indicated by mask m. If bit (n-1) is set, relay n is opened, otherwise relay n will remain in its current state.
RELAy:MIN:OFF? decimal Query the minimum duration for which a relay remains open. The returned number is the duration in seconds.
RELAy:MIN:OFF d status Set the minimum duration for which a relay remains open to d seconds. The duration must be an integer in the range from 0..255.
RELAy:MIN:ON? decimal Query the minimum duration for which a relay remains closed. The returned number is the duration in seconds
RELAy:MIN:ON d status Set the minimum duration for which a relay remains open to d seconds. The duration must be an integer in the range from 0..255.
MODBus:BAUD? decimal Returns the baud rate of the RS-485 port.
MODBus:BAUD n status Sets the RS-485 baud rate to n baud. The value of n may be one of 9600, 19200, 38400, 57600, or 115200.
MODBus:PARIty? decimal Returns the parity used for the RS-485 port.
MODBus:PARIty p status Sets the RS-485 parity. If p is n, no parity is selected, if e, even parity is selected, and if o, odd parity is selected.
MODBus:UNIT? decimal Returns the MODBUS unit number of the device.
MODBus:UNIT n status Sets MODBUS unit number of the device to n. The value of n may be in the range from 1 through 247.

Accessing the PRM3 from a Windows PC

eGauge Systems does not test or guarantee safety or accuracy of third party software.

Locate the COM port of the PRM3
  1. Open the Device Manager, which can be done by opening the Start Menu and typing "Device Manager" and clicking "Open":

  1. Expand the "Ports (COM & LPT)" section:

If you have multiple "USB Serial Device" entries, you may unplug the eGauge PRM3, and plug it back in to see which COM port appears when it is connected.

Connect to the COM port using PuTTY
  1. Install and open the PuTTY terminal emulator.

  2. Change "Serial line" to the COM port found in the device manager, the "Speed" to 19200 and "Connection type" to "Serial" and press Open:

  1. You may now enter SCPI commands followed by the "Enter" key.

Back-spaces may not work correctly and result in an invalid command error. Commands entered using copy and paste may also not work correctly and result in an invalid command error.