Computer Interface for HP/Agilent 3457A - Page 1
Forum section: electronics / projects

author: MikeDombo
author_rank: Unknown
timestamp: April 06, 2015, 04:21:43 am
content: Hey everyone!I'm creating a python based interface for my new HP 3457A using a GPIB to USB interface. I'll upload updates here.It has pretty much all the features of the Agilent/Keysight 34461A including large readout, trend plot, histogram, and statistics.I also included all the HP's specifications so that it can show the range of possible values from the nominal reading.If anyone is experienced in Python, then I would really appreciate help with the code.With python 2.7 installed, double click on the dmm_control script and then make sure that all the dependencies are installed.You can find the code at githubhttps://github.com/md100play/HP3457A-GPIB/And here is a screenshot of the user interface.

author: cellularmitosis
author_rank: Unknown
timestamp: April 06, 2015, 06:57:04 am
content: I have a GPIB'ed 3457a and some Python experience, and will definitely be taking a look at this after work tomorrow. Excited!

author: dom0
author_rank: Super Contributor
timestamp: April 06, 2015, 09:06:33 am
content: Writing a driver for python-ivi and then using it would make your project entirely independent of any specific GPIB HBA.

author: MikeDombo
author_rank: Unknown
timestamp: April 06, 2015, 02:13:51 pm
content: Quote from: dom0 on April 06, 2015, 09:06:33 amRight. The GPIB to usb adapter the I ordered should be prologix compatible like most others, so it isn't too specific.

author: lincoln
author_rank: Regular Contributor
timestamp: April 07, 2015, 07:02:52 pm
content: Giggity, My USB=> GPIB adapter was put in the post yesterday.....

author: MikeDombo
author_rank: Unknown
timestamp: April 07, 2015, 07:18:54 pm
content: Quote from: lincoln on April 07, 2015, 07:02:52 pmNice. I'm still waiting for mine from Galvant.ca, he said they should be shipping soon. Once I get that, I can actually test my code

author: radioFlash
author_rank: Regular Contributor
timestamp: April 08, 2015, 02:42:51 am
content: I have the the Agilent usb to GPIB adapter and had problems getting a response from the 3457A. It turns out that I had to issue the command "END ALWAYS" first to get the 3457A to assert set the GPIB End or identity (EOI) line when the last byte of the response is sent. I'm not sure if this will be needed for other drivers or adapters.

author: chickenHeadKnob
author_rank: Super Contributor
timestamp: April 08, 2015, 03:17:42 am
content: Quote from: radioFlash on April 08, 2015, 02:42:51 amOooH Thanks! I have got to try this in the next few days! I have a Galvant rev 3.2 version 5.0 software(I think) bought it around a year ago and couldn't get completely reliable communications out of it and my 3457. It seemed a to be a handshaking type of scenario where the 3457 would only occasionally accept commands, although I could get it to continuously dump readings. Ended up proper frustrated and said to myself "i will debug this later" putting the adapter on the shelf. Of course life happens and later never comes.

author: MikeDombo
author_rank: Unknown
timestamp: April 08, 2015, 11:05:48 pm
content: Code is now updated to work, maybe. I still don't actually have the equipment to test if the code is working, so, help me out if you can.Again, the code is on github athttps://github.com/md100play/HP3457A-GPIBI also compiled the code for windows if you don't want to install python and the dependencieshttps://github.com/md100play/HP3457A-GPIB/raw/master/dmm_control.zip

author: lukaq
author_rank: Regular Contributor
timestamp: April 09, 2015, 03:30:06 am
content: I think I will have to stay on 232, since there is no cheap GPIB to get

author: MikeDombo
author_rank: Unknown
timestamp: April 09, 2015, 04:53:44 pm
content: Quote from: lukaq on April 09, 2015, 03:30:06 amI don't know what you consider cheap, but this is the one that I'm getting.http://galvant.ca/shop/gpibusb/

author: lukaq
author_rank: Regular Contributor
timestamp: April 09, 2015, 05:23:54 pm
content: Quote from: MikeDombo on April 09, 2015, 04:53:44 pmthat would be ok, BUT if I would be 100% sure it would work with this meter and such as 34401a, where would be a big step up from 232. If I would even need that... probably on some fast changing signal maybe, would there be difference?

author: MikeDombo
author_rank: Unknown
timestamp: April 09, 2015, 08:55:01 pm
content: So I just got the 3457a in today, still waiting for the GPIB. The 3457a is in fantastic condition, and whoever owned it before really took care of it. After opening it up a bit I saw that it was made around '97 and it says it has been calibrated 84 times since then. So that is about 4.5 times every year! Crazy.Looking forward to getting the GPIB so I can see if my code actually works, and of course to fix it when it doesn't.

author: steerex
author_rank: Newbie
timestamp: April 11, 2015, 09:12:06 pm
content: Yo,I am working on a similar project using a HP3497A with built-in multimeter. The biggest advantage to this device is that it can monitor many channels where the typical multimeter cannot. It does have the disadvantage of not having the ability to do A/C voltage, current, resistance measurements without some additional hardware. It's simple enough to add some additional circuitry so the additional functions are easily implemented.Currently I am working with just one channel but, will add additional terminals / connections as time permits. Most of my other instruments like timer counters, power supplies, digital I/O, and other DAQ devices are HPIB enabled so, as time permits, I will be building applications and interfaces for those as well. Ultimately, I'd like to have a fairly complete ATE system.I have a HP3050E LAN/HPIB bridge so, I'm using that to talk to the data acquisition control unit from my Linux box. Using Linux / Python / VXI11, which are all free. Using that combination, you can talk to almost to almost any HPIB device without spending a bunch of money.I am not a "real" programmer and just started learning Python so that I could do this project. The program is far from finished and does not have all the bells and whistles (yet), but has demonstrated the practicality of such a project. My first objective was to get something really primitive working and I have done that. Later, I'll try to post some screen shots.

author: MikeDombo
author_rank: Unknown
timestamp: April 11, 2015, 11:19:10 pm
content: Sounds really cool, I'd love to see what you've come up with.

author: lincoln
author_rank: Regular Contributor
timestamp: April 15, 2015, 05:18:35 am
content: Quote from: MikeDombo on April 07, 2015, 07:18:54 pmOk, got my Galvant.ca usb/gpib in the post yesterday. got it up and running with the DMM, some weirdness. the unit will not respond to ID?; I can get the dmm to beep, change ranges and stream results like chickenHeadKnob but a single measurements will not report. I will give your software a try in the morning...

author: MikeDombo
author_rank: Unknown
timestamp: April 15, 2015, 02:43:09 pm
content: Quote from: lincoln on April 15, 2015, 05:18:35 amI don't have my adapter yet, so I wouldn't be surprised if my software didn't do anything, although I am hopeful and have written it to comply with the HPIB spec in the 3457a manuals.

author: lincoln
author_rank: Regular Contributor
timestamp: April 15, 2015, 06:02:10 pm
content: Hello MikeDombo,Yep, at least the complied version you posted doesn't seem to work. On run what looks like a black console windows opens and a dialog box opens on top of that (asking for com port). I enter the com and click ok, the dialog gos away. The console window is not responsive and nothing else happens. On the adapter the RX light flashes, then the error light flashes. So some thing is up. I don't have python installed on the work machine yet, let me work on that....link

author: MikeDombo
author_rank: Unknown
timestamp: April 15, 2015, 06:07:18 pm
content: If you hold shift and right click then click "open command window here" then run the program from the command line so you can see any error messages before it closes.I also modified the code slightly, and I just uploaded the new precompiled version.

author: lincoln
author_rank: Regular Contributor
timestamp: April 15, 2015, 06:25:38 pm
content: Ok, done that.entering the correct com port the dialog box closes and no errors are printed, control dose not return to the Dos window.Entering the com port of one of my hardware (unattached) serial ports causes the program to crash and gives :C:\Users\<my user name>\sbin\dmm_control\dmm_control>dmm_control.exeTraceback (most recent call last):File "<string>", line 577, in <module>File "<string>", line 196, in __init__File "<string>", line 190, in nextFile "<string>", line 508, in setComFile "C:\Users\Mike\Desktop\build\dmm_control\out00-PYZ.pyz\HP_3457A", line 16, in __init__File "C:\Users\Mike\Desktop\build\dmm_control\out00-PYZ.pyz\serial.serialwin32", line 38, in __init__File "C:\Users\Mike\Desktop\build\dmm_control\out00-PYZ.pyz\serial.serialutil", line 282, in __init__File "C:\Users\Mike\Desktop\build\dmm_control\out00-PYZ.pyz\serial.serialwin32", line 82, in openFile "C:\Users\Mike\Desktop\build\dmm_control\out00-PYZ.pyz\serial.serialwin32", line 202, in _reconfigurePortValueError: Cannot configure port, some setting was wrong. Original message: WindowsError(87, 'The parameter is incorrect.')

author: MikeDombo
author_rank: Unknown
timestamp: April 15, 2015, 06:32:29 pm
content: alright. can you download the latest code, it now prints what it is doing with the serial line, so you should have a sense of how if fails hopefully.

author: macboy
author_rank: Super Contributor
timestamp: April 15, 2015, 06:57:35 pm
content: Quote from: MikeDombo on April 09, 2015, 08:55:01 pmActually the calibration count increments by 1 foreach stepin the procedure, and there are many steps in a complete calibration.

author: MikeDombo
author_rank: Unknown
timestamp: April 15, 2015, 07:01:51 pm
content: Quote from: macboy on April 15, 2015, 06:57:35 pmYep, you are correct, I only saw that while reading the service manual after I had posted that.

author: onlooker
author_rank: Frequent Contributor
timestamp: May 03, 2015, 07:01:52 pm
content: I hope this would not side track the OP too much. I too had a project to interface my PC with HP3457A. I worked on it on and off for some time. Mostly, I was curious to learn how the GPIB and serial communication work here and what I was after is something that is "sort of working".Now, the stage of "sort of working" is here (all buttons are working, but not necessarily working correctly every time). This also means a sort of end of the project since better the program was not what I was after.The GPIB controller I had was an NI "GPIB-232 CT-A" I acquired from Ebay a while back for about $30. The USB-serial adapter was also a cheap ($2) ch340 type.The program was specifically coded against this GPIB controller. The attached picture shows the GUI look for the very 1st time-plot test for a PD5020.The code was based on QT5.4 (GUI and serial communication). The plot code was based on QCustomPlot. It turns out that QCustomPlot is a very capable and easy to use code.

author: MikeDombo
author_rank: Unknown
timestamp: May 03, 2015, 07:05:08 pm
content: Quote from: onlooker on May 03, 2015, 07:01:52 pmLooks pretty nice, is the code available somewhere? I will be getting back to work on my program shortly because the GPIB adapter should be arriving this week.

author: MikeDombo
author_rank: Unknown
timestamp: May 23, 2015, 03:12:41 am
content: So, I finally can post and say that Galvant.ca delivered the adapter and I am back to development.Here is the link to the first working version of the code -https://github.com/md100play/HP3457A-GPIB/blob/master/dmm_control.zipThere are still tons of bugs and many features that some users may want. I would really appreciate help on this since it is python and open source on github.Thanks for everyone's support.

author: eas
author_rank: Frequent Contributor
timestamp: May 31, 2015, 08:19:26 am
content: Thanks for posting this!I've been making my own plans to do something similar with my Keithley2000 + Scan card. I'm thinking of using iPython Notebook + a streaming plotting option, but I'll check out your project

author: MikeDombo
author_rank: Unknown
timestamp: May 31, 2015, 11:34:38 pm
content: Quote from: eas on May 31, 2015, 08:19:26 amSounds cool, I'd love to see it. I tried to write my code to be somewhat interchangeable, so you can just rewrite the HP3457A.py file to speak the lingo of the keithley 2000.

author: croc_klok
author_rank: Newbie
timestamp: August 01, 2016, 08:19:34 pm
content: Hello, I have a question. I am trying with the GPIB from this link"http://egirland.blogspot.nl/2014/03/arduino-uno-as-usb-to-gpib-controller.html". When I try with the terminal and do ++read I get the display information from the hp 3457a. When I use your software with terminal python dmm_control.py I get the dialog to say choose COMPORT and after that it freeze. What am I doing wrong ?? Hope you can help me. I would like to use your software.

author: MikeDombo
author_rank: Unknown
timestamp: August 01, 2016, 08:23:14 pm
content: Quote from: croc_klok on August 01, 2016, 08:19:34 pmUsing an Arduino, I'd bet that the baud rate is incorrect. You'll have to download the python source and edit the file HP3457A.py to change the baud rate.You may also have to change the setup commands that are in the setup method at the top of the file.

author: croc_klok
author_rank: Newbie
timestamp: August 01, 2016, 08:59:16 pm
content: I change the baud rate to 115200. but still the same. Could you maybe help me what I should change ??

author: MikeDombo
author_rank: Unknown
timestamp: August 01, 2016, 09:19:33 pm
content: Look at the __init__ method in HP_3457A.py.Make sure the HP3457A is set to address 22, or change the address in the python file. Try removing the ++eoi, ++eos, and ++read_tmo_ms commands.Make sure the number of stop bits and parity bits is correct.

author: croc_klok
author_rank: Newbie
timestamp: August 01, 2016, 10:44:41 pm
content: When I put to original and change only the baud rate to 115200 and delete this part.if "HP3457" not in self.readline():print "check connections and settings"self.ser.write('DCV\r\n')self.ser.write('TRIG SYN\r\n')The program start to run. but no data is going in. What is going wrong ??so this is the code:def readline(self):result = bytearray()c = 0while c != '\r':c = self.ser.read(1)result += creturn str(result)def __init__(self, com):self.gotPlc = Falseself.plc = 10self.digits = '7.5'self.ser = serial.Serial(com, 115200, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=3)self.ser.write('++rst\r\n')time.sleep(2)self.ser.write('++addr 2\r\n')self.ser.write('++eoi 0\r\n')self.ser.write('++eos 0\r\n')self.ser.write('++read_tmo_ms 5000\r\n')self.ser.write('END ALWAYS\r\n')self.ser.write('ID?\r\n')def getOffset(self, unit, value):digit = self.getDigits()

author: croc_klok
author_rank: Newbie
timestamp: August 02, 2016, 10:24:55 am
content: Ah oke I find out that it going wrong with ID?self.ser.write('ID?\r\n')self.ser.write('++read\r\n')if "HP3457" not in self.readline():print "check connections and settings"When I delete this the functions buttons on the right side work and make the meter go to DCV,ACV,ohm ..... and more.But no value's goes in to your software.Whats here the problem ??

author: DavidKo
author_rank: Frequent Contributor
timestamp: May 09, 2019, 08:02:44 pm
content: Thanks MikeDombo for the nice program. I have had only the issue that I'm using Agilent 82357B USB interface which is accessible through VISA. I have thought about LabView interface, but when I opened the Python script, I have found out that it is easier to modify it (I have never used python before) than learn LabView (which has only obsolete library which cannot be converted).I have also deleted function read() in HP_3457A.py which have been used only few times and I have not found the reason for it.

author: sairfan1
author_rank: Frequent Contributor
timestamp: January 15, 2021, 03:16:52 pm
content: @onlooker this is exactly what i was looking for, shared screen is from software developed in .py or its some other software? where from can i download for Win 10, one more thing I want to monitor current in nano amps (around 50nA) is it possible with this meter and software,@MikeDombo I never worked in python it could be hard for me to download code from github and compile, is there some already compiled version for Win 10,thanks.

author: sairfan1
author_rank: Frequent Contributor
timestamp: April 29, 2021, 09:03:46 pm
content: @DavidKo why are you importing visa library to this? still its not working for me, did anyone else tested this updated code?While running the program when i give Serial port i listen that device is disconnected and then connects again.@MikeDombo which python version did you use, I'm trying with 3.9

author: DavidKo
author_rank: Frequent Contributor
timestamp: December 10, 2021, 09:01:00 pm
content: Sorry for late reply. I'm using VISA GPIB interface. But in the meantime I have switched to software from Nx-1997https://www.eevblog.com/forum/testgear/hp-34401a-standalone-software/