Electronics::PSU::DPSxxxx - control a DPS power supply
Electronics::PSU::DPSxxxx
use Future::AsyncAwait; use Electronics::PSU::DPSxxxx; my $psu = Electronics::PSU::DPSxxxx->new( dev => "/dev/ttyUSB0" ); await $psu->set_voltage( 1.23 ); # volts await $psu->set_current( 0.200 ); # amps await $psu->set_output_state( 1 ); # turn it on!
This module allows control of a RDTech DPS-series power supply, such as the DPS3005, when connected over a serial port.
The interface is currently an ad-hoc collection of whatever seems to work here, but my hope is to find a more generic shareable interface that multiple different modules can use, to provide interfaces to various kinds of electronics test equipment.
The intention is that it should eventually be possible to write a script for performing automated electronics testing or experimentation, and easily swap out modules to suit the equipment available. Similar concepts apply in fields like DBI, or Device::Chip, so there should be plenty of ideas to borrow.
await $psu->set_voltage( $volts );
Sets the output voltage, in volts.
await $psu->set_current( $amps );
Sets the output current, in amps.
$volts = await $psu->read_output_voltage;
Returns the measured voltage at the output terminals, in volts.
$amps = await $psu->read_output_current;
Returns the measured current at the output terminals, in amps.
$volts = await $psu->read_input_voltage;
Returns the input voltage to the PSU module, in volts.
$protect = await $psu->read_output_protect;
Returns the output protection state as a string, either "ok" if protection has not been triggered, or one of "OVP", "OCP" or "OPP" if any of the protection mechanisms have been triggered.
"ok"
"OVP"
"OCP"
"OPP"
$mode = await $psu->read_output_mode;
Returns the output mode, as a string either "CV" for constant-voltage or "CC" for constant-current.
"CV"
"CC"
@readings = await $psu->read_multiple( @names )
Returns multiple measurements in a single query. This is faster than performing several individual read requests. @names should be a list of string names, taken from the read_... method names. For example:
@names
read_...
my ( $volts, $amps ) = await $psu->read_multiple(qw( output_voltage output_current ));
Results are returned in the same order as the requested names.
await $psu->set_output_state( $on );
Switches output on / off.
$model = await $psu->read_model;
Returns the model number (e.g. 3005 for DPS3005).
$version = await $psu->read_version;
Returns firmware version as an integer.
Paul Evans <leonerd@leonerd.org.uk>
To install Electronics::PSU::DPSxxxx, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Electronics::PSU::DPSxxxx
CPAN shell
perl -MCPAN -e shell install Electronics::PSU::DPSxxxx
For more information on module installation, please visit the detailed CPAN module installation guide.