EEVblog Electronics Community Forum

Products => Test Equipment => Topic started by: quantumvolt on November 06, 2013, 08:43:37 am

Title: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: quantumvolt on November 06, 2013, 08:43:37 am
A prototype of an external display/monitor/instrument controller for RS232 equipped DMM. C++ code on an AVR uC. Controlled by Processing sketch via USB>Serial-uC. Can trig and do simple remote control of the meter via RS232. Stores high speed continuous sampling to EEPROM.

Next: Buy 10 inch TFT display, make menu (buttons, PS2 keyboard in remote location, touch screen). Make advanced real time statistics. Graphics. Enable write to file on PC. Utilize simple GPIB predefined set up from notepad files.

[#05] A Voltage Reference Lab Experiment: ADR441 "Burn-In"/Ageing 1000 Hours 10 ICs (https://www.youtube.com/watch?v=ugZCWuIpES4#)
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: Lightages on November 06, 2013, 06:48:34 pm
Now this is a cool idea even if I am not sure how practical it is.  :-+
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: dr.diesel on November 06, 2013, 06:51:06 pm
not sure how practical it is.  :-+

The coolest stuff never is!
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: robrenz on November 06, 2013, 07:05:24 pm
Nicely done! :-+
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: quantumvolt on November 06, 2013, 11:36:30 pm
Thanks.

Yes, many of my ideas are may be too much effort for a one off gadget and may never be realized.

But code for a histogram and a "scope" plot is easy to find and modify, and all you need of data is the RS232 stream from the DMM. Imagine this on a 10 inch color TFT LCD (USD 60 on fleabay with free driver code).

(http://www.testequity.com/Images/new/agilent/34460A-34461A-725.jpg)

BTW I already have a "noise-plot" in C++ for Arduino running in Processing on the PC. Not many lines, and directly portable from Processing to the Arduino IDE.

Agilent 34401A Resolves 5.0 Volt to 1 ppm in RS232 (7+ Digit mode) (https://www.youtube.com/watch?v=E3BaI33r82Q#ws)
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: timb on November 07, 2013, 12:27:10 am
Very cool! I like the idea of adding a color screen for logging. You should add a Bluetooth to Serial module on it, that way you could move it around! (Or use one of those really cheap nL-Whatever 900MHz based serial transceivers.)

I actually started work on a project similar to this awhile back, only mine is going to be a general purpose GPIB controller for older equipment. Initially I was going to use recovered NEC µPD7210 or NI NAT7210 (which are $15 drop in replacement chips) to handle the GPIB side of things and then just interface to that via an MSP430. The plan was to use 7" or so touchscreen and a TI CC3000 WiFi chip.

The idea is you have a web page on the unit for configuration where you can add instruments connected to the GPIB bus. So say you had a Keithley 197A multimeter you wanted to talk to you, you'd have a drop down menu for various types of instruments (DMM, Power Supply, Scope, Logic Analyzer, etc.) and after selecting that it would give you a series of boxes where you could type the GPIB command for various functions. So you'd tell it what commands read data, change modes, trigger and so forth.

Now that device would show up on the LCD with real time data, plots and logging options. The WiFi module could also be used to save data logs, upload predefined configuration files for various instruments and even turn the thing into a real network based GPIB port for your PC (for use in LabView or something).
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: grenert on November 07, 2013, 02:32:12 am
I think this is a great idea to be able to see the extra digits not available normally on the DMM screen.
You can get that extra digit through the interface, but that would usually require a PC.
Plus, with the big display you could have all sorts of nice graphical data without having to buy a fancy new meter!   ;)
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: Harvs on November 07, 2013, 02:48:42 am
Imagine this on a 10 inch color TFT LCD (USD 60 on fleabay with free driver code).

I got one of those screens a while back to play with.  While I'm sure they're not all the same, I have to say I was disappointed with the image quality.  The colour depth and contrast we're use to seeing on decent monitors and tablets was vastly lacking.

This is just my opinion, and I know there are some individuals on here that are up in arms whenever anyone mentions it, but just sticking a RS232 to bluetooth module on the meter and writing some software for a $75 android tablet would probably end in a better result, not to mention cheaper and much much easier development.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: quantumvolt on November 07, 2013, 03:08:32 am
Thanks a lot. WiFi and Bluetooth are things that I have seen in action, but know nothing about. Three months ago I didn't know what RS232 was and used a full day to find out that I had to set DSR/DTR ? (I've forgotten already) high in order to get the DMM to send any data at all.

Obviously - looking at my childrens tablets - a cheap Chinese 90 USD tablet as they have is the perfect solution. I will freeze my DIY stuff immediately - I have too much tinker-gadgets half-finished as it is.

But - and here is the point - on this forum most people just hand out fancy words about all kinds of hi-tech modern solutions as if it was the smallest problem in the world to fix it in a few minutes.

So give me something to work with. Where do I find or how do I make a RS232 to Bluetooth thing? What is the protocol? How do I find the signal in the tablet? How do I program and compile in a tablet? Or how do I import .exe programs to the tablets? In short - give me enough info to get it done ...

Let's get some balls here  >:D
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: alm on November 07, 2013, 06:44:12 am
Most Bluetooth modules (for example this one (https://www.sparkfun.com/products/12575)) will do SPP (UART over Bluetooth). I believe Android supports Bluetooth SPP (rfcomm) out of the box. It looks like this page (http://www.intorobotics.com/how-to-develop-simple-bluetooth-android-application-to-control-a-robot-remote/) contains some relevant links for developing Bluetooth SPP applications for Android.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: quantumvolt on November 07, 2013, 07:09:45 am
Thanks. Very good. Looks very Arduino-friendly. So since I am a newbie to it I will start by transmitting BT from the DMM and receive it with an Arduino board with a BT Shield and a 3.2" TFT (USD12 - I have one). Than I have the wireless part tested out on the simple and cheap.

And the robot link for using the tablet also seems to be my kind of thing - a large group of madmen and nerds who willingly share and help.

Thanks again. You made my day. Project redefined. F#kk da Null-Modem-Cable! To all of you who have substancial knowledge and info: If there is more, keep it coming  :D

Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: TiN on November 07, 2013, 02:31:43 pm
Might need FPGA for 10" TFT tho :)
But for sure, it can be a nice addon for benchtable, specially if make it support few interfaces like GPIB/RS232, add support of different tools.
Maybe even make open project so contributors can add their own support for needed tools :)

LabView is nice starting point too, it have already lots of libraries for existing equipment and can be used as a backbone.  ;)
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: Harvs on November 08, 2013, 12:52:18 am
Sure ok, fair point that people often swing terms around.

The hard part about this one isn't anything to do with the bluetooth etc, it's getting to know android development enough to make a decent app.  The upside to that is there's an absolute abundance of high quality tutorials on youtube to get you started, and if you get stuck there's a 99.9% chance someone has asked the same question on stackoverflow. It makes the size of the arduino community pale into insignificance comparatively.

So as alm suggested, you can just grab any bluetooth module that supports serial protocol and wire it in with a RS232 level converter.  Or, you can spend a bit more money and get it complete like:
http://www.ebay.com/itm/Bluetooth-to-Serial-Adapter-BTLink-Bluetooth-RS232-Class1-100m-BT232-EXT-/221309255366 (http://www.ebay.com/itm/Bluetooth-to-Serial-Adapter-BTLink-Bluetooth-RS232-Class1-100m-BT232-EXT-/221309255366)

By hooking that up, now grab a PC with bluetooth (e.g. most laptops these days) you should now be able to pair with it, fire up a terminal program and talk to the meter just like it was connected with a serial port (i.e. the bluetooth module will look just like another comm port.)  There's really no need to be bothered with arduino test programs unless you really want to.

So with that done and tested, it's over to learning to make android apps.  Bluetooth is handled with sockets on Android, this may seem a bit complicated at first to set up, but it's not too bad.  However, once you get the hang of using sockets on android, you'll be pleased to know that communicating via wifi is almost the same so it's worth learning.  The google android developer docs are very thorough, but sometimes can leave you wondering where to start.  At that point, best bet is to look at someone elses tutorial/project, however always do that while referring back to the google docs for what each command is doing.  I've often found that so called tutorials out there have been written by someone who has got it working, yet has little idea themselves as to why.

I'm kind of busy at the moment as I have a class to teach tomorrow at my hackerspace, but if I get the chance I'll write a small app that'll help you get started.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: sprocket on November 08, 2013, 12:46:46 pm
Interesting project. I'll be following it and see how it goes for you as I have a similar project in mind that I'm in the starting phase of. Though mine is not a multimeter, but a tuchscreen interface for a 15V/30A liniar lab PSU.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: quantumvolt on November 09, 2013, 03:12:16 am
Thanks again. The info from alm and harvs is enough. I don't need real spoon feeding  ::). The BT part seems easy -  just need some cash for the 2 BT devices. The plug w. antenna and an Arduino BT shield (I want one even if I don't need it) is on my budget. And the Bluetooth Serial Port Profile is almost universal. Very good.

I just wanted to be sure I didn't repeat my helpless first RS232 job (but I succeeded). I left electronics when crystal radios, tubes and Germanium transistors was all I could afford (mid 1960s), and started up again a few months ago. And in those months I have also gone from my former university programming in FORTRAN on VAC Punchcards to C++ on Arduino, AVR (studio) and now ARM M3. All good.

Here is my RS232 debut (I didn't even have a cable or level shifter):

34401A DMM - Arduino Real-time Serial to PC (https://www.youtube.com/watch?v=MlueATxwNnI#)

Thanks again, all. I'll be back when I have the BT hardware.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: SArepairman on November 09, 2013, 05:04:49 am
can you post the code etc so I can build one?
i don't care if its a rough prototype
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: quantumvolt on November 09, 2013, 07:15:06 am
Absolutely barebone - tested. The trigger is optional - unless you choose Single Trig the DMM will just stream data (so throw out the trig code). Set DB9 pin 6 DSR high 5V. Two wires needed for read only - DMM Tx to Arduino and ground. Level shift and inversion/polarity of high low is all over internet (and flebay RS232-TTL converter USD 2-5). Guess you know (I didn't).

For more - search 'Arduino serial DB9', 'Arduino software serial' and ' Arduino 1602 I2C' and you can read until you puke  :o. As it is supposed to be a dialect of C++ code, you can tweak it into any uC with the needed similar libraries. Of course there is more to it than just reading the string from the DMM and echo it to the PC. That's the DIY part ...

Code: [Select]
#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

SoftwareSerial mySerial(10, 11); // RX, TX RS232 - DMM TX to Arduino Digital Pin 10
LiquidCrystal_I2C lcd(0x27,16,2);  // I2C 16 chars 2 lines I2C display addr. 20 or 27, fleabay USD 5-6

String inData;
int trigpin = 13;  // your choice


void setup() 
{
  pinMode(trigpin, OUTPUT);     
  Serial.begin(9600); // Serial hardware to PC
  // Serial.println("Setup");
  mySerial.begin(9600);  // SoftwareSerial port to DMM
  lcd.init();  // I2C to 1602 Display
  lcd.backlight();
  lcd.print("Init LCD");
  delay(1000);
  // Trigger
  digitalWrite(trigpin, HIGH);
  inData = ""; // Clear read buffer
  lcd.clear();
}

void loop()
{
  digitalWrite(trigpin, LOW); //
  delay(10); // adjust
  digitalWrite(trigpin, HIGH);
  //delay(5); 
  // Serial.println("trig");

  delay(1000);  // or whatever

  while (mySerial.available() > 0)
  {
    char recieved = mySerial.read();
    inData += recieved;

    // Process message when new line character is recieved
    if (recieved == '\n')
    {
      Serial.print("Arduino Received: ");
      Serial.println(inData);
      inData = inData.substring(0, inData.length()-7); // cut exponent for test, see DMM manual for string format
      lcd.clear();

      lcd.print(inData);
      lcd.print(" Str"); // a string - not a number - unparsed for exponent
      // delay(1000);
      inData = "";
    }
  }









Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: george graves on November 09, 2013, 07:30:32 am
subscribe!
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: bingo600 on November 09, 2013, 04:40:20 pm
I'd suggest a RasPI as the "logic" ....
HDMI out and also a serial in.

Get a cheap PC-Screen with HDMI/DVI & off you go.
You could use mathplotlib or whatever for statistics.

/Bingo
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: timb on November 10, 2013, 04:18:11 am
I'd suggest a RasPI as the "logic" ....
HDMI out and also a serial in.

Get a cheap PC-Screen with HDMI/DVI & off you go.
You could use mathplotlib or whatever for statistics.

/Bingo

That's what I was thinking as well. Even if you don't want to go the HBMI route you could still get a cheap 5"+ touchscreen (SPI or 16-bit parallel interface) off eBay to use with the fbtft (https://github.com/notro/fbtft) driver so it shows up as any other frame buffer device (letting you use it for console and Xorg access). Then just get a USB bluetooth dongle plus bluetooth transceiver (http://www.amazon.com/Arduino-Wireless-Bluetooth-Transceiver-Module/dp/B0093XAV4U/ref=sr_1_1?ie=UTF8&qid=1384056359&sr=8-1&keywords=bluetooth+serial) and you'll be in business! (I own one of those transceivers and can vouch for the functionality.)

You could even throw on a USB GPIB adapter (plus linux-gpib drivers) and you'd have easy access to a whole range of scopes and other devices.

That FBTFT project really is pretty awesome. I've used it for some $15 Chinese screens with great success! Here's a couple of pictures where I'm driving a 2.8" touchscreen over SPI:

(http://img.timb.us/FBTFT_1.jpg)

(http://img.timb.us/FBTFT_2.jpg)

(http://img.timb.us/FBTFT_3.jpg)
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: bingo600 on November 10, 2013, 07:36:30 am
I'd suggest a RasPI as the "logic" ....
HDMI out and also a serial in.

Get a cheap PC-Screen with HDMI/DVI & off you go.
You could use mathplotlib or whatever for statistics.

/Bingo

You could even throw on a USB GPIB adapter (plus linux-gpib drivers) and you'd have easy access to a whole range of scopes and other devices.

Do you have linux-gpib running wit a USB-GPIB adapter ?

I have been trying to build a working HP-USB driver for linux-gpib , on the RasPI.
But i haven't succeded yet ... I have gotten it to build ok , but when i load it the RasPI stops (I guess crashes) , as the only way to get it going is power off/on. No messages in the log or .....

I'm using the distro from RasPI foundation , but apparently they don't think that a "Kernel Header" package is a nice thing to provide for their users.
And that might be the cause , that the symbolfile doesn't match the kernel vers.
I have also been seriously figthing the modules buildprocess to get it to build with armhf (hard float)
Apparently my Raspi won't do that by default  :(

I am seriously thinking about switching to Raspian (witch apparently isn't the same build as the one from the RasPI site) , it seems like they do provide a hernel header package.
I am just worried if they have the same number of pre-build packages as the one i use now.
But it's really strange that people have been complaining for more than a year now , about the missing kernel headers. And the foundation doesn't make a packagr

This post (issue) , was the one hinting that the Raspian kernel isn't the one - The foundtion uses
https://github.com/raspberrypi/linux/issues/382 (https://github.com/raspberrypi/linux/issues/382)
https://bugs.launchpad.net/raspbian/+bug/1228643 (https://bugs.launchpad.net/raspbian/+bug/1228643)


And this one might be the reason i can't get it to work , it seems like the foundation even have FSCK'ed up somewhere in the "Kludge" we need to do, in order get the right symbols for the kernel currently used on the RasPI.
https://github.com/raspberrypi/linux/issues/387 (https://github.com/raspberrypi/linux/issues/387)


If anyone have it working , please give some tips here ....

/Bingo

Edit:
I have 2 of these http://www.ebay.de/itm/190923137633 (http://www.ebay.de/itm/190923137633)
Is supposed to work with the RasPI FB driver
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: timb on November 10, 2013, 09:20:48 am
There is no "official" Raspbian image. The Raspberry Pi Foundation does a debootstrap of Raspbian and then adds their own packages, drivers and tweaks. Their version is designed for normal users and isn't designed for power users who would be doing things that required the kernel headers, so it's rather a moot point.

If you don't want to debootstrap your own version then I suggest you grab Hexxeh's image (and his awesome update tool) plus the headers from the GitHub repository. Raspbian is the provider of the package repository that the foundation uses as well, so you won't have problems obtaining packages. ;)

Another option is Arch Linux, which is what I generally use. I'm pretty sure I got linux-GPIB working on it back in August, but I'd have to go through my notes to make sure.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: bingo600 on November 10, 2013, 10:20:19 am
There is no "official" Raspbian image. The Raspberry Pi Foundation does a debootstrap of Raspbian and then adds their own packages, drivers and tweaks. Their version is designed for normal users and isn't designed for power users who would be doing things that required the kernel headers, so it's rather a moot point.

If you don't want to debootstrap your own version then I suggest you grab Hexxeh's image (and his awesome update tool) plus the headers from the GitHub repository. Raspbian is the provider of the package repository that the foundation uses as well, so you won't have problems obtaining packages. ;)

Another option is Arch Linux, which is what I generally use. I'm pretty sure I got linux-GPIB working on it back in August, but I'd have to go through my notes to make sure.

I like debian ...

Could you point me to a recent kernel by Hexxeh , and does he update them ?

Is there any reason i shouldn't just run the kernel from Raspian ?
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=71&t=29326 (http://www.raspberrypi.org/phpBB3/viewtopic.php?f=71&t=29326)

TIA
Bingo
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: bingo600 on November 11, 2013, 05:18:12 pm
Heyy ....

This might mean success on building linux-gpib for the RasPi

Nov 11 18:14:13 raspberrypi-3 kernel: [ 1667.085542] Linux-GPIB 3.2.19 Driver
Nov 11 18:14:13 raspberrypi-3 kernel: [ 1667.113930] agilent_82357a_gpib driver loading
Nov 11 18:14:13 raspberrypi-3 kernel: [ 1667.114100] usbcore: registered new interface driver agilent_82357a_gpib
Nov 11 18:14:13 raspberrypi-3 kernel: [ 1667.114119] gpib: registered agilent_82357a interface

/Bingo
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: bingo600 on November 11, 2013, 09:26:23 pm
Yes

I have a working linux-gpib on a RasPI

This means i can do measurements with a 3..5 Watt linux computer.
And basically have a $40 + ($79 for GPIB) network enabled GPIB adapter.


The Beiming USB-GPIB adapter is $79 , and works the same way as the
Agilent under linux-gpib.
And afaik also with Aglent drivers under windows ==> Visa , i haven't
tried windooze.

http://www.ebay.com/itm/S82357-GPIB-USB-interface-compatible-with-Agilent-82357B-/181253216568 (http://www.ebay.com/itm/S82357-GPIB-USB-interface-compatible-with-Agilent-82357B-/181253216568)
I have been working with them during the last 4 months to test their new
linux compatible firmware.



This is a snip from the kernel.log

Code: [Select]





Nov 11 20:22:06 raspberrypi-3 kernel: [  184.631539] Linux-GPIB 3.2.19 Driver
Nov 11 20:22:06 raspberrypi-3 kernel: [  184.664507] agilent_82357a_gpib driver loading

*** Agilent insert

Nov 11 20:22:06 raspberrypi-3 kernel: [  184.664681] usbcore: registered new interface driver agilent_82357a_gpib
Nov 11 20:22:06 raspberrypi-3 kernel: [  184.664702] gpib: registered agilent_82357a interface
Nov 11 20:22:39 raspberrypi-3 kernel: [  218.065122] usb 1-1.3: USB disconnect, device number 4
Nov 11 20:22:41 raspberrypi-3 kernel: [  219.837498] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
Nov 11 20:22:41 raspberrypi-3 kernel: [  219.937934] usb 1-1.3: New USB device found, idVendor=0957, idProduct=0518
Nov 11 20:22:41 raspberrypi-3 kernel: [  219.937963] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Nov 11 20:22:55 raspberrypi-3 kernel: [  233.427209] usb 1-1.3: USB disconnect, device number 5
Nov 11 20:22:57 raspberrypi-3 kernel: [  235.197578] usb 1-1.3: new high-speed USB device number 6 using dwc_otg
Nov 11 20:22:57 raspberrypi-3 kernel: [  235.299248] usb 1-1.3: New USB device found, idVendor=0957, idProduct=0718
Nov 11 20:22:57 raspberrypi-3 kernel: [  235.299280] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=5
Nov 11 20:22:57 raspberrypi-3 kernel: [  235.299298] usb 1-1.3: Product: 82357B ()
Nov 11 20:22:57 raspberrypi-3 kernel: [  235.299315] usb 1-1.3: Manufacturer: Agilent Technologies, Inc.
Nov 11 20:22:57 raspberrypi-3 kernel: [  235.299330] usb 1-1.3: SerialNumber: MY4945xxxx
Nov 11 20:22:57 raspberrypi-3 kernel: [  235.309402] probe succeeded for path: usb-bcm2708_usb-1.3
Nov 11 20:23:20 raspberrypi-3 kernel: [  258.549769] attached to bus interface 0, address 0xdb5e0000
Nov 11 20:23:20 raspberrypi-3 kernel: [  258.568586] agilent_82357a_attach: attached
Nov 11 20:27:21 raspberrypi-3 kernel: [  499.191299] usb 1-1.3: USB disconnect, device number 6
Nov 11 20:27:21 raspberrypi-3 kernel: [  499.191651] agilent_82357a_driver_disconnect: exit

*** Beiming insert

Nov 11 20:28:22 raspberrypi-3 kernel: [  560.873199] usb 1-1.3: new high-speed USB device number 7 using dwc_otg
Nov 11 20:28:23 raspberrypi-3 kernel: [  561.205274] usb 1-1.3: New USB device found, idVendor=0957, idProduct=0718
Nov 11 20:28:23 raspberrypi-3 kernel: [  561.205304] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=5
Nov 11 20:28:23 raspberrypi-3 kernel: [  561.205321] usb 1-1.3: Product: S82357 ()
Nov 11 20:28:23 raspberrypi-3 kernel: [  561.205337] usb 1-1.3: Manufacturer: BEIMING Technologies, Inc.
Nov 11 20:28:23 raspberrypi-3 kernel: [  561.205352] usb 1-1.3: SerialNumber: CP1001xxxx
Nov 11 20:28:23 raspberrypi-3 kernel: [  561.215169] probe succeeded for path: usb-bcm2708_usb-1.3
Nov 11 20:29:37 raspberrypi-3 kernel: [  635.696267] gpib0: exiting autospoll thread
Nov 11 20:29:37 raspberrypi-3 kernel: [  635.696388] agilent_82357a_detach: detached
Nov 11 20:29:37 raspberrypi-3 kernel: [  635.696526] attached to bus interface 0, address 0xda1b7000
Nov 11 20:29:37 raspberrypi-3 kernel: [  635.715456] agilent_82357a_attach: attached
Nov 11 20:31:32 raspberrypi-3 kernel: [  750.316900] /home/pi/raspi/linux-gpib-code/linux-gpib/drivers/gpib/agilent_82357a/agilent_82357a.c: agilent_82357a_read: agilent_82357a_receive_bulk_msg timed out, bytes_read=0, extra_bytes_read=1
pi@raspberrypi-3 ~ $





root@raspberrypi-3:~# lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0957:0518 Agilent Technologies, Inc. 82357B GPIB Interface
root@raspberrypi-3:~# fxload -t fx2 -D /dev/bus/usb/001/004 -I /usr/share/usb/agilent_82357a/measat_releaseX1.8.hex

root@raspberrypi-3:~# lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 005: ID 0957:0518 Agilent Technologies, Inc. 82357B GPIB Interface
root@raspberrypi-3:~# fxload -t fx2 -D /dev/bus/usb/001/005 -I /usr/share/usb/agilent_82357a/measat_releaseX1.8.hex

root@raspberrypi-3:~# gpib_config

root@raspberrypi-3:~# ls /dev/gpib*
/dev/gpib0  /dev/gpib10  /dev/gpib12  /dev/gpib14  /dev/gpib2 /dev/gpib4  /dev/gpib6  /dev/gpib8
/dev/gpib1  /dev/gpib11  /dev/gpib13  /dev/gpib15  /dev/gpib3 /dev/gpib5  /dev/gpib7  /dev/gpib9

root@raspberrypi-3:~# ibtest /
Do you wish to open a (d)evice or an interface (b)oard?
    (you probably want to open a device): d
enter primary gpib address for device you wish to open [0-30]: 16
trying to open pad = 16 on /dev/gpib0 ...
You can:
    w(a)it for an event
    write (c)ommand bytes to bus (system controller only)
    send (d)evice clear (device only)
    change remote (e)nable line (system controller only)
    (g)o to standby (release ATN line, system controller only)
    send (i)nterface clear (system controller only)
    ta(k)e control (assert ATN line, system controller only)
    get bus (l)ine status (board only)
    go to local (m)ode
    change end (o)f transmission configuration
    (q)uit
    (r)ead string
    perform (s)erial poll (device only)
    change (t)imeout on io operations
    request ser(v)ice (board only)
    (w)rite data string
: w*idn
enter a string to send to your device: *idn?
sending string: *idn?

gpib status is:
ibsta = 0x2100  < END CMPL >
iberr= 0

ibcnt = 6
You can:
    w(a)it for an event
    write (c)ommand bytes to bus (system controller only)
    send (d)evice clear (device only)
    change remote (e)nable line (system controller only)
    (g)o to standby (release ATN line, system controller only)
    send (i)nterface clear (system controller only)
    ta(k)e control (assert ATN line, system controller only)
    get bus (l)ine status (board only)
    go to local (m)ode
    change end (o)f transmission configuration
    (q)uit
    (r)ead string
    perform (s)erial poll (device only)
    change (t)imeout on io operations
    request ser(v)ice (board only)
    (w)rite data string
: r
enter maximum number of bytes to read [1024]:
trying to read 1024 bytes from device...
received string: 'KEITHLEY INSTRUMENTS INC.,MODEL 2015,1043877,B15 /A02
'
Number of bytes read: 57
gpib status is:
ibsta = 0x2100  < END CMPL >
iberr= 0

ibcnt = 57
You can:
    w(a)it for an event
    write (c)ommand bytes to bus (system controller only)
    send (d)evice clear (device only)
    change remote (e)nable line (system controller only)
    (g)o to standby (release ATN line, system controller only)
    send (i)nterface clear (system controller only)
    ta(k)e control (assert ATN line, system controller only)
    get bus (l)ine status (board only)
    go to local (m)ode
    change end (o)f transmission configuration
    (q)uit
    (r)ead string
    perform (s)erial poll (device only)
    change (t)imeout on io operations
    request ser(v)ice (board only)
    (w)rite data string
: q



************** Beiming *******************


ibcnt = 0
You can:
    w(a)it for an event
    write (c)ommand bytes to bus (system controller only)
    send (d)evice clear (device only)
    change remote (e)nable line (system controller only)
    (g)o to standby (release ATN line, system controller only)
    send (i)nterface clear (system controller only)
    ta(k)e control (assert ATN line, system controller only)
    get bus (l)ine status (board only)
    go to local (m)ode
    change end (o)f transmission configuration
    (q)uit
    (r)ead string
    perform (s)erial poll (device only)
    change (t)imeout on io operations
    request ser(v)ice (board only)
    (w)rite data string
: w
enter a string to send to your device: *idn?
sending string: *idn?

gpib status is:
ibsta = 0x2100  < END CMPL >
iberr= 0

ibcnt = 6
You can:
    w(a)it for an event
    write (c)ommand bytes to bus (system controller only)
    send (d)evice clear (device only)
    change remote (e)nable line (system controller only)
    (g)o to standby (release ATN line, system controller only)
    send (i)nterface clear (system controller only)
    ta(k)e control (assert ATN line, system controller only)
    get bus (l)ine status (board only)
    go to local (m)ode
    change end (o)f transmission configuration
    (q)uit
    (r)ead string
    perform (s)erial poll (device only)
    change (t)imeout on io operations
    request ser(v)ice (board only)
    (w)rite data string
: r
enter maximum number of bytes to read [1024]:
trying to read 1024 bytes from device...
received string: 'EITHLEY INSTRUMENTS INC.,MODEL 2015,1043877,B15 /A02
'
Number of bytes read: 56
gpib status is:
ibsta = 0x2100  < END CMPL >
iberr= 0

ibcnt = 56
You can:
    w(a)it for an event
    write (c)ommand bytes to bus (system controller only)
    send (d)evice clear (device only)
    change remote (e)nable line (system controller only)
    (g)o to standby (release ATN line, system controller only)
    send (i)nterface clear (system controller only)
    ta(k)e control (assert ATN line, system controller only)
    get bus (l)ine status (board only)
    go to local (m)ode
    change end (o)f transmission configuration
    (q)uit
    (r)ead string
    perform (s)erial poll (device only)
    change (t)imeout on io operations
    request ser(v)ice (board only)
    (w)rite data string
:



Neat ....

The stuff that made my modules load ok
https://www.eevblog.com/forum/reviews/howto-get-the-raspian-kernel-installed-with-headers/ (https://www.eevblog.com/forum/reviews/howto-get-the-raspian-kernel-installed-with-headers/)
/Bingo
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: timb on November 11, 2013, 10:47:20 pm
Good work dude! You were persistent and it payed off!

I might end up doing this instead of using an old 386 lunchbox with an ISA GPIB card, MS-DOS and Quick Basic.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: Harvs on November 15, 2013, 11:18:46 am
I thought this was a really good idea, so I've started playing around with it to.

I've just made up an adapter for my DMM using an RN42 module and MAX232.  I had them laying around already on boards so it was a no brainer.

So I've started writing an app.  Already I can see how useful this is going to be, however, I recon the 10.1" tablet I've got is too big for the bench.  So I think I'll get a 7 or 8" tablet and a swivel mount system that I can screw into the shelf so it doesn't take up bench space.

Anyway, hopefully we can collaborate in some way to make this work well.

If someone wants to send me some example serial captures from a 34401A (or any other meter for that matter.) I'll try to add support as I'm writing the app, then it'll be put up on google play for free.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: timb on November 15, 2013, 07:46:30 pm
I've been looking around at different combinations of displays the last few days: TFT, eInk, OLED, Memory LCD and VFD. The idea was to make a "universal lab tablet" with onboard wireless, then I'd have little pods that could have a variety of interfaces (RS-232, GPIB) or even direct measurement modules (V/I/R, Oscilloscope, etc.)!

I've got the parts coming to do a GPIB interface (75160+75161) plus some sample displays (2.7" eInk, 2.7" Sharp Memory LCD, 128x64 VFD and some 1.5" color OLEDs) for the tablet portion. However, you just gave me a brilliant idea. I think I'll pick up a cheap 7" Android Tablet and start by just focusing the wireless pods. I can get super cheap (<$5) TTL serial to Bluetooth modules, so I'd put one of those in each pod and have it just connect to the tablet.

Are you interested in adding support to your app for them? :D
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: Harvs on November 16, 2013, 01:20:54 am
Are you interested in adding support to your app for them? :D

Yeah of course.  Adding support for another device that streams is only going to be a couple of lines of code to deal with the packet format, or any bazar ascii chars the manufacturer decided to throw at it (and how you interrogate the device to get what function it's on, and range).  However if a device doesn't "stream" its readings, and needs to be polled, then that's a bit more work.

Bluetooth is easy and cheap.  It also has the advantage that you only need the two devices to work easily.  It's also been surprisingly robust on my bench.  However, TCP/IP via WiFi is also an option that could be used, and it looks like you can get modules off ebay for around $15ea that have RS232 output.  From the viewpoint of the Android device, it's very similar to work with.  Just a slightly different setup, i.e. look for an IP address instead of a pair device.

Most of the work from the app perspective is in getting the charts to display how you would naturally expect them to with all input conditions.  This actually isn't trivial, and requires a lot of manual code intervention to get it all to look right.  So yeah, adding more devices and/or features it the relatively easy part.  At first I'll be looking at everything the 34461A can do as a starting point for features.

Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: timb on November 16, 2013, 02:00:21 am
Okay, cool. Yeah, streaming wouldn't be a problem. Another option for WiFi is the CC3000 modules from TI (which cost $20 in one off quantities). They basically let you add WiFi to simple micros over SPI. The advantage is the SimpleLink Configuration software that runs on iOS/Android/PC and Mac, which makes getting the device on the network super trivial.

Anyway, I'll be starting with Bluetooth since that's super easy to implement. A feature I did want to have would be the ability to upload an "Instrument Configuration File" to the pod, which would (in the case of GPIB) contain information on the command sets the device(s) support or (in the case of RS232) the protocol of the device. This way the pod could send data back to your app in a device agnostic manner. (I.e., the microcontroller inside my pods will translate between a standard data format and whatever the instrument uses.) Perhaps use something like SCPI for the output format.

A nice advantage to having the pods be able to directly control the devices is you could use them as standalone data loggers as well.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: Harvs on November 16, 2013, 02:43:59 am
Nothing sounds hard, I'll keep coding and see where we end up.  I do quite like the pod idea, but don't get too worried about it having to be in a device agnostic manner.  I'm just coding in a drop down box to select the type of device you're connecting to, so any translation etc can be hidden behind that.

BTW the problem with not having streaming data, is how the tablet will know when a new reading is complete.  This is a common problem with SCPI instruments I've coded with.  On most, there's nothing you can even poll to check if a new reading is available, all you can do is get what is currently displayed on the screen which you have no way of telling whether it's a new reading with the same value or not.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: Galaxyrise on November 17, 2013, 01:30:52 am
BTW the problem with not having streaming data, is how the tablet will know when a new reading is complete.  This is a common problem with SCPI instruments I've coded with.  On most, there's nothing you can even poll to check if a new reading is available, all you can do is get what is currently displayed on the screen which you have no way of telling whether it's a new reading with the same value or not.
The two meters I'm familiar with are the Keithley 2000 and the hp 34401a.  Both have a way to "fetch me the next number" and a "measure into a buffer which I can dump (and then clear) at my leisure".

Funny how things converge; I was going to work on a little tool drive my K2K's scanner card and generate a csv or something, but the dern thing refuses to use the rs232 port (SCPI only, it says.) 

The idea of pulling that data to a tablet over bluetooth is very appealing indeed.  However, I'm worried that the bluetooth signal will get picked up in the measurements.  I've noticed that using my cell phone nearby will add noticeable noise.  I take it you don't see that with your bluetooth link?  I wonder why not.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: Harvs on November 17, 2013, 01:48:36 am
BTW the problem with not having streaming data, is how the tablet will know when a new reading is complete.  This is a common problem with SCPI instruments I've coded with.  On most, there's nothing you can even poll to check if a new reading is available, all you can do is get what is currently displayed on the screen which you have no way of telling whether it's a new reading with the same value or not.
The two meters I'm familiar with are the Keithley 2000 and the hp 34401a.  Both have a way to "fetch me the next number" and a "measure into a buffer which I can dump (and then clear) at my leisure".

Yeah I've only got Rigol gear and the Escort meter.  I understand that it's totally dependant on how the manufacturer has implemented SCPI, and hence it will require a bit more work to support each instrument if it requires specific register writes and reads.

Quote
Funny how things converge; I was going to work on a little tool drive my K2K's scanner card and generate a csv or something, but the dern thing refuses to use the rs232 port (SCPI only, it says.) 

The idea of pulling that data to a tablet over bluetooth is very appealing indeed.  However, I'm worried that the bluetooth signal will get picked up in the measurements.  I've noticed that using my cell phone nearby will add noticeable noise.  I take it you don't see that with your bluetooth link?  I wonder why not.

I haven't found any issues with radiated emissions, I believe bluetooth has a lot lower peak power than a typical mobile phone, also my meter is only 5.5 digit (looking for a 6.5 digit now).  However I have added bluetooth to embedded circuits before and found the noise it puts on the power rails to be horrendous (obviously this will be module dependant.)  So now I'm always sure to put the BT module on it's own separate regulator if I intend on using the uC's internal ADC.

As far as the bench meter goes, the BT module is at the back of the instrument, outside of the metal enclosure and away from anything it could couple into.  So no, I've seen no ill effects.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: quantumvolt on November 20, 2013, 10:42:43 am
...

BTW the problem with not having streaming data, is how the tablet will know when a new reading is complete.  This is a common problem with SCPI instruments I've coded with.  On most, there's nothing you can even poll to check if a new reading is available, all you can do is get what is currently displayed on the screen which you have no way of telling whether it's a new reading with the same value or not.

The 34401A has trig and measurement complete on separate plugs.

Nice to see that quite a few people works on this now. I am slow, but am working on it. May be I'll have BT next Christmas  ;D

The other day I used serial data from the 34401A (current) and SPI-to-serial data from the LTC2400 24 bit ADC (voltage) in order to measure some precision resistors. As I needed to divide measurement pairs I read both datasets to an Arduino for math before sending all three datasets to the PC via USB and into a Processing sketch presenting V,I and R (one screen - from 2 instruments).

Point is - with a large tablet screen and a uC in between the instruments and the bluetooth transmitter you can send many datasets that goes into a summary screen or several small windows/GUIs on the tablet.
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: bingo600 on November 20, 2013, 02:48:53 pm
@Harvs

Nics app  :-+
This is taking an interesting turn  :)

I'd prob. also worry a bit about BT in the Lab , but only because i know GSM to disturb volt refs. quite a bit.

But i do have a feeling that GSM is quite gigh wattage , where BT and the WiFi coverage i have in there isn't.
So i guess the BT isn't a problem for normal lab usage.

Another way to make a cheap/easy "bus" would/could be RS-485 or I2C , and then convert that to RS232 just before hitting the tablet.

/Bingo
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: PioB on August 18, 2015, 07:30:03 pm
Hi all,

thank you very much for your code. I just got it working on an Arduino Mega with the Adafruit graphics libraries and an SSD1306 display.

Code: [Select]
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

String inData;
int trigpin = 7;  // your choice, connect to DSR, serial pin 6


void setup()
{
  pinMode(trigpin, OUTPUT);
  Serial.begin(9600); // Serial hardware to PC
  Serial1.begin(9600);  // Serial1 on Arduino Mega2560 port to DMM
  display.begin(SSD1306_SWITCHCAPVCC);
  display.display();
  delay(2000);
  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setTextSize(1);
  // Trigger
  digitalWrite(trigpin, HIGH);
  inData = ""; // Clear read buffer

}

void loop()
{
  digitalWrite(trigpin, LOW); //
  delay(10); // adjust
  digitalWrite(trigpin, HIGH);

  delay(1000);  // or whatever

  while (Serial1.available() > 0)
  {
    char received = Serial1.read();
    inData += received;
    // Process message when new line character is recieved
    if (received == '\n')
    {
      Serial.print("Arduino Received: ");
      Serial.println(inData);
      inData = inData.substring(0, inData.length() - 7); // cut exponent for test, see DMM manual for string format
      display.clearDisplay();
      display.setCursor(25, 29);
      display.print(inData);
      display.print(" V"); // a string - not a number - unparsed for exponent
      display.display();
      inData = "";
    }
  }
}

For future reference, here is how to put the 34401A into the "talk only" mode, took me a while: http://www.keysight.com/main/editorial.jspx?ckey=1000001249:epsg:faq&id=1000001249:epsg:faq&nid=-11143.0.00&lc=eng&cc=CO (http://www.keysight.com/main/editorial.jspx?ckey=1000001249:epsg:faq&id=1000001249:epsg:faq&nid=-11143.0.00&lc=eng&cc=CO)


Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: lukaq on August 19, 2015, 09:11:05 am
small, but looks good
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: cellularmitosis on August 07, 2022, 12:17:22 pm
ARISE FROM THE DEAD, YE THREAD!

I took a swing at this project this weekend, and spent a lot of time getting the values formatted the way I prefer.

I used a DB9 RS232-to-TTL adapter from eBay, and soldered a 10k pull-up from VCC to DSR (DB9 pin 6) to convince the 34401A to talk.

Also, the 34401A has been configured for "talk only" mode, so it just automatically spits everything out via the serial port; the Arduino doesn't have to transmit anything to the 34401A.

Details: https://gist.github.com/cellularmitosis/1582236f226e9d98075a0c971eb4168c
Title: Re: External Display for Agilent 34401A (or any DMM with RS232 Output Stream)
Post by: cellularmitosis on September 02, 2022, 01:39:12 am
Update:

I forked the Arduino SoftwareSerial library to use two stop bits, as required by the 34401A.

Also, I tied pin 6 to 9v rather than 5v and that seems to have cleared up the occasional beep / error from the 34401A.

In my case, the adapter I was using was based off the MAX232, so I just found which capacitor had 9v on it and soldered the pin 6 pull up to that cap.

https://github.com/pepaslabs/SoftwareSerial2Stop