Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
U

UsbGpib

> 编程语言
Open source

Versatile, cheap and portable USB to GPIB converter (USBTMC class based)

658 stars0 likes0 views
WebsiteGitHub

About

Versatile, cheap and portable USB to GPIB converter (USBTMC class based)

Table of contents

:newspaper: Latest updates

:hammer: Buy it or build it

:wave: UsbGpib Introduction

:house: Housing / Enclosure

:computer: Software

    :electric_plug: Using the device

    :gear: Setting and getting parameters

:heavy_check_mark: Testing status

:notebook: Tutorials with a number from 0..6 or 96..102 of the new GPIB device to talk to in following GPIB transactions. Note, that not the full subaddress range of 0..31 or 96..127 is supported as of now - this requires a bit more work. Most common device with subaddresses like R&S CMU200 only are well covered with that current range.

dev.control_in(0xa1, 0x40, 0, 0, 1);
dev.write('!addr  ')

Python wrapper example code for GPIB address setting

…

This code results in my current testsetup with CMU200 and HP3457A in this output:

Rohde&Schwarz,CMU 200-1100.0008.02,xxxxxx,V5.22

HP3457A

AutoID setting

Default wise the GPIB adapter tries during power on of the instrument to query using *IDN? or ID? commands the instrument name automatically. This is used to build the USB serial number, which finally gets part of the VISA ressource string.

Not all instruments support this *IDN / ID? query. For this reason this feature can be turned off. The serial number will then be built based on the GPIB address of the instrument.

Turn AutoID feature off

dev.control_in(0xa1, 0x40, 0, 0, 1); # USBTMC pulse indicator request (enables internal command processing)
dev.write('!autoid off')

This setting is stored in eeprom = non volatile memory, so will survive a power cycle

Turn AutoID feature on

dev.control_in(0xa1, 0x40, 0, 0, 1); # USBTMC pulse indicator request (enables internal command processing)
dev.write('!autoid on')

This setting is stored in eeprom = non volatile memory, so will survive a power cycle

turn auto ID on with delay

Some instruments need after turn on some seconds before GPIB is responsive.

With below 3 settings you can set a delay which is applied before the instrument ID is queried after power on. Note that it will take then also more time, before the USB device is recognized by the PC.

Also this setting is non-volatile.

Delay 5 seconds:

dev.control_in(0xa1, 0x40, 0, 0, 1); # USBTMC pulse indicator request (enables internal command processing)
dev.write('!autoid slow')

Delay 15 seconds:

dev.control_in(0xa1, 0x40, 0, 0, 1); # USBTMC pulse indicator request (enables internal command processing)
dev.write('!autoid slower')

Delay 30 seconds:

dev.control_in(0xa1, 0x40, 0, 0, 1); # USBTMC pulse indicator request (enables internal command processing)
dev.write('!autoid slowest')

read autoid setting

dev.control_in(0xa1, 0x40, 0, 0, 1); # 
print(dev.query('!autoid?'))

Returns as text string either: "off", "on", "slow", "slower" or "slowest".

Firmware version

Finally I implemented a command to query the USB adapters firmware version :-)

dev.control_in(0xa1, 0x40, 0, 0, 1); # USBTMC pulse indicator request (enables internal command processing)
print(dev.query('!ver?'))

Shorten ressource strings (Matlab)

A user discovered that Matlab has a limitation in the VISA ressource string length and shared a pull request to reduce the length. I expose this now first time in the baseline firmware with the following options.

This setting is stored in eeprom = non volatile.

Limit the USB serial number to a length of 20 characters

dev.control_in(0xa1, 0x40, 0, 0, 1); # USBTMC pulse indicator request (enables internal command processing)
dev.write('!string short')

disable limitation of USB serial number length (default behavior)

dev.control_in(0xa1, 0x40, 0, 0, 1); # USBTMC pulse indicator request (enables internal command processing)
dev.write('!string normal')

query the string length setting.

dev.control_in(0xa1, 0x40, 0, 0, 1); # USBTMC pulse indicator request (enables internal command processing)
print(dev.query('!string?'))

This returns as text string either "normal" or "short".

reset the adapter

dev.control_in(0xa1, 0x40, 0, 0, 1); 
dev.write('!reset')

Do a reset of the adapter. Note that due to the reset you have to close the visa session and start a new one as the device re-enumerates on the USB.


Support the project

Or support by buying a fully prebuilt adapter at: https://www.elecrow.com/xyphrolabs-gpibusb.html

In general any email, post or feedback is also very valuable, and don't feel bad if you don't use the support options :-) Feel free to contact me at [email protected]


This page is from XyphroLabs UsbGpib project: https://github.com/xyphro/UsbGpib

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言