{"id":1270,"date":"2013-04-15T13:12:35","date_gmt":"2013-04-15T18:12:35","guid":{"rendered":"http:\/\/bardagjy.com\/?p=1270"},"modified":"2013-04-15T13:12:35","modified_gmt":"2013-04-15T18:12:35","slug":"agilent-e3631a-power-supply-accuracy","status":"publish","type":"post","link":"https:\/\/bardagjy.com\/?p=1270","title":{"rendered":"Agilent E3631A Power Supply Accuracy"},"content":{"rendered":"<div id=\"attachment_1324\" style=\"width: 620px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/IMG_0462.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1324\" src=\"http:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/IMG_0462-610x372.jpg\" alt=\"Measuring linearity and accuracy of the E3631A with a 33401A.\" width=\"610\" height=\"372\" class=\"size-large wp-image-1324\" srcset=\"https:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/IMG_0462-610x372.jpg 610w, https:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/IMG_0462-300x183.jpg 300w, https:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/IMG_0462-299x182.jpg 299w\" sizes=\"(max-width: 610px) 100vw, 610px\" \/><\/a><p id=\"caption-attachment-1324\" class=\"wp-caption-text\">Measuring linearity and accuracy of the E3631A with a 33401A.<\/p><\/div>\n<p>During the course of my thesis, the need for distraction &#8211; plus the need to save some labor inspired me to develop automated testing methods. <\/p>\n<p>I wrote a little previously about <a href=\"http:\/\/bardagjy.com\/?p=1245\">setting up PyVISA on OSX<\/a>, but didn&#8217;t show any real examples of its use. Here, as a proof of concept, I measure the linearity and accuracy of my <a href=\"http:\/\/www.home.agilent.com\/en\/pd-836433-pn-E3631A\/80w-triple-output-power-supply-6v-5a-25v-1a\">Agilent E3631A<\/a> triple output power supply with an <a href=\"http:\/\/www.home.agilent.com\/en\/pd-1000001295%3Aepsg%3Apro-pn-34401A\/digital-multimeter-6-digit\">Agilent 34401A<\/a>.<\/p>\n<p>I connect to both of the instruments with a <a href=\"http:\/\/www.amazon.com\/gp\/product\/B0007T27H8\">TRENDnet USB to RS-232 Serial Converter<\/a> based on the <a href=\"http:\/\/www.prolific.com.tw\/US\/ShowProduct.aspx?pcid=41&#038;showlevel=0041-0041\">Prolific PL-2303 chipset<\/a>. Just as before, I use <a href=\"http:\/\/ftp.ni.com\/support\/softlib\/visa\/NI-VISA\/5.1.2\/mac\/NI-VISA-5.1.2.dmg\">National Instruments VISA 5.1.2 for OSX<\/a> and <a href=\"http:\/\/pyvisa.sourceforge.net\/\">PyVISA<\/a>. In the NI-VISA Configuration application, all available VISA compatible adapters are listed. Serial adapters appear as ASRLx and GPIB adapters appear as GPIBx. <\/p>\n<h2>Measuring Accuracy and Linearity<\/h2>\n<p>In the code sample below, the six volt output of the E3631A is set to some voltage, and its output is measured with the 34401A. The measured and set voltages are stored in a CSV file for later processing.<\/p>\n<pre lang=\"python\" line=\"1\">\r\n#!\/usr\/bin\/env arch -i386 python\r\n\r\nfrom visa import *\r\nimport time, csv\r\n\r\n# CSV open file\r\nf = open('out.csv', 'w')\r\nwriter = csv.writer(f)\r\n\r\n# Agilent 34401A\r\ndmm_addr = 'ASRL1'\r\ndmm = SerialInstrument(dmm_addr, baud_rate=9600, data_bits=7, stop_bits=2, \r\n                       parity=even_parity, term_chars=CR+LF, \r\n                       end_input=term_chars_end_input, send_end=True, delay=1)\r\n\r\n# Set it up for remote access, reset to factory, remote again\r\nprint \"Resetting DMM\"\r\ndmm.write('SYST:REM')\r\ndmm.write('*RST')\r\ntime.sleep(20)\r\ndmm.write('SYST:REM')\r\nprint dmm_addr + \": \" + dmm.ask('*IDN?')\r\n\r\n# Agilent E3631A\r\npwr_addr = 'ASRL4'\r\npwr = SerialInstrument(pwr_addr, baud_rate=9600, data_bits=7, stop_bits=2, \r\n                       parity=even_parity, term_chars=CR+LF, \r\n                       end_input=term_chars_end_input, send_end=True, delay=1)\r\n\r\n# Set it up for remote access, reset to factory, remote again\r\nprint \"Resetting Power Supply\"\r\npwr.write('SYST:REM')\r\npwr.write('*RST')\r\ntime.sleep(20)\r\npwr.write('SYST:REM')\r\nprint pwr_addr + \": \" + pwr.ask('*IDN?')\r\n\r\n# Loop from 0 to 6 volts in 10mV increments cyc times\r\ncyc = 15\r\n\r\nvoltages = []\r\nvolt = 0\r\nfor cnt in range(600):\r\n\tvoltages.append(volt)\r\n\tvolt = volt + 0.01\r\n\r\nwriter.writerow(voltages)\r\n\r\nfor I in range(cyc):\r\n\ttarr = []\r\n\tfor J in range(len(voltages)):\r\n\t\tsetpoint = voltages[J]\r\n\t\t# Set the power supply to the setpoint\r\n\t\tpwr.write('APPL P6V, ' + str(setpoint) + '; OUTP ON')\r\n\t\t# Let the output settle 1 seconds\r\n\t\ttime.sleep(1)\r\n\t\t# Measure the output\r\n\t\tmeas = dmm.ask('MEAS:VOLT:DC? 10, MAX')\r\n\t\ttarr.append(meas)\r\n\t\t# Tell the user what's up\r\n\t\tprint(\"Cycle: \" + str(I) + \r\n\t\t\t  \" set:\" + str(setpoint) + \r\n\t\t\t  \"V meas:\" + str(meas) + \"V\")\r\n\t\t# Turn off the output\r\n\t\tpwr.write('OUTP OFF')\r\n\t# Write tarr to the file\r\n\twriter.writerow(tarr)\r\n\r\n# Close the file\r\nf.close()\r\n<\/pre>\n<p>There are a few notes about the above snippet. In the beginning of the script, each interface is set-up (lines 11, 12, 25, 26). Then each instrument is reset (lines 18, 19, 32, 33) and set in remote mode (lines 21, 25). <\/p>\n<p>To generate the list of voltages to cycle through, I use a <code>for<\/code> loop (lines 43-45) because the NumPy on my machine was only compiled for 64-bit Pythons.<\/p>\n<p>Other interesting snippets are those which set the output voltage of the power supply (line 54). In this line, the positive 6V rail (<code>P6V<\/code>) is set to its setpoint, and the output is turned on (<code>OUTP ON<\/code>). The DMM is then used in its 10V range to measure the voltage (line 58). <\/p>\n<h2>Plotting the Results<\/h2>\n<p>After letting the above script run overnight, a fat <code>.CSV<\/code> file is generated. With the following script, the results of the test are plotted.<\/p>\n<pre lang=\"python\" line=\"1\">\r\n#!\/usr\/bin\/python\r\n\r\nimport csv\r\nfrom pylab import * \r\n\r\nf = open('out.csv', 'r')\r\nreader = csv.reader(f)\r\ncols = zip(*reader) # transpose reader so it's columnwise\r\n\r\n# Measured data, set voltage, tolarance array (according to the datasheet)\r\ndata = []; setv = []; tol = []\r\n\r\n# Every 100mV\r\nfor col in cols[::10]:\r\n\t# Build the set voltage array\r\n\tsetv.append(float(col[0]))\r\n\t# Build the tolarance voltage array\r\n\ttol.append(float(col[0])*0.001+0.005)\r\n\t# Build the linearity array\r\n\tdata.append(map(lambda x: float(x) - float(col[0]), col[1:]))\r\n\r\n# Close the CSV file\r\nf.close()\r\n\r\n# Figure and axis\r\nfig = figure()\r\nax = fig.add_subplot(111)\r\nax.boxplot(data)\r\n\r\n# Titles and labels\r\nax.set_title(\"Agilent E3631A P6V Linearity\")\r\nax.set_xlabel(\"Set Voltage (volts)\")\r\nax.set_ylabel(\"Deviation from Set Voltage (volts)\")\r\n\r\n# Show every 500mV on the axis\r\naxlab = map(lambda x: x if x % 0.5 == 0 else \"\" ,setv)\r\nax.set_xticklabels(axlab, rotation = 45)\r\nax.fill_between(range(1,len(tol)+1), tol, tol*(-1*ones(len(tol))), \r\n\t\tfacecolor='yellow', alpha='0.25')\r\n\r\n# Display the figure\r\nshow()\r\n<\/pre>\n<h2>Results and Discussion<\/h2>\n<div id=\"attachment_1361\" style=\"width: 620px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/lin-copy.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1361\" src=\"http:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/lin-copy-610x457.png\" alt=\"Accuracy and linearity of the E3631A measured with the 34401A DMM.\" width=\"610\" height=\"457\" class=\"size-large wp-image-1361\" srcset=\"https:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/lin-copy-610x457.png 610w, https:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/lin-copy-300x225.png 300w, https:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/lin-copy-299x224.png 299w, https:\/\/bardagjy.com\/wp-content\/uploads\/2013\/04\/lin-copy.png 1200w\" sizes=\"(max-width: 610px) 100vw, 610px\" \/><\/a><p id=\"caption-attachment-1361\" class=\"wp-caption-text\">Accuracy and linearity of the E3631A measured with the 34401A DMM.<\/p><\/div>\n<p>Despite both the Agilent 34401A and the E3631A being both over ten years old &#8211; and over ten years since their last calibration &#8211; assuming the 34401A is still within its calibration specifications, the E3631A is still operating within its factory tolerances (indicated by the yellow trapezoid). <\/p>\n<p>The error bars indicate upper and lower quartiles, and the red bar indicates the average reading. Outliers are denoted by a &#8220;+&#8221;. The power supply was cycled overnight, 15 times per set voltage. The manufacturer specifications are denoted by the yellow trapezoid. The average readings all fall within the manufacturer specifications. <\/p>\n<p>There appears to be some latent structure in the deviation from the set voltage with may indicate range switching or some other mechanism within the power supply. Still with a maximum deviation from the set point no greater than 10mV, the instrument is quite accurate.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>During the course of my thesis, the need for distraction &#8211; plus the need to save some labor inspired me to develop automated testing methods. I wrote a little previously about setting up PyVISA on OSX, but didn&#8217;t show any real examples of its use. Here, as a proof of concept, I measure the linearity [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1271,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[8,19],"tags":[103,101,102,99,38,75,74,104,100,98],"_links":{"self":[{"href":"https:\/\/bardagjy.com\/index.php?rest_route=\/wp\/v2\/posts\/1270"}],"collection":[{"href":"https:\/\/bardagjy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bardagjy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bardagjy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bardagjy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1270"}],"version-history":[{"count":48,"href":"https:\/\/bardagjy.com\/index.php?rest_route=\/wp\/v2\/posts\/1270\/revisions"}],"predecessor-version":[{"id":1366,"href":"https:\/\/bardagjy.com\/index.php?rest_route=\/wp\/v2\/posts\/1270\/revisions\/1366"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bardagjy.com\/index.php?rest_route=\/wp\/v2\/media\/1271"}],"wp:attachment":[{"href":"https:\/\/bardagjy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bardagjy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bardagjy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}