KORAD KA3005P

The KORAD KA3005P is a programmable power supply unit.

The user does not need not call any methods. He can use the automatic delegation to easily set current and voltage by assigning values to the members of the same names.

Usage:

from htf.powersupply import KORAD_KA3005P

k = KORAD_KA3005P("COM3")

# set output to 4 V
k.voltage = 4
print(k.voltage)
# set current (maximum) to 0.5 A
k.current = 0.5
print(k.current)
class htf.powersupply.korad_ka3005p.KORAD_KA3005P(port, debug=False)

KORAD_KA3005P is a hardware abstraction to the KORAD KA3005P power supply unit using a UART to control it.

KORAD_KA3005P uses DelegatorMixin to automatically set and read it’s members voltage and current.

Parameters:
  • port (str) – the comport to be used, eg. “COM3”, 3 or “/dev/ttyUSB0”, etc.
  • debug=False (bool) – if set to True debugging is enabled.
close()

Close the serial member. This method is automatically called when __del__() is called.

disableOutput()

Disable output.

enableOutput()

Enable output.

Raises:SetOutputException – if output was not set.
getCurrentCurrent(channel=1)

Read the current current from device and return the result.

Parameters:channel (int) – the channel to use. Shall always be 1.
Returns:the current current.
Return type:float
getCurrentVoltage(channel=1)

Read current voltage from device and return the result.

Parameters:channel=1 (int) – the channel to use. Shall always be 1.
Returns:the current voltage.
Return type:float
getId()

Return the KORAD id.

Returns:the KORAD id.
Return type:str
getStatus()

Read device status and return a dictionary.

Returns:
the status dictionary containing the keys “ch1 mode”, “ch2 mode”, “tracking mode”, “beep”,
”lock” and “output”.
Return type:dict
query(query, lengthOfAnswer=None, retries=3)

Send a command and wait for the answer.

Parameters:
  • query (str) – the query to be sent.
  • lengthOfAnswer=None (int) – the maximum number of bytes to be received.
  • retries=3 – the number of retries.
Returns:

the answer.

Return type:

str

Raises:

TimeoutException – if a communication time-out occured.

sendCommand(command)

Directly send a command to the power supply unit.

Parameters:command (str) – the command to be sent.
setCurrent(current, channel=1)

Set the output current for a given channel.

Parameters:
  • current (int, float or str) – the current in units of amperes as int(), float() or string, eg. 0, 0.5, “0.5” or even “0.5 mA” work.
  • channel (int) – the channel to use. Shall always be 1.
Raises:

SetCurrentException – if current was not set.

setVoltage(voltage, channel=1)

Set the output voltage for a given channel.

If voltage is None the output is disabled. If voltage is not None the output is enabled. If voltage changes the output is first disabled, changed, and then enabled again.

Parameters:
  • voltage (float or None) – the voltage in units of volts as int(), float() or string, eg. 23, 23.0, “23.0”
  • even "23.0 V" work. (or) –
  • channel (int) – the channel to use. Shall always be 1.
Raises:

SetVoltageException – if voltage was not set.

exception htf.powersupply.korad_ka3005p.SetCurrentException

Exception that is raised if current was not set.

exception htf.powersupply.korad_ka3005p.SetOutputException

Exception that is raised if the output was not set.

exception htf.powersupply.korad_ka3005p.SetVoltageException

Exception that is raised if voltage was not set.

exception htf.powersupply.korad_ka3005p.TimeoutException

Exception that is raised if a communication time-out occurred.