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 There is another module of root scripts for quick data analysis that is still being implemented Lastly to make the interface with these sets of scripts much easier a third script has been written, 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.

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).

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.

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 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:


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 interface then you can do this:

  1. run python
  2. import SerialCommands as ser
  3. open the serial port (s = ser.Open_Serial('/dev/ttyUSB0', 115200))
  4. 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


Topic attachments
I Attachment HistorySorted descending Action Size Date Who Comment
Texttxt r2 r1 manage 9.0 K 2016-10-28 - 22:54 TomErikHaugen  
Texttxt r2 r1 manage 8.4 K 2016-10-28 - 22:54 TomErikHaugen  
Unknown file formatEXT Makefile r1 manage 0.8 K 2016-10-21 - 22:54 TomErikHaugen  
C source code filecpp SerialCom.cpp r1 manage 1.8 K 2016-10-21 - 22:54 TomErikHaugen  
Header fileh SerialCom.h r1 manage 0.7 K 2016-10-21 - 22:54 TomErikHaugen  
Unknown file formatcxx power_off.cxx r1 manage 2.3 K 2016-10-21 - 22:54 TomErikHaugen  
Unknown file formatcxx power_on.cxx r1 manage 4.2 K 2016-10-21 - 22:54 TomErikHaugen  
Unknown file formatcxx start_mon.cxx r1 manage 3.7 K 2016-10-21 - 22:54 TomErikHaugen  
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r8 - 2016-11-02 - TomErikHaugen
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback