Example of Using sigrok-cli to Take a Mesurement with a Multimeter
Table of Contents
Introduction
In another blog post I explained how to install sigrok on a Raspberry Pi.
That post contained a link to a script available from this site.
This post shows some examples of using sigrok-cli to take a measurement, or multiple measurements from a supported multimeter.
Supported Meters
To begin with, you will need access to one of the multimeters which are supported by sigrok-cli.
Get a list of supported hardware like this:
$ sigrok-cli -L
Note that is an uppercase L.
You can capture the output to a file for review.
The first part of the output shows a list of supported hardware.
It is not obvious which of these hardware items are meters. But you will recognise yours if you have a supported meter. Or can visit the sigrok.org Web site to find and identify supported meters.
Uni-T UT60A Meter Example Command
My Uni-T UT60A is one of the meters on the list.
By making a note of the name of the sigrok device driver from the above list, and by knowing the connection details, we can get a single measurement like this:
sigrok-cli -d uni-t-ut60a-ser:conn=/dev/ttyUSB0 --samples 1
Let’s break down the above command-line into its parts:
-d uni-t-ut60a-ser
This is the name of the driver.
:conn=/dev/ttyUSB0
Is the part of the command which controls the port to which the multimeter is connected. Note it is appended to the driver name, separated with a colon.
All options provided to the driver are in the form of key=value and all pairs are separated by a colon.
In the case of my UT60A, I am currently using the serial lead which has an RS232 DB9 connector on the computer end. So I use an FTDI serial to USB adapter, hence the ‘-ser’ part of the driver string.
The use of such a serial to USB adapter makes ‘/dev/ttyUSB0’ appear in the devices of the host (Linux) machine when it is plugged in.
If you are using Windows, a COMn port will appear. Note that the n part depends on whether your Windows machine already has some or one COM ports. For Windows you may need to install a driver for your USB to serial adapter.
A USB cable (ut-d04) is also available for the UT60A meter. If you are using this, drop the ‘-ser’ suffix from the driver name. These are commonly available from China.
--samples 1
Instructs sigrok-cli to just take a single measurement.
You could also specify more than one measurement, or:
--continuous
For continuous measurements.
Example Output
Issueing the command:
sigrok-cli -d uni-t-ut60a-ser:conn=/dev/ttyUSB0 --samples 1
With the meter switched to DC volts and a battery pack of six AA batteries connected across the test clips, the output is:
P1: -9.56 V DC AUTO
It should be obvious from this string what is what.
And it should be relatively easy, if scripting sigrok-cli, to parse this output string and record the data in any way you desire.