Rigol DP832A automatic SCPI calibration script - Page 1
Forum section: electronics / testgear

author: taydin
author_rank: Frequent Contributor
timestamp: December 30, 2019, 03:25:55 pm
content: Hello guys, attached is a bash script that I have used to calibrate all 3 outputs of my DP832A in one go. There are other similar scripts around, but one notable diference with my script is that I have used more calibration points and I have given more points to the lower end of the voltages and currents. As a result, when I measure this power supply against my 2450 SMU it gives excellent results with at most 1 mV, 1 mA discrepancy. I haven't tested the other scripts, it might yield the same result, YMMV ...Code: (bash)#!/bin/bashVPOINTS=(0.00.010.030.10.20.71.01.21.72.02.32.73.03.84.24.75.15.35.66.06.57.08.08.49.010.011.012.013.014.015.016.017.018.019.020.021.022.023.024.025.026.027.028.029.030.031.032.0)CPOINTS=(0.00.0010.0020.0050.010.020.030.040.050.060.070.080.090.10.20.30.40.50.60.70.80.91.01.21.51.72.02.22.52.73.03.2)get_device_ip (){local DEVICE="$1"local IPADDR=`lxi discover | grep "$DEVICE" | grep -oe '[0-9\.]*$'`echo $IPADDR}get_dmm_ip (){get_device_ip DM3068}get_ps_ip (){get_device_ip DP832A}DMM_IP=`get_dmm_ip`PS_IP=`get_ps_ip`write_ps_cmd (){local CMD="$1"lxi scpi -a $PS_IP "$CMD"}write_dmm_cmd (){local CMD="$1"lxi scpi -t 10 -a $DMM_IP "$CMD"}read_dmm_vdc (){V_SCPI=`write_dmm_cmd ":meas:volt:dc?"`printf "%f\n" $V_SCPI}read_dmm_cdc (){write_dmm_cmd ":meas:curr:dc max"V_SCPI=`write_dmm_cmd ":meas:curr:dc?"`printf "%f\n" $V_SCPI}read_ref (){local POINT="$1"if [ "$MODE" = "V" ]; thenREF=${VPOINTS[$POINT]}elif [ "$MODE" = "C" ]; thenREF=${CPOINTS[$POINT]}elseREF="somejunk"fiecho $REF}read_value (){if [ "$MODE" = "V" ]; thenVALUE=`read_dmm_vdc`elif [ "$MODE" = "C" ]; thenVALUE=`read_dmm_cdc`elseVALUE="somejunk"fiecho $VALUE}calibration_loop (){echo "CH = $CH, MODE = $MODE, DEV = $DEV"write_ps_cmd ":output $CH,on"for (( POINT = 0; POINT < $NUMPOINTS; POINT++ )); dolocal REF=`read_ref $POINT`echo "POINT = $POINT, REF = $REF"write_ps_cmd ":calibration:set $CH,$MODE,$POINT,$REF,$DEV"sleep 2local VALUE=`read_value`echo "VALUE = $VALUE"write_ps_cmd ":calibration:meas $CH,$MODE,$POINT,$VALUE,$DEV"donewrite_ps_cmd ":output $CH,off"}calibrate_ch (){echo "Multimeter IP Address = $DMM_IP"echo "Power Supply IP address = $PS_IP"local CH="$1"local NUMV="$2"local NUMC="$3"write_ps_cmd ":calibration:start 11111,$CH"write_ps_cmd ":calibration:clear $CH,all"local MODE="V"local NUMPOINTS=$NUMVlocal DEV="1"calibration_looplocal DEV="0"calibration_loopecho "SWITCH DMM to Current Measurement, press enter to continue ..."readMODE="C"local NUMPOINTS=$NUMClocal DEV="1"calibration_looplocal DEV="0"calibration_loopwrite_ps_cmd ":calibration:end `date +%d/%m/%Y`,$CH"}# put device into a known statewrite_ps_cmd ":*RST"calibrate_ch CH1 48 32echo "SWITCH power supply output, press enter to continue ..."readcalibrate_ch CH2 48 32echo "SWITCH power supply output, press enter to continue ..."readcalibrate_ch CH3 18 32

author: taydin
author_rank: Frequent Contributor
timestamp: December 30, 2019, 03:28:36 pm
content: Here is the setup:1) Rigol DM3068 connected to the LAN2) Wires with banana jacks and enough current carrying capacity. I have used 1.5 mm2 multistrand wire.3) A linux PC with lxi-tools version 1.21 or later installed.The test starts with the DM3068 attached to the first output of the DP832A in voltage measurement mode. As the test progresses, it asks the jacks to be moved into the 10A current measurement position. After an output is complete, the script prompts the user to move to the next output. Attached is the output of my run

author: RoGeorge
author_rank: Super Contributor
timestamp: December 30, 2019, 03:32:40 pm
content: Nice to have, thank you.How long does it take to make a full calibration?

author: taydin
author_rank: Frequent Contributor
timestamp: December 30, 2019, 03:37:50 pm
content: Quote from: RoGeorge on December 30, 2019, 03:32:40 pmLess than 10 minutes. I'm waiting 2 seconds for the DM3068 measurement to settle, maybe this can be reduced

author: thm_w
author_rank: Super Contributor
timestamp: December 30, 2019, 10:39:23 pm
content: So are you saying there are more points available in memory that are not accessible in manual calibration? That would be interesting.For reference those points are (DAC1):Code:cal_dacv12 = [0.2, 0.5, 1.2, 2, 3.2, 4.1, 5.2, 6.9, 7.5, 8.7, 10.1, 11.8, 12.6, 13.5,15, 15.8, 16.5, 17.3, 18.5, 19.1, 19.9, 20.2, 20.8, 21.8, 22.4, 22.7,23.9, 24.3, 25.7, 26.9, 27.9, 28.5, 28.9, 29.8, 30.2, 32];https://github.com/stupid-beard/dp832calhttps://www.eevblog.com/forum/testgear/rigol-dp832a-manual-calibration-question/?action=dlattach;attach=810120

author: taydin
author_rank: Frequent Contributor
timestamp: December 31, 2019, 08:55:56 am
content: Quote from: thm_w on December 30, 2019, 10:39:23 pmYes. And here is how I concluded that:When I was calibrating my DP821A (which doesn't have any information about calibration points available, I searched) I did a hex dump of its firmware. And I saw that there are strings for the calibration constants from Volt_Set-1 and going up to Volt_Set-80. And same for current.And my observation is that using more points gives better accuracy, because the device seems to be interpolating a given value based on this table.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 31, 2019, 01:01:08 pm
content: Quote from: taydin on December 31, 2019, 08:55:56 amThis is a very nice finding, thank you.If we would know the interpolation algorithm (my guess is it's a linear interpolation, and not a higher grade polynomial interpolation), then we can first browse the whole range, then reverse the calculation for the interpolation such as all 80 points (or 160 if we count the current, too) are used to attain the minimal possible error.

author: taydin
author_rank: Frequent Contributor
timestamp: December 31, 2019, 01:30:48 pm
content: I will do the same calibration with the electronic load, too, but need to figure out how to supply 40A to it and also measure it using SCPIMost likely what I will do is to use my DP821A which goes up to 10.5A on the 8V output. I will use lots of calibration points up to 10.5A. For the rest, probably using a shunt to measure current would suffice. There's no need for 1 mA accuracy beyond 10A

author: RoGeorge
author_rank: Super Contributor
timestamp: December 31, 2019, 01:57:09 pm
content: I'll use a car battery to supply the high current + stabilizer with the transistor(s) kept inside a bucket full of water to avoid huge radiators.For SCPI control, probably a voltage to current converter (the freshly calibrated DP832A used as voltage reference for the voltage-current stabilizer).

author: TurboTom
author_rank: Super Contributor
timestamp: December 31, 2019, 02:48:48 pm
content: For this purpose, I got myself one of these phased-out, inexpensive 1kW server PSUs with a single output voltage of 12V. So they should be good for 80+A and my unit served me pretty well for calibrating the high current range of a load.To measure the current, I bought one of these (unfortunately discontinued) "Isabellenhütte" shunts with 10mR and four screw terminals (RTO-B-R010-1.0). After clamping it to a substantial heat sink in order to keep temperature change as small as possible, and accurately measuring its resistance, it is possible to achieve current measurement accuracies better than 0.1% at these high currents.Maybe just a little hint for those who are trying to achieve something similar...