Skip to main content

Power API Reference

The Power API provides control over programmable power supplies for Device Under Test (DUT), USB ports, and current measurement through relay 4. Each DUT channel can supply -25V to +25V at up to 2A with precise current monitoring.

Accessing Powerโ€‹

const power = tester.power;

Power Module Methodsโ€‹

reset()โ€‹

Resets all power supplies to their default state (disabled).

await tester.power.reset();

Returns: Promise<void> / Awaitable[None]


dut(id)โ€‹

Access a specific DUT power supply channel.

const dut0 = tester.power.dut(0);

Parameters:

  • id (number / int): DUT channel identifier (0-based)

Returns: Dut instance


usb(id)โ€‹

Access a specific USB port for power control and monitoring.

const usb0 = tester.power.usb(0);

Parameters:

  • id (number / int): USB port identifier (0-based, typically 0-1)

Returns: Usb instance


relay_4()โ€‹

Access relay 4 for high-precision current measurement.

const relay4 = tester.power.relay_4();

Returns: RelayPower instance

note

This is a special relay with current measurement capability. Current measurement is done using a 0.33 Ohm shunt resistor, providing 1ยตA resolution up to 500mA.


Dut Classโ€‹

Programmable power supply for powering and testing devices.

reset()โ€‹

Resets the DUT channel to its default state (disabled).

await dut.reset();

Returns: Promise<void> / Awaitable[None]


configure(config)โ€‹

Configures the DUT power supply.

await dut.configure({
enabled: true,
target_voltage: 3.3
});

Parameters:

  • config (DutConfiguration):
    • enabled (boolean / bool, optional): Enable or disable the supply
    • target_voltage (number / float, optional): Target voltage (-25 to 25V)

Returns: Promise<DutState> / Awaitable[DutState] - Full state including measured voltage and current

Exceptions:

  • Throws validation error if target_voltage is outside the range [-25, 25]

enable(voltage) / power_up(voltage)โ€‹

Enables the DUT power supply at the specified voltage.

await dut.enable(12.0);  // Enable at 12V

Parameters:

  • voltage (number / float): Target voltage (-25 to 25V)

Returns: Promise<DutState> / Awaitable[DutState] - Updated state

Exceptions:

  • Throws validation error if voltage is outside the range [-25, 25]

disable() / power_down()โ€‹

Disables the DUT power supply.

await dut.disable();

Returns: Promise<DutState> / Awaitable[DutState] - Updated state with enabled: false


read()โ€‹

Reads the complete current state of the DUT supply.

const state = await dut.read();
console.log("Enabled:", state.enabled);
console.log("Target:", state.target_voltage, "V");
console.log("Actual:", state.voltage, "V");
console.log("Current:", state.current, "A");

Returns: Promise<DutState> / Awaitable[DutState] - Full state object


read_current()โ€‹

Reads only the current drawn by the DUT.

const current = await dut.read_current();
console.log("Current:", current, "A");

Returns: Promise<number> / Awaitable[float] - Current in amperes


read_voltage()โ€‹

Reads only the actual output voltage.

const voltage = await dut.read_voltage();
console.log("Voltage:", voltage, "V");

Returns: Promise<number> / Awaitable[float] - Voltage in volts


Usb Classโ€‹

USB port power control with monitoring capabilities.

reset()โ€‹

Resets the USB port to its default state (disabled).

await usb.reset();

Returns: Promise<void> / Awaitable[None]


configure(config)โ€‹

Configures the USB port power.

await usb.configure({
enabled: true
});

Parameters:

  • config (UsbConfiguration):
    • enabled (boolean / bool, required): Enable or disable USB power

Returns: Promise<UsbState> / Awaitable[UsbState] - Current state including voltage and current


enable()โ€‹

Enables USB port power.

await usb.enable();

Returns: Promise<UsbState> / Awaitable[UsbState] - Updated state with enabled: true


disable()โ€‹

Disables USB port power (power cycle).

await usb.disable();

Returns: Promise<UsbState> / Awaitable[UsbState] - Updated state with enabled: false


read()โ€‹

Reads the complete current state of the USB port.

const state = await usb.read();
console.log("Enabled:", state.enabled);
console.log("Voltage:", state.voltage, "V");
console.log("Current:", state.current, "A");

Returns: Promise<UsbState> / Awaitable[UsbState] - Full state object


read_current()โ€‹

Reads only the current drawn through the USB port.

const current = await usb.read_current();
console.log("USB Current:", current, "A");

Returns: Promise<number> / Awaitable[float] - Current in amperes


read_voltage()โ€‹

Reads the USB port voltage.

const voltage = await usb.read_voltage();
console.log("USB Voltage:", voltage, "V");

Returns: Promise<number> / Awaitable[float] - Voltage in volts


RelayPower Classโ€‹

Relay 4 with high-precision current measurement capability.

read()โ€‹

Reads the complete state including current measurement.

const state = await relay4.read();
console.log("Current through relay:", state.current, "A");

Returns: Promise<RelayState> / Awaitable[RelayState] - State object with current measurement


read_current()โ€‹

Reads only the current flowing through the relay.

const current = await relay4.read_current();
console.log("Relay 4 Current:", current, "A");

Returns: Promise<number> / Awaitable[float] - Current in amperes

note

Relay must be closed for current to flow and be measured. Bidirectional current measurement is supported.


Typesโ€‹

DutStateโ€‹

{
enabled: boolean,
target_voltage: number, // -25 to 25V
voltage: number, // Measured voltage -25 to 25V
current: number // Measured current in amperes
}

DutConfigurationโ€‹

{
enabled?: boolean,
target_voltage?: number // -25 to 25V
}

UsbStateโ€‹

{
enabled: boolean,
voltage: number, // Measured voltage
current: number // Measured current in amperes
}

UsbConfigurationโ€‹

{
enabled: boolean
}

RelayStateโ€‹

{
current: number // Measured current in amperes
}

Notesโ€‹

  • DUT channels support -25V to +25V at up to 2A per channel
  • USB ports provide standard 5V USB power with monitoring
  • Voltage measurements are highly accurate for precise verification
  • Current measurements allow for real-time monitoring and over-current detection
  • Always allow time for voltage stabilization after enable (100-200ms recommended)
  • Use disable() to safely power down before disconnecting devices
  • Relay 4 provides high-precision current measurement (1ยตA resolution, max 500mA) when closed
  • Monitor current during boot/startup to verify proper device initialization