Controlling the Power Supplies Through the Computer
Both the Keithley (High Voltage source) and the Keysight (LV and LVDS power supply) can be controlled through the computer. They are connected to each other and the computer through a GPIB connector bus, then controlled from python scripts (temporarily in
~/Desktop/Haugen/New_Scripts). These are based heavily on the scripts from timon and allow for powering on, powering off, ramping high voltage, performing an IV scan, and recording the data. There is documentation for the connector
here
.
The communication happens through a serial port name
/dev/ttyUSB0
Each device on the bus has to have a unique ID number between 0-30. I have set the Keysight supply to be ID 05, and the Keithley supply to be ID 10.
To change the ID:
- Keysight:
- press the I/O config button
- Select HPIB / 488 (if the screen shows this press I/O Config again, if not scroll the adjust wheel till it does)
- set the address
- Keysight:
- Press MENU
- select COMMUNICATION
- select GPIB
- set the address
- select GPIB protocol (SCPI)
While remote control through the GPIB connector is on, none of the buttons on either of the power supplies will be useable. Local control can be regained on either supply by pressing the "local" button
Code for Control
There is a large collection of scripts written for serial communication with the power supplies and the Arduino. These have all been written together in the python module
SerialCommands.py.txt. There is another module of root scripts for quick data analysis that is still being implemented
RootCommands.py. Lastly to make the interface with these sets of scripts much easier a third script has been written,
Console.py.txt. This is the program that should be run and should be able to do all of the interfacing with the power supplies and Arduino that is necessary.
SerialCommands.py
This is the raw code that is a combination of the scripts for the power supplies and the scripts for the Arduino. All of the communication is done through serial ports, and most of the functions defined in this module take the serial port as an argument (this is so that it does not need to be reopened with every function).
RootCommands.py
This is a small set of Root macros (written in python). Currently it only features functions that read the raw data files and converts the .dat files into .root files (with a TTree). Each of these files takes 2 inputs, the name of the .dat file, and what to name the new .root file.
Console.py
This is the more complicated function. It establishes the serial port for communication between the computer and the power supplies. It then queries the user for an input. To get help in Console.py enter
help, to get help with a certain command enter
[name of command] -h. Arguments for commands are entered with flags, each flag is separated with a space then the corresponding value is after that flag with another space, for example
read_arduino -f Arduino_Data.dat_ would read the Arduino data then save it to the file Arduino_Data.dat
Some flags/arguments are optional. These are all listed under the specific help for that command (the flag will be listed in brackets). for example the previous command could also be given as:
read_arduino
This would read the serial port for the Arduino and save the data to a default filename that is generated using the date.
If you prefer to avoid the Console.py interface then you can do this:
- run python
- import SerialCommands as ser
- open the serial port (s = ser.Open_Serial('/dev/ttyUSB0', 115200))
- run whatever command you want, for example to power on enter ser.Power_On(s,1.5,4.2). Almost all of the commands take the serial port as an argument
--
Tom-Erik Haugen - 2016-10-21
Comments