Installing the library
Getting started, installation of python, modules and the library. Link to the : https://github.com/elc-construction-electronique/Librairie-Python-ALR32XX
Last updated
Getting started, installation of python, modules and the library. Link to the : https://github.com/elc-construction-electronique/Librairie-Python-ALR32XX
Last updated
Python is available for free and can be downloaded from this site . We advise you to download the latest version of Python for better compatibility with our modules.
Then follow the standard installation program.
In this folder you will find:
ALR32XX.py Library: main program to communicate with the power supplies.
An example folder.
A Documentation folder with the notices of the power supplies and a list of the functions of the class.
You can find information and the version of the library with the command "pip show ALR32XX" and, if necessary, update it with "pip install ALR32XX --upgrade".
Here is an example of this manipulation:
The file we are interested in is ALR32XX.py, it contains the functions to control the power supplies.
The command to include it in your script is:
Now it is time to connect the power supply to the computer via a USB, RS232 or RS485 connection. The Device Manager displays the connection to one of the COM ports and the power supply displays a USB or REM connection:
To initialise communication with the power supply, create a variable for your power supply as below:
The program will then attempt an automatic connection by sending a message to each active COM port and if it finds the one corresponding to the power supply it will start a serial link and tell you the details:
If the automatic connection attempt fails, you will be asked to connect the power supply manually using the Choix_port() function. This function will list your active ports and ask you to enter the number of the port to be connected:
Once the connection is successful, you can use the library's functions to control the power supply. As the ALR32XX module is developed as a class, the syntax for use is in the form variable.function(parameter), for example to measure the voltage of channel 1:
List of available functions
Here is the list of functions available via the ALR32XX library with a short explanation.
List_ports(): displays the active COM ports
Choix_port(): procedure for connecting the power supply manually. Display the active ports and select the desired port.
Deconnexion(): stop serial communication with the power supply.
IDN() : read the identity of the power supply, returns the name of the power supply and its version.
send_command(command): basic function to send any message to the power supply. The function returns the response from the power supply.
Ecrire_tension(value=0, channel=1): write a voltage setpoint on the selected channel between 1 and 3. The value in Volt (V) evolves according to the parameters of the power supply.
Ecrire_courant(value=0, channel=1): write a current setpoint on the selected channel between 1 and 2. The value in Amperes (A) evolves according to the parameters of the power supply.
Mesure_tension(channel=1): measure the voltage on the selected channel between 1 and 2 (for multi-channel models).
Mesure_courant (channel=1): measure the current on the selected channel between 1 and 3 (for multi-channel models).
Consigne_tension (channel=1): read the voltage setpoint on the selected channel between 1 and 3 (for multi-channel models).
Consigne_courant (channel=1): read the current setpoint on the selected channel between 1 and 2 (for multi-channel models).
OUT(mode=’ ‘, channel=1): Connect or not the output terminals, mode=ON or OFF (or 0 or 1) and channel=1 to 3.
MODE(mode=’NORMAL‘): modification of the output coupling between NORMAL, SERIE, PARALLELE and TRACKING.
TRACK(mode=’ISOLE’): activates the tracking mode between ISOLE and COUPLE.
OVP(value=0, channel=1): write an OCP (Over Voltage Protection) value on the selected channel between 1 and 2.
OCP(value=0, channel=1): write an OCP (Over Current Protection) value to the selected channel between 1 and 2.
OVP_OCP(parameter='OVP', channel=1): read the OCP or OVP values depending on the selected channel between 1 and 2.
Read_state_ALR(parameter=’OUT’): read the selected parameter from OUT (output status), REM (local or remote mode), TRACK (isolated or coupled tracking mode), MODE (serial or parallel mode).
Remote(mode=’REMOTE’): change in the mode of communication between LOCAL and REMOTE.
STO(memory_box): save the current configuration in a memory box between 1 and 15.
RCL(memory_box): recall the current configuration of a memory cell between 1 and 15.
This list of functions is detailed in the "Documentation" folder of the library.
Our ALR32XX module uses existing Python libraries, some of them are included in the Python installation but one module requires an additional installation, this one is called PySerial. You will find a tutorial for the installation of Python and the module via this link: .
It is also possible to download the PySerial module via the Pip utility with the command "pip install pyserial". Follow this link for more details:
Once you have downloaded Python and the additional module, you can download our ALR32XX library via our : .
It is also possible to download our library via the pip utility of with the command: pip install ALR32XX.