AR488 Arduino-based GPIB adapter - Page 1
Forum section: electronics / projects

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: February 07, 2019, 01:09:29 pm
content: For the last 4 months or so, I have been working on an updated GPIB firmware for the Arduino. This was originally inspired by Emanuele Girlando's Arduino GPIB sketch which can be found here:http://egirland.blogspot.com/2014/03/arduino-uno-as-usb-to-gpib-controller.htmlMy updated sketch implements the same pin assignment scheme, but the sketch is an almost complete re-write of Emanuele's original code with the remaining controller functions now implemented. SRQ and REN lines are now fully supported and device mode has also been added. The ++lon device mode command is currently the only unsupported command. Since I don't have a device that supports secondary addressing to test with, secondary addressing has not been implemented yet. This sketch has been released with Emanuele Girlando's permission and I would like to gratefully acknowledge his helpful observations. I would also like to thank Luke Mester for his invaluable and considerable help with testing.The code can be found here:https://github.com/Twilight-Logic/AR488Problems with the firmware can be logged via the Issues feature on the GitHub page.Any observations and suggestions for further improvement are welcome.This thread has gotten pretty long over time so here are links to some of the AR488 projects that have been mentioned within the discussion:3D Case by Pepsi1https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2348046/#msg2348046Enclosure by H.Ohttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2431767/#msg2431767USA Cal Club PCB by Vindolinehttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2531685/#msg2531685https://github.com/vindoline/AR488-USB-GPIBReference to atmega-gpib for MEGA128/MEGA2561 by texaspyrohttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2609733/#msg2609733Reference to Bench Briefgs article about the HP59401A Bus System Analyser by bitseekerhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2631336/#msg2631336PCB for Pro Micro by artaghttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2684736/#msg2684736(see also subsequent posts)UNO enclosures by rhbhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2735644/#msg2735644https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2793884/#msg2793884Nano adapter by Alfonshttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2748512/#msg2748512ESP8266/Pro Micro adaptation by tom_iphihttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2891608/#msg2891608https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/375/GNUPlot logging and adapter based on artag PCB by grizewaldhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2922434/#msg2922434https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3024494/#msg3024494Logging from a Fluke 8840a by kc9qvihttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg2985784/#msg2985784Modification to add temperature sensor by serg-elhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3002852/#msg3002852https://radiokot.ru/forum/viewtopic.php?p=3815540#p3815540(Russian)Plotting from TDS700 using the 7470A tool in KE5FX tools by james_shttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3024494/#msg3024494Tek Flash drive (related project combining AR488 and SDcard) collaboration by waveydipole and mmcgraw74https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3144360/#msg3144360https://www.facebook.com/groups/1157781747606102Powerless AR488 adapter by maxwell3e10https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/600/AR488 Utility by Nx-1997https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3431088/#msg3431088https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3586488/#msg3586488Possibly pin differences on Micro Pro highlighted by eliocorhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3437870/#msg3437870Parameter setting for HP34401A post by I3VGVhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/650/EZGPIB success connecting to Prologic screenshot by Sprockhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3476564/#msg3476564Screenshot of Luke Mesters HP3478A Control Utility by AtlnticSurferhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3478956/#msg3478956Luke Mesters HP3478A Control Utility being used to save CAL data by mcj7247https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3493244/#msg34932443D printed enclosure for Pro Micro version by dl6lrhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3481518/#msg3481518Using with HP33120 and HP3478A by caiser01https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3810788/#msg3810788Another HP3478A calibbration read using adapter with point-to-point wiring and SN7516x buffers by pqasshttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3813158/#msg3813158STM32F303/ESP32 vwersion by douarddahttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3827363/#msg3827363https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg4072366/#msg4072366https://github.com/douardda/AR488/tree/esp32Custom board with SN7516x buffers and Bluetooth by ONLYAhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3942949/#msg3942949https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3973676/#msg3973676Rugged-datin' da connector by chickenHeadKnobhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3954854/#msg3954854Cypress FX2LP based Sniffer board for Sigrok by artaghttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg4405006/#msg4405006Buffered AR488 board by Jay_Diddy_Bhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg4448758/#msg4448758https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg4483507/#msg4483507Connection to HP16702A Logic Analyser by Jay_Diddy_Bhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg4456264/#msg4456264Cypress FX2LP based Sniffer board in use by Jay_Diddy_Bhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg4503640/#msg4503640Ordering buffered AR488 board via JLPCB by Jay_Diddy_Bhttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg4590094/#msg4590094Reference to PyMeasyre by gmac34https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg4604662/#msg4604662Building the buffered version of the AR488 by DC1MChttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg4610047/#msg4610047Reference to xyphro's UsbGpib (32u4 based) by Nx-1997https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg4659160/#msg4659160Various versions of adapters based on the PCB by artaghttps://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3100417/#msg3100417https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3106704/#msg3106704https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3360670/#msg3360670https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3360898/#msg3360898https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3435998/#msg3435998https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3866630/#msg3866630https://www.eevblog.com/forum/projects/ar488-arduino-based-gpib-adapter/msg3954854/#msg3954854

author: sundance
author_rank: Regular Contributor
timestamp: February 07, 2019, 02:34:10 pm
content: Thank you very much for your excellent work!Last year I also decided to write my own GPIB controller software for the Arduino (when I bought an HP-3478A). It worked - although I didn't finish it yet. And it's always extremely interesting to see how others do it...-sundance

author: sundance
author_rank: Regular Contributor
timestamp: February 07, 2019, 06:05:26 pm
content: QuoteThat sounds more than just some adjustments/patches to Emanuele's code. And if you compare both WaveyDipole's to Emanuele's code there are not too many sections that are similar, except the obvious parts that cover hardware compatibility.It's like with my own code: I took ideas from Emanuele and others (like here:http://www.rudiswiki.de/wiki/GPIBtoUSB_Nano3) who wrote GBIB software for the Arduino. But since I also wrote it from scratch, the final result is completely different. The only thing (concerning licence and patents) that worried me was the use of the (quasi standard) Prologix command syntax.

author: kutte
author_rank: Contributor
timestamp: February 07, 2019, 06:16:14 pm
content: thank you,but does not compile. Errors areAR488-0-45-10:758: error: invalid conversion from 'void (*)()' to 'void (*)(char*)' [-fpermissive]plenty of them..AR488-0-45-10:758: error: invalid conversion from 'void (*)()' to 'void (*)(char*)' [-fpermissive]AR488-0-45-10.ino: In function 'bool gpibSendData(char*, uint8_t)':AR488-0-45-10:1964: error: return-statement with no value, in function returning 'bool' [-fpermissive]invalid conversion from 'void (*)()' to 'void (*)(char*)' [-fpermissive]Kutte

author: maxwell3e10
author_rank: Frequent Contributor
timestamp: February 10, 2019, 12:36:17 am
content: I tried it with an Atmega328p NANO board. It works OK if I don't use ++auto command. If I use ++auto 1 command, everything gets slowed down, so even ++ver response is delayed by the timeout. Also the ++rst command makes it hang.To make EZGPIB recognize the adapter, it needs to have "GPIB-USB" string in the ++ver response.

author: texaspyro
author_rank: Super Contributor
timestamp: February 10, 2019, 05:09:20 am
content: Quote from: maxwell3e10 on February 10, 2019, 12:36:17 amYears ago I had to make a GPIB interface that emulated a Prologix adapter (at the time the Prologix code wrote to EEPROM every time certain commands were sent and this killed the EEPROM rather quickly if you talked to multiple devices). To get my code to work with the program that was controlling it I had to output the ++ver (or was it a help command?) verbatim to what Prologix was sending.

author: kutte
author_rank: Contributor
timestamp: February 10, 2019, 04:23:06 pm
content: Quote from: kutte on February 07, 2019, 06:16:14 pmerror handling seems to have been downgraded to warnings after updating Arduino IDE fro 1.6.5 to 1.8.19Kutte

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: February 10, 2019, 04:33:37 pm
content: Quote from: maxwell3e10 on February 10, 2019, 12:36:17 amThe string can be changed with the ++setvstr command and saved with the ++savecfg command.Thanks for the feedback regarding the NANO, including slowdown and ++rst hanging.I will need to investigate these further.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: February 10, 2019, 10:17:42 pm
content: Quote from: kutte on February 07, 2019, 06:16:14 pmQuote from: kutte on February 10, 2019, 04:23:06 pmI am using Arduino IDE version 1.8.7 (Linux)/1.8.8 (Win) standalone (.zip package) downloaded directly from the Arduino.cc site for development and neither seems to generate these errors or warnings. I haven't tested it with v1.8.8/1.8.19 downloaded from the Win 10 store though. I will investigate further.Issue logged:https://github.com/Twilight-Logic/AR488/issues/2EDIT: Tested with Arduino IDE 1.8.8/1.8.19.0 downloaded from the Win10 store and it seems these warnings do indeed appear in that version. I will investigate and see whether the code can be adjusted to avoid them. For further updates, please follow the linked issue on GitHub.Quote from: kutte on February 07, 2019, 06:16:14 pmI believe I know what the problem is and it will be fixed in the next update.Issue logged:https://github.com/Twilight-Logic/AR488/issues/1

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: February 12, 2019, 12:01:45 pm
content: Version 0.45.11 uploaded. This should address the compiler warnings in Arduino IDE v1.8.8/1.8.19.0.

author: kutte
author_rank: Contributor
timestamp: February 13, 2019, 10:34:13 am
content: Quote from: WaveyDipole on February 12, 2019, 12:01:45 pmthank you again, but a lot of warnings still exist:Y:\USB_16GB\Voltage reference\GPIB\ar488-arduino\ar488\AR488.ino:153:0: warning: "SPE" redefined#define SPE 0x18In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:272:0,from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,from sketch\AR488.ino.cpp:1:c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\iom328p.h:294:0: note: this is the location of the previous definition#define SPE 6Y:\USB_16GB\Voltage reference\GPIB\ar488-arduino\ar488\AR488.ino:758:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]Y:\USB_16GB\Voltage reference\GPIB\ar488-arduino\ar488\AR488.ino:758:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]Y:\USB_16GB\Voltage reference\GPIB\ar488-arduino\ar488\AR488.ino:758:1: warning: invalid conversion from 'void (*)()' to 'void (*)(char*)' [-fpermissive]Y:\USB_16GB\Voltage reference\GPIB\ar488-arduino\ar488\AR488.ino:758:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]and many !!! more, Kutte

author: coromonadalix
author_rank: Super Contributor
timestamp: February 13, 2019, 10:53:46 pm
content: Witch arduino version do you have when you try to compile it, please be more specific with your errors to help WaveyDipoleOn my 1.8.8 IDE it compiled and sent just fine for an duemilanove and a uno, for tests purposes ??

author: kutte
author_rank: Contributor
timestamp: February 14, 2019, 04:08:37 pm
content: compiled with version 1.8.8 this time without any erros. Don't know what happend the last time, sorry for any confusion.Kutte

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: February 14, 2019, 05:53:51 pm
content: kutte, thanks for the update. The warning is interesting since it indicates a definition as it indicates that 'SPE' is defined elsewhere in the Arduino IDE support files. I will need to have a think about how to deal with this - probably will have to change all of my #define names.Glad you got it compiled without error in the meantime. Curious that the IDE should behave in such an inconsistent manner.

author: Kean
author_rank: Unknown
timestamp: February 15, 2019, 10:58:28 am
content: Quote from: WaveyDipole on February 14, 2019, 05:53:51 pmYes, you may want to add a prefix in front of your shorthand definitions just to be on the safe side.In particular SPE is also defined in various Arduino hardware includes as the "SPI Enable" bit in one of the AVR Special Function Registers.See for example hardware/tools/avr/avr/include/avr/iom328p.h (included via hardware/tools/avr/avr/include/avr/io.h)Thanks for this updated code by the way. It is something I think I can use in the future for some HPIB CS/80 disk interfacing I want to do.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: February 23, 2019, 06:24:01 pm
content: Quote from: maxwell3e10 on February 10, 2019, 12:36:17 amCould you please provide the exact sequence of commands you used to reproduce the issue?Also, what equipment are you driving please?I am using quite a slow meter, so perhaps not noticing the issue.Thanks.

author: maxwell3e10
author_rank: Frequent Contributor
timestamp: February 23, 2019, 10:26:49 pm
content: I was testing it with HP3457 meter. I use a serial terminal to issue ++addr 22 command and then start sending commands through it. If I set ++auto 1 and the meter is send command TRIG SGL, then there is a significant delay before it gives a reading. Also there is the same delay for ID? command or ++ver command.On the other hand, if I set the meter to TRIG AUTO, the program gives a continuous stream of voltage readings in the ++auto 1 mode. This maybe is useful, but its not the behavior one would expect. I think the problem maybe that the program issues a continuous stream of ++read commands in the ++auto 1 mode. My guess is that the buffer is getting delayed by ++read commands when no answer is supposed to come from the meter.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: February 24, 2019, 08:15:04 pm
content: Quote from: maxwell3e10 on February 23, 2019, 10:26:49 pmThank you for taking the time to feed back the details of the problem. The section on the auto command in the Prologix manual says that it "saves the user from having to issue read commands repeatedly", which sounds like a process that performs repeated read commands automatically. Having read that section again in conjunction with your observations, I am now wondering whether what was meant is that it should perform ONE read automatically after a command is issued, saving the user from having to issue a ++read after each command sent to the instrument? In that context the note regarding the "Query unterminated or -420 error" starts to make sense. However, the example still doesn't seem to fit in somehow so I'm still not sure. Moreover, how does one set parameters for this automatic read (e.g. ++read eoi)? It would be appreciated if you or someone else reading this could explain what behavior one would expect from the auto 1 command?I will be happy to adjust the program to comply with the expected behavior.

author: maxwell3e10
author_rank: Frequent Contributor
timestamp: February 24, 2019, 11:19:19 pm
content: I don't have Prologix's original software, but the behavior I observed with Girlando's code is that in ++auto 1 mode just one ++read command is issued after each command sent to the device. This generally make sense, since most GPIB instruments (except some meters in auto mode) don't have new data available in the buffer for reading at all times, only in response to a specific command.On the other hand, for the case when data are available, it maybe useful to keep the auto mode as you have implemented it, simulating "Talk only" GPIB mode. So perhaps it would make sense to keep the continuous reading option that you have already implemented with something like ++auto 2 setting.An even fancier implementation would be to look for "?" as the last character in the command sent to the meter. If there is a ?, then execute one ++read command, if not then don't execute the read command. Otherwise, the ++auto 1 mode can still cause errors if a command doesn't generate a response from the device.

author: GregDunn
author_rank: Frequent Contributor
timestamp: February 27, 2019, 02:27:14 am
content: I appreciate the effort in producing a GPIB compatible interface for Arduino. My boards are on the way and should be here soon; meanwhile, I'm trying to assemble the resources so that I can put them to use.I have downloaded the AR488 code and it compiles properly, so shipping it to the Uno board (standard FTDI interface, not the CH340G) should be straightforward.Now, here's where I need some guidance: I have one PC, but it's in a different room from the workspace and would be very inconvenient. I have several Macs, of which two are portable and can be set up on the bench. I understand that EZGPIB and the GPIB Toolkit only run on Windows, but that having the FTDI drivers I can talk directly to the AR488 with GPIB commands via a terminal through USB, correct?Is it possible to script communications to the interface without the special software, using the terminal and a shell script? I realize I'd be giving up some of the capabilities, but all I really need to do is read and write a few things from the target device (DMM data and in the case of my HP 3478A, cal data). It doesn't have to be anything fancy, and I'm comfortable with *nix shell scripting.

author: maxwell3e10
author_rank: Frequent Contributor
timestamp: February 27, 2019, 05:03:18 am
content: Yes, all of these serial-interface GPIB don't require a special driver. A simple serial terminal program can be used interactively or any program (pythod, matlab) that can talk to the serial port.

author: GregDunn
author_rank: Frequent Contributor
timestamp: February 28, 2019, 08:02:40 pm
content: Well, that was anticlimactic.Plugged the Uno into a USB port, uploaded the sketch, connected via 'screen' and it just worked. Unfortunately, there's a bug in 'screen' that prevents setting local echo, so I've been using CoolTerm to verify that the interface is communicating to the Mac. (I really want to use *nix scripting to do this, rather than CoolTerm's Applescript.I may end up using another screen emulator)Now, to wire up the GP-IB plug and try it out on my HP 3478A...

author: Krampmeier
author_rank: Regular Contributor
timestamp: February 28, 2019, 08:11:12 pm
content: Many thanks for creating and sharing this!I built the adapter with a chinese Arduino Nano clone, using the latest "nightly" Arduino compiler. Got a lot of warnings (including the one about the duplicate definition of 'SPE' ), but no errors.Communication with my HP 4192A impedance analyzer sees to work fine, but when I sent *IDN? to a Keithley 2001, the first 1 to 3 characters of the response were always wrong. Same with a Keithley 2010.I just tried it again:QuoteEdit: I just noticed that the Keithley's display twitches when I send the ++read command. The instrument also clears the "REM" indicator, so it goes out of remote mode. Hmmm. Did I make a mistake in the wiring?The behaviour with ++auto 1 does not make sense with the DMMs, as the DMM starts showing Errors when the adapter tries to read something when nothing is there. It does work with the 4192A. I agree with maxwell3e10 that there are two options for "auto read" which can make sense depending on the instrument.

author: coromonadalix
author_rank: Super Contributor
timestamp: February 28, 2019, 09:14:38 pm
content: would be nice to have a final schematic / wiring to be sure we dont miss something ??

author: GregDunn
author_rank: Frequent Contributor
timestamp: February 28, 2019, 09:30:05 pm
content: I was just planning to use the wiring diagram included in the .docx file unless there is in fact a later version?