Author Topic: Rigol DP832A automatic SCPI calibration script  (Read 629 times)

0 Members and 1 Guest are viewing this topic.

Offline taydin

  • Frequent Contributor
  • **
  • Posts: 514
  • Country: tr
Rigol DP832A automatic SCPI calibration script
« on: December 30, 2019, 03:25:55 pm »
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) [Select]
#!/bin/bash

VPOINTS=(
    0.0
    0.01
    0.03
    0.1
    0.2
    0.7
    1.0
    1.2
    1.7
    2.0
    2.3
    2.7
    3.0
    3.8
    4.2
    4.7
    5.1
    5.3
    5.6
    6.0
    6.5
    7.0
    8.0
    8.4
    9.0
    10.0
    11.0
    12.0
    13.0
    14.0
    15.0
    16.0
    17.0
    18.0
    19.0
    20.0
    21.0
    22.0
    23.0
    24.0
    25.0
    26.0
    27.0
    28.0
    29.0
    30.0
    31.0
    32.0
)

CPOINTS=(
    0.0
    0.001
    0.002
    0.005
    0.01
    0.02
    0.03
    0.04
    0.05
    0.06
    0.07
    0.08
    0.09
    0.1
    0.2
    0.3
    0.4
    0.5
    0.6
    0.7
    0.8
    0.9
    1.0
    1.2
    1.5
    1.7
    2.0
    2.2
    2.5
    2.7
    3.0
    3.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" ]; then
        REF=${VPOINTS[$POINT]}
    elif [ "$MODE" = "C" ]; then
        REF=${CPOINTS[$POINT]}
    else
        REF="somejunk"
    fi

    echo $REF
}

read_value ()
{
    if [ "$MODE" = "V" ]; then
        VALUE=`read_dmm_vdc`
    elif [ "$MODE" = "C" ]; then
        VALUE=`read_dmm_cdc`
    else
        VALUE="somejunk"
    fi

    echo $VALUE
}

calibration_loop ()
{
    echo "CH = $CH, MODE = $MODE, DEV = $DEV"

    write_ps_cmd ":output $CH,on"

    for (( POINT = 0; POINT < $NUMPOINTS; POINT++ )); do
        local REF=`read_ref $POINT`
        echo "POINT = $POINT, REF = $REF"
        write_ps_cmd ":calibration:set $CH,$MODE,$POINT,$REF,$DEV"
        sleep 2
        local VALUE=`read_value`
        echo "VALUE = $VALUE"
        write_ps_cmd ":calibration:meas $CH,$MODE,$POINT,$VALUE,$DEV"
    done

    write_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=$NUMV

    local DEV="1"
    calibration_loop

    local DEV="0"
    calibration_loop

    echo "SWITCH DMM to Current Measurement, press enter to continue ..."
    read

    MODE="C"

    local NUMPOINTS=$NUMC

    local DEV="1"
    calibration_loop

    local DEV="0"
    calibration_loop

    write_ps_cmd ":calibration:end `date +%d/%m/%Y`,$CH"
}

# put device into a known state
write_ps_cmd ":*RST"

calibrate_ch CH1 48 32

echo "SWITCH power supply output, press enter to continue ..."
read

calibrate_ch CH2 48 32

echo "SWITCH power supply output, press enter to continue ..."
read

calibrate_ch CH3 18 32
Real programmers use machine code!

My hobby projects http://mekatronik.org/forum
 
The following users thanked this post: Pinkus, thm_w, tv84, TurboTom, coromonadalix, RoGeorge, garrettm

Offline taydin

  • Frequent Contributor
  • **
  • Posts: 514
  • Country: tr
Re: Rigol DP832A automatic SCPI calibration script
« Reply #1 on: December 30, 2019, 03:28:36 pm »
Here is the setup:

1) Rigol DM3068 connected to the LAN

2) 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
Real programmers use machine code!

My hobby projects http://mekatronik.org/forum
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 2486
  • Country: ro
Re: Rigol DP832A automatic SCPI calibration script
« Reply #2 on: December 30, 2019, 03:32:40 pm »
Nice to have, thank you.   :)

How long does it take to make a full calibration?

Offline taydin

  • Frequent Contributor
  • **
  • Posts: 514
  • Country: tr
Re: Rigol DP832A automatic SCPI calibration script
« Reply #3 on: December 30, 2019, 03:37:50 pm »
Nice to have, thank you.   :)

How long does it take to make a full calibration?

Less than 10 minutes. I'm waiting 2 seconds for the DM3068 measurement to settle, maybe this can be reduced :)
Real programmers use machine code!

My hobby projects http://mekatronik.org/forum
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 2270
  • Country: ca
Re: Rigol DP832A automatic SCPI calibration script
« Reply #4 on: December 30, 2019, 10:39:23 pm »
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: [Select]
    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/dp832cal
https://www.eevblog.com/forum/testgear/rigol-dp832a-manual-calibration-question/?action=dlattach;attach=810120
« Last Edit: December 30, 2019, 10:41:11 pm by thm_w »
 

Offline taydin

  • Frequent Contributor
  • **
  • Posts: 514
  • Country: tr
Re: Rigol DP832A automatic SCPI calibration script
« Reply #5 on: December 31, 2019, 08:55:56 am »
So are you saying there are more points available in memory that are not accessible in manual calibration? That would be interesting.

Yes. 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.
Real programmers use machine code!

My hobby projects http://mekatronik.org/forum
 
The following users thanked this post: thm_w, RoGeorge

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 2486
  • Country: ro
Re: Rigol DP832A automatic SCPI calibration script
« Reply #6 on: December 31, 2019, 01:01:08 pm »
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.

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

Offline taydin

  • Frequent Contributor
  • **
  • Posts: 514
  • Country: tr
Re: Rigol DP832A automatic SCPI calibration script
« Reply #7 on: December 31, 2019, 01:30:48 pm »
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 SCPI  :)

Most 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
Real programmers use machine code!

My hobby projects http://mekatronik.org/forum
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 2486
  • Country: ro
Re: Rigol DP832A automatic SCPI calibration script
« Reply #8 on: December 31, 2019, 01:57:09 pm »
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).

Offline TurboTom

  • Frequent Contributor
  • **
  • Posts: 812
  • Country: de
Re: Rigol DP832A automatic SCPI calibration script
« Reply #9 on: December 31, 2019, 02:48:48 pm »
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...  ;)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf