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 ...
#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 = "";
}
}
}
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
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
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.
#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)