AX3003P
Release 0.1
Jul 17, 2019
Contents
1 Overview 1
2 Table of contents: 3
2.1 Features. . . 3
2.2 Requirements. . . 3
2.3 Installation . . . 3
2.4 AX3003P package API documentation . . . 4
2.5 Examples . . . 6
Python Module Index 9
Index 11
ii
CHAPTER 1
Overview
This module provides an API for controlling AX3003P programmable power supply. It works on Linux, OSX, Win- dows and BSD.
Copyright (c) 2019 Krzysztof Adamkiewicz <kadamkiewicz835(at)gmail.com>
It is released under MIT license, see LICENSE for more details.
project page on GitHub:https://github.com/Bill2462/AX3003P
AX3003P, Release 0.1
2 Chapter 1. Overview
CHAPTER 2
Table of contents:
2.1 Features
• Enabling/disabling the output.
• OVP and OCP control.
• Voltage and current control.
• Output voltage, current and power measurements.
2.2 Requirements
• Python 2.7 or Python 3 and newer
• pySerial
2.3 Installation
his installs a package that can be used from Python (import AX3003P).
To install for all users on the system, administrator rights (root) may be required.
2.3.1 From PyPI
AX3003P can be installed from PyPI:
pip3 install AX3003P
Or in case of using Python 2.7:
AX3003P, Release 0.1
pip install AX3003P
2.3.2 From source
Download AX3003P sources from github: https://github.com/Bill2462/AX3003P. Unpack the archive, enter the AX3003P directory and run:
python3 setup.py install
Or in case of using Python 2.7 python setup.py install
2.4 AX3003P package API documentation
AX3003P Programmable Power Supply control library.
class AX3003P.AX3003P.AX3003P(device) Bases: object
AX3003P Programmable Power Supply control class.
Parameters device (Str) – Path to the serial port file. example: ‘/dev/ttyUSB0’
connect()
Connect to the power supply over the serial interface. Connects to the power supply over the serial inter- face.
Raises SerialException – If there is a problem with the serial port.
disableOcp()
Disable overvoltage protection.
disableOutput()
Disable the power supply output.
disableOvp()
Disable overvoltage protection.
disconnect()
Disconnect from the power supply. Closes serial connection to the power supply.
enableOcp()
Enable overvoltage protection.
enableOutput()
Enable the power supply output.
enableOvp()
Enable overvoltage protection.
measureCurrent()
Measure voltage on the power supply output. Function returns the current flowing througth the power supply terminals. in Amps. It returns None if the read operation has failed.
Returns Output current.
Return type Float
4 Chapter 2. Table of contents:
AX3003P, Release 0.1
measurePower()
Measure power delivered by the power supply output. Function returns the current power consumed by the load connected to the power supply termonals in Watts. It returns None if the read operation has failed.
Returns Output power.
Return type Float measureVoltage()
Measure voltage on the power supply output. Function returns the voltage across the power supply termi- nals in Volts. It returns None if the read operation has failed.
Returns Output voltage.
Return type Float ocpTripped()
Check if overcurrent protection has tripped. Returns True if overcurrent protection has tripped. Returns False if it hasn’t tripped. Returns None if error occured while checking the ovp state.
Returns True if ocp has tripped, False if it is not.
Return type Boolean outputEnabled()
Check if output is enabled. Returns the state of the power supply output. If output is enabled, True is Returned, if not, False is returned. None is returned if the read operation has failed.
Returns Power supply state.
Return type Boolean ovpTripped()
Check if overvoltage protection has tripped. Returns True if overvoltage protection has tripped. Returns False if it hasn’t tripped. Returns None if error occured while checking the ovp state.
Returns True if ovp has tripped, False if it is not.
Return type Boolean resetOcp()
Reset overcurrent protection.
resetOvp()
Reset overvoltage protection.
sendReadCommand(command, timeout=1000)
Send command and read response. Sends command to the power supply and reads the respinse. Timeout parameter can be used to determine how long shall te function wait for the response. If no response is received before the time runs out the function returns None. Otherwise the string containing response is returned. If timeout is set to None the function will wait until some data are received. This however can cause the program to freeze if no response is received due to for example communication error.
Parameters
• command (Str) – Command
• timeout (Int) – Timeout in ms
Returns Response or None if there is no response.
Return type Str
sendWriteCommand(command)
Send command to the power supply. Sends command to the power supply.
AX3003P, Release 0.1
Parameters command (Str) – Command setCurrent(current)
Set output current.
Parameters current (Float) – Output current in Amps.
setOcpTreshold(currentThreshold) Set overcurrent protection threshold.
Parameters currentThreshold (Float) – Current treshold in Amps.
setOvpTreshold(voltageThreshold) Set overvoltage protection threshold.
Parameters voltageThreshold (Float) – Voltage treshold in Volts.
setVoltage(voltage) Set output voltage.
Parameters voltage (Float) – Output voltage in Volts.
AX3003P.AX3003P.connect(device)
Open connection to the AX3003P. Connects to the AX3003P and returns the Power Supply control object. over the serial port. Path to the serial port file is given as device.
Parameters device (Str) – Path to the power supply.
Returns AX300P object.
Return type AX3003P
Raises SerialException – If there is a problem with the serial port.
2.5 Examples
2.5.1 Simple example
Hello world type example for the AX3003P programmable power supply library. This example sets the output voltage to 1V, output current to 0.01A, enables the output and then samples the output voltage and current for 30 seconds.
Usage
simple.py [device]
Example usage
simple.py /dev/ttyUSB0
simple.py:https://github.com/Bill2462/AX3003P/blob/master/examples/simple.py
2.5.2 Overcurrent and Overvoltage protection example
Example that demonstrates the overcurrent protection (OVP) and overvoltage protection (OVC). This script sets the OVP level to 5V and OCP to 0.3A. Then slowely increases the voltage until the OVP trips. Next the OVP is reseted and the same procedure is repeated with the OCP.
Usage
6 Chapter 2. Table of contents:
AX3003P, Release 0.1
testProtection.py [device]
Example usage
testProtection.py /dev/ttyUSB0
testProtection.py:https://github.com/Bill2462/AX3003P/blob/master/examples/testProtection.py
• genindex
AX3003P, Release 0.1
8 Chapter 2. Table of contents:
Python Module Index
a
AX3003P.AX3003P,4
AX3003P, Release 0.1
10 Python Module Index
Index
A
AX3003P(class in AX3003P.AX3003P),4 AX3003P.AX3003P(module),4
C
connect()(AX3003P.AX3003P.AX3003P method),4 connect()(in module AX3003P.AX3003P),6
D
disableOcp() (AX3003P.AX3003P.AX3003P method),4
disableOutput() (AX3003P.AX3003P.AX3003P method),4
disableOvp() (AX3003P.AX3003P.AX3003P method),4
disconnect() (AX3003P.AX3003P.AX3003P method),4
E
enableOcp()(AX3003P.AX3003P.AX3003P method), 4
enableOutput() (AX3003P.AX3003P.AX3003P method),4
enableOvp()(AX3003P.AX3003P.AX3003P method), 4
M
measureCurrent() (AX3003P.AX3003P.AX3003P method),4
measurePower() (AX3003P.AX3003P.AX3003P method),4
measureVoltage() (AX3003P.AX3003P.AX3003P method),5
O
ocpTripped() (AX3003P.AX3003P.AX3003P method),5
outputEnabled() (AX3003P.AX3003P.AX3003P method),5
ovpTripped() (AX3003P.AX3003P.AX3003P method),5
R
resetOcp()(AX3003P.AX3003P.AX3003P method),5 resetOvp()(AX3003P.AX3003P.AX3003P method),5
S
sendReadCommand() (AX3003P.AX3003P.AX3003P method),5
sendWriteCommand()
(AX3003P.AX3003P.AX3003P method),5 setCurrent() (AX3003P.AX3003P.AX3003P
method),6
setOcpTreshold() (AX3003P.AX3003P.AX3003P method),6
setOvpTreshold() (AX3003P.AX3003P.AX3003P method),6
setVoltage() (AX3003P.AX3003P.AX3003P method),6