Author Topic: Program that can log from many multimeters.  (Read 724185 times)

gogo10, Cavhat and 4 Guests are viewing this topic.

Offline cte

  • Regular Contributor
  • *
  • Posts: 65
  • Country: de
⚡ To avoid electric shock, ensure that your instrument is correctly grounded.
 

Offline ZhuraYuk

  • Regular Contributor
  • *
  • Posts: 105
  • Country: ua
Re: Program that can log from many multimeters.
« Reply #3776 on: December 15, 2024, 11:33:59 pm »
Cheap at $ 1000+ ? :scared:

50 USD on ebay with free shipping from China, ICs inside looks genuine and NI driver works just fine with it. VISA and other software have no problems working with it.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3101
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3777 on: December 16, 2024, 10:14:18 am »
Does anyone figured a way for TestController to work with NI GPIB-USB-HS adapters? These are cheap  and available everywhere.

Any GPIB adapter requires a interface that TC can communicate with and some special code.
 

Offline ZhuraYuk

  • Regular Contributor
  • *
  • Posts: 105
  • Country: ua
Re: Program that can log from many multimeters.
« Reply #3778 on: December 16, 2024, 12:09:10 pm »
The NI GPIB-USB-HS can be easily accessed by other programming languages like C++, Python, Java, or LabVIEW via VISA-C interface.

To use VISA in Java, you will need:

  • The NI-VISA Java API (visaj.jar).
  • The JNA (Java Native Access) library to communicate with the VISA-C library functions.
The VISA-C API provides functions to interact with GPIB devices, and you can call these functions directly in Java.


This example uses JNA to load the VISA-C library and send GPIB commands.
Code: [Select]
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.ptr.IntByReference;

public class GPIBCommunication {

    // Load the VISA-C library
    public interface VisaLibrary extends Library {
        VisaLibrary INSTANCE = Native.load("visa", VisaLibrary.class);

        int viOpenDefaultRM(IntByReference vi); // Open the VISA resource manager
        int viOpen(int rm, String resourceName, int accessMode, int timeout, IntByReference session);
        int viWrite(int vi, byte[] buffer, int count, IntByReference returnCount);
        int viRead(int vi, byte[] buffer, int count, IntByReference returnCount);
        int viClose(int vi);
    }

    public static void main(String[] args) {
        IntByReference defaultRM = new IntByReference();
        IntByReference session = new IntByReference();
        String resource = "GPIB0::1::INSTR"; // Replace with your GPIB address

        try {
            // Open the VISA resource manager
            int status = VisaLibrary.INSTANCE.viOpenDefaultRM(defaultRM);
            if (status != 0) {
                System.out.println("Error opening Resource Manager. Status: " + status);
                return;
            }
            System.out.println("VISA Resource Manager opened.");

            // Open a session to the GPIB device
            status = VisaLibrary.INSTANCE.viOpen(defaultRM.getValue(), resource, 0, 0, session);
            if (status != 0) {
                System.out.println("Error opening GPIB device. Status: " + status);
                return;
            }
            System.out.println("GPIB session opened to: " + resource);

            // Send a command (*IDN? query)
            String command = "*IDN?\n";
            byte[] writeBuffer = command.getBytes();
            IntByReference writeCount = new IntByReference();
            status = VisaLibrary.INSTANCE.viWrite(session.getValue(), writeBuffer, writeBuffer.length, writeCount);
            if (status != 0) {
                System.out.println("Error writing to device. Status: " + status);
                return;
            }
            System.out.println("Command sent: " + command.trim());

            // Read the response
            byte[] readBuffer = new byte[256];
            IntByReference readCount = new IntByReference();
            status = VisaLibrary.INSTANCE.viRead(session.getValue(), readBuffer, readBuffer.length, readCount);
            if (status != 0) {
                System.out.println("Error reading from device. Status: " + status);
                return;
            }
            String response = new String(readBuffer, 0, readCount.getValue());
            System.out.println("Response: " + response.trim());

            // Close the session
            VisaLibrary.INSTANCE.viClose(session.getValue());
            VisaLibrary.INSTANCE.viClose(defaultRM.getValue());
            System.out.println("VISA session closed.");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3101
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3779 on: December 17, 2024, 04:30:50 pm »
The NI GPIB-USB-HS can be easily accessed by other programming languages like C++, Python, Java, or LabVIEW via VISA-C interface.

To use VISA in Java, you will need:

  • The NI-VISA Java API (visaj.jar).
  • The JNA (Java Native Access) library to communicate with the VISA-C library functions.
The VISA-C API provides functions to interact with GPIB devices, and you can call these functions directly in Java.

Interesting, some questions:
Do this code work with the free Java also (I do not know if JNA is included and I dont like import com.sun.jna.......)?
Do this work with other Visa libraries?
Do you have a link to some documentation?
 

Offline cte

  • Regular Contributor
  • *
  • Posts: 65
  • Country: de
Re: Program that can log from many multimeters.
« Reply #3780 on: December 17, 2024, 07:08:23 pm »
Do this code work with the free Java also (I do not know if JNA is included and I dont like import com.sun.jna.......)?

I'm not a java programmer, but I heard about JNA before:

https://github.com/java-native-access/jna

It seems to be LGPL licensed and there are prebuilt .jar's available.
⚡ To avoid electric shock, ensure that your instrument is correctly grounded.
 

Offline ZhuraYuk

  • Regular Contributor
  • *
  • Posts: 105
  • Country: ua
Re: Program that can log from many multimeters.
« Reply #3781 on: December 18, 2024, 09:00:04 pm »
Do this code work with the free Java also (I do not know if JNA is included and I dont like import com.sun.jna.......)?
I assume because JNA is open source it can works with OpenJDK as well. I suspect com.sun was left from times when sun java was one and free java available.

Do this work with other Visa libraries?
Yes, JNA can access other VISA libraries besides National Instruments' NI-VISA, such as Keysight VISA, Rohde & Schwarz VISA, or any other VISA library that follows the VISA-C API standard.

Do you have a link to some documentation?
That github link above have everything.
 

Offline ZhuraYuk

  • Regular Contributor
  • *
  • Posts: 105
  • Country: ua
Re: Program that can log from many multimeters.
« Reply #3782 on: December 19, 2024, 07:24:49 pm »
Why I am returning to this. It seems to be one of the most affordable GPIB adapters nowadays, it has USB modern interface and supports latest OS versions. You can buy it anywhere.
2465815-0
 

Offline TizianoHV

  • Regular Contributor
  • *
  • Posts: 118
  • Country: it
    • My Website
Re: Program that can log from many multimeters.
« Reply #3783 on: December 22, 2024, 11:58:24 pm »
I bought one on ebay two years ago for 100€ (original box..). I use it with NIvisa and pyvisa and they are super reliable.

Offline Odd

  • Regular Contributor
  • *
  • Posts: 77
  • Country: no
Re: Program that can log from many multimeters.
« Reply #3784 on: December 23, 2024, 12:47:32 pm »
How to specify Linux port?
For DL24 the 600W load I tried different approaches/configurations, but no data appears, and I don't think it is really connecting.

This is incoming on serial: 
2468371-0

And this is the configuration I tried:
2468375-1

It is not exactly clear what else needs to be ticked/done to get some data.
Also: it is confusing that the program apparently accepts serial port both formats.
« Last Edit: December 23, 2024, 08:32:38 pm by Odd »
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3101
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3785 on: December 23, 2024, 02:45:04 pm »
How to specify Linux port?
For DL24 the 600W load I tried different approaches/configurations, but no data appears, and I don't think it is really connecting.

This is incoming on serial: 
(Attachment Link)

And this is the configuration I tried:
(Attachment Link)

It is not exactly clear what else needs to be licked/done to get some data.

Start editing the address field, then right click the mouse and TC will list all valid serial ports.

Also: it is confusing that the program apparently accepts serial port both formats.

The address field is free format, it accepts anything, but only the right type of format will work.
The reason the field do not have checking is because the format depends both on OS and interface type.


 
The following users thanked this post: Odd

Offline Odd

  • Regular Contributor
  • *
  • Posts: 77
  • Country: no
Re: Program that can log from many multimeters.
« Reply #3786 on: December 23, 2024, 08:33:14 pm »
Thank you, it works. Merry Christmas everyone ! :)
 

Offline Odd

  • Regular Contributor
  • *
  • Posts: 77
  • Country: no
Re: Program that can log from many multimeters.
« Reply #3787 on: December 24, 2024, 01:21:49 pm »
DL24 load scripting:
I am using the "Atorch DL24M" - the only one that detects/works with my DL24 variant (the cased 600W one)
--------------
*idn?
;; ATorch,ATorch DL24M,
energy?      <<works
;; 531.991
setCurrent 1.5      <<works
on       <<my attempt to turn it on
on 1   <<second attempt
on     << I switched it on manually(using physical button)  , then this turns it off.
on 1   << I switched it on manually(using physical button)  , then this turns it off  too.
--------

checked "on 0" too  in cese something was inverted here.

please advise, are there maybe other required commands?


o
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3101
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3788 on: December 25, 2024, 02:12:02 pm »
please advise, are there maybe other required commands?

The definition of the load is in the file "ATorchPX100Devices.txt", there you can see all commands and how they work.
You can also tinker with it to see if you can fix the on command.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3101
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3789 on: December 30, 2024, 03:16:03 pm »
V2.53 is up
It has a few fixes and some new devices.
   Added: Some programming help in the "Generate script" menu.
   Added: Enova Gyrfalcon S8000 advanced cell charger (Thanks Enova)
   Added: Enova Gyrfalcon S4000 Pro advanced cell charger (Thanks Enova)
   Fixed: :visible: tag did not work in selector blocks
   Added: :popupPhrase: this can be used on text field to show a popup menu with phrases/symbols.
   Fixed: Optimized script generation could not be selected
   Added: Siglent SPD4121X, Siglent SPD4306X, Siglent SPD4323X power supplies (Thanks TheDefpom)
   Fixed: #popuptext command, did not handle all parameters correctly
   Added: Hewlett-Packard / Agilent 34401A added undocumented 10mAAC range to popup (Thanks AndreasF78)
   Added: Siglent SDS2104X Plus, Siglent SDS2204X Plus, Siglent SDS2354X Plus, Siglent SDS2504X Plus (Thanks KungFuJosh)
   Added: Siglent DS2204X HD, Siglent SDS2354X HD oscilloscope (Thanks KungFuJosh)

The most interesting addition is two universal battery chargers, the definitions for them are made by the manufacturer (with a bit of help from my). The chargers are very advanced and TC can have full control of them, including scripting and the definitions includes a lot of extra stuff.
Part of configuration menu for it (It is dynamic and will include more fields when selecting a cycle function):


The extra functions, it is easy to copy all settings to another charger or do a printout of the programs or generate templates for TC scripts:




 
The following users thanked this post: The Soulman, KungFuJosh, Kirkhaan, ZhuraYuk, Furna

Offline KungFuJosh

  • Super Contributor
  • ***
  • Posts: 3206
  • Country: us
  • TEAS is real.
Re: Program that can log from many multimeters.
« Reply #3790 on: December 30, 2024, 04:09:18 pm »
The SDS file also contains SDS2504X HD, and should have had SDS2104X HD, but had the Plus version twice by mistake. Oops. The SDS2104X HD is corrected in the attached file.

Thanks,
Josh
"Right now I’m having amnesia and déjà vu at the same time. I think I’ve forgotten this before." - Steven Wright
 

Offline Odd

  • Regular Contributor
  • *
  • Posts: 77
  • Country: no
Re: Program that can log from many multimeters.
« Reply #3791 on: December 30, 2024, 05:38:07 pm »
Thank you for the new version.
I am surprised to not seeing  Agilent 34410A in the list, it is not that different from 34401A - I guess, and it's not exactly an odd device, so there is maybe a reason for it to not be included?
 

Offline KungFuJosh

  • Super Contributor
  • ***
  • Posts: 3206
  • Country: us
  • TEAS is real.
Re: Program that can log from many multimeters.
« Reply #3792 on: December 30, 2024, 08:54:34 pm »
Thank you for the new version.
I am surprised to not seeing  Agilent 34410A in the list, it is not that different from 34401A - I guess, and it's not exactly an odd device, so there is maybe a reason for it to not be included?

Simple: Somebody that has a 34410A needs to add it and test it. If it's nearly the same as the 34401A, then you can copy the info and change the IDs appropriately. Then test and share.
"Right now I’m having amnesia and déjà vu at the same time. I think I’ve forgotten this before." - Steven Wright
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3101
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3793 on: December 31, 2024, 08:17:56 am »
The SDS file also contains SDS2504X HD, and should have had SDS2104X HD, but had the Plus version twice by mistake. Oops. The SDS2104X HD is corrected in the attached file.

Will be update in next release (Thanks).
 
The following users thanked this post: KungFuJosh

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3101
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3794 on: December 31, 2024, 08:20:31 am »
Thank you for the new version.
I am surprised to not seeing  Agilent 34410A in the list, it is not that different from 34401A - I guess, and it's not exactly an odd device, so there is maybe a reason for it to not be included?

KungFuJosh has the correct answer to that.
 

Offline dougbert

  • Contributor
  • Posts: 11
Re: Program that can log from many multimeters.
« Reply #3795 on: January 10, 2025, 08:16:35 pm »
Hello,

I have a couple of DMMs (about 15 years old) with serial interfaces, so I decided to write TestController configuration files for them.
(You can see everything at https://github.com/dougbert-b/TestControllerStuff )

The first DMM is a Protek D440, which has some extra settings for automotive use, for example RPM.
It streams a short ASCII message at 1200 baud several times a second, with a numeric code for the mode, followed by the actual value.
I used the DMM2 driver, and I got it working pretty quickly.  The only issue is that the meter has an "RPM" mode, and I don't know
if it is possible to define that data type in the DMM2 driver.  I see how that can be done in the SCPI and Block drivers using the #value
statement, but that apparently is not supported in the DMM2 driver.

The second DMM is a Metex ME-11.  Its serial port works at 600 baud, and every time any character is sent to it, it replies with
a short ASCII line, for example "DC  046.3  mV<CR>".  This ought to be really easy to support, but I have tried writing 4 different styles of
config file, and none of them work really well.

My first attempt used the SingleValue driver.  It can properly read and display all the V, I, R, and diode data, but it is very laggy, and in debug mode
there are a lot of timeout messages.   (When I look at the data stream with a serial port debugger program, it is well formatted and error-free.)
I tried adding a #readingDelay statement , but it had no effect.  I am wondering if 600 baud is simply too slow, and TestController is getting confused by it.

My second attempt used the DMM2 driver.  It suffers from the same problem as the SingleValue version: lots of lag and timeout messages.

My third attempt used the Block driver.  This version reliably polls and reads the incoming messages  (I can see the bytes in the debug messages),
and the #pollPause statement works like it should.  I even managed to figure out how to get #askModeMathFormat to parse the data stream and
specify the correct #value to use.  But I am stuck on one thing:  the meter can send "OL" or "O.L" for an overload condition, and this freaks
out the #rxFormat statement.  Is there a known way to handle this in the Block driver?

My fourth attempt uses the AsciiBlock driver.  I suspect that it will be easier to deal with the "OL" issue in this driver, but it has one fatal flaw: the
AsciiBlock driver does not seem to support the  #pollPause statement, and the rapid polling overloads the meter, and it lags and eventually freezes.
Is this simply a bug in the AsciiBlock driver?  Is there any workaround?

I welcome any advice.  You can see all my code in the Github repository I mentioned above.

Thanks,
 Doug
« Last Edit: January 11, 2025, 04:00:46 am by dougbert »
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3101
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3796 on: January 11, 2025, 12:15:28 pm »
I have a couple of DMMs (about 15 years old) with serial interfaces, so I decided to write TestController configuration files for them.
(You can see everything at https://github.com/dougbert-b/TestControllerStuff )

Please post finished definition in this thread, then I will include them in the next release.
I see posting in this thread (or mailing it to me) as a statement that you want it included in TC.

The first DMM is a Protek D440, which has some extra settings for automotive use, for example RPM.
It streams a short ASCII message at 1200 baud several times a second, with a numeric code for the mode, followed by the actual value.
I used the DMM2 driver, and I got it working pretty quickly.  The only issue is that the meter has an "RPM" mode, and I don't know
if it is possible to define that data type in the DMM2 driver.  I see how that can be done in the SCPI and Block drivers using the #value
statement, but that apparently is not supported in the DMM2 driver.

I have added RPM to the DMM2 driver, you can find a updated .jar file here:

http://lygte-info.dk/pic/Projects/TestController/TestController.jar

The second DMM is a Metex ME-11.  Its serial port works at 600 baud, and every time any character is sent to it, it replies with
a short ASCII line, for example "DC  046.3  mV<CR>".  This ought to be really easy to support, but I have tried writing 4 different styles of
config file, and none of them work really well.

My first attempt used the SingleValue driver.  It can properly read and display all the V, I, R, and diode data, but it is very laggy, and in debug mode
there are a lot of timeout messages.   (When I look at the data stream with a serial port debugger program, it is well formatted and error-free.)
I tried adding a #readingDelay statement , but it had no effect.  I am wondering if 600 baud is simply too slow, and TestController is getting confused by it.

...


I cannot guess the problem here, #readingDelay is supposed to fix slow timing.
Using TC in debug mode (use the .bat file) may show the problem more clearly.

In many drivers the polling speed is locked to how frequent TC updates the value and it varies with readouts/logging active.
Some drivers decouples device polling from TC polling and on these it may be possible to adjust the polling rate. Generally if TC polls the device while on the command panel and no popup, script or logging is active it is this type of driver.




 

Offline dougbert

  • Contributor
  • Posts: 11
Re: Program that can log from many multimeters.
« Reply #3797 on: January 11, 2025, 04:29:22 pm »
Thanks for the quick and detailed reply!  I have emailed a log file sample to you.

Doug
 

Offline Odd

  • Regular Contributor
  • *
  • Posts: 77
  • Country: no
How to get Wh ? (how to add simple math?)
« Reply #3798 on: January 11, 2025, 05:39:52 pm »
So I see this:
2480667-0

How can I make  use of that data , preferably produce a graph with voltage,current, and Wh ?
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3101
  • Country: dk
    • Tests
Re: How to get Wh ? (how to add simple math?)
« Reply #3799 on: January 11, 2025, 05:46:31 pm »
How can I make  use of that data , preferably produce a graph with voltage,current, and Wh ?

You click the "Log" button and select a time interval.
Then the data will be collected (In table) and a chart (Graph) will be made.
You can save the data (TC always uses csv format) for use with other programs.
 
The following users thanked this post: Odd


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf