Using the OpenScope MZ in LabVIEW

Recently, I have been trying to make some example VI’s to show people how they can connect to their OpenScope MZ through LabVIEW. The OpenScope MZ is an extremely versatile device, and at its current price point of only 89 dollars you get a lot of bang for your buck. This along with its Wi-Fi communication abilities allow it to be a great product for makers, hobbyists, engineers, and new learners. And all of these things also make it a great device for LabVIEW. People new to LabVIEW will find that it’s a great tool for getting used to LabVIEW’s user interface, while experienced users will enjoy all the added functionality that LabVIEW provides. In this post, we will be walking you through some example VIs that I made. These examples allow you to access the Oscilloscope and Wavegen/DC power supply functions of the OpenScope as well as the GPIO pins and the Logic Analyzer.

OpenScope MZ Communication Protocol

Before I talk about my examples I am going to explain how LabVIEW communicates with the OpenScope MZ. This page is a reference for the OpenScopes communication protocols. All commands are JSON objects (start with ‘{‘ and with ‘}’ or OSJB (in chunk notation) Add JSON command that went sent via terminal puts the device into JSON command mode. Below is an example command that you would use to reset the device.

The Send box on the left contains the code that you will be sending to the device while the Response box contains the expected response. To send this command from LabVIEW, you will use the HTTP POST VI that can be found in the HTTP Client Palette. You can see an example of this VI in the picture below.

This LabVIEW VI has you input the OpenScopes URL (http:// followed by it’s IP address) and the JSON command that you want to say. It then outputs a response. The picture below shows the response I received after sending the Reset Instrument command that I show above.

LabVIEW Examples

Now that you have a basic understanding of how to communicate with the OpenScope from LabVIEW we will walk through each of the three example VI’s.

This LabVIEW example allows you to access the GPIO data and functions. You can set the parameters(direction) of the specified GPIO channels as well as read the specified GPIO channel(s) or Write the output voltage(s) of the specified GPIO channel(s). The VI Front Panel is shown below.
This example allows you to switch the I/O channels between input and output by using the Boolean controls at the bottom. When a channel is set to input, it will turn red if it’s input is high.
Logic Analyzer
This next LabVIEW example allows you to access the logic analyzer instrument data and functions.
This example allows you to adjust the trigger parameters by changing the “triggerSetParameters Send” control. You can do this by changing the numbers next to “risingEdge”: and “fallingEdge”: to the decimal equivalent of the 10-bit binary number where each bit represents its corresponding channel.
Oscilloscope / AWG / DC power supply
This final LabVIEW example shows you how to access the oscilloscope instrument data and functions. It also allows you to access the data and functions for the DC power supply and the Arbitrary Waveform Generator.
In this example, you are able to set the parameters of the waveform by changing the Waveform send command. You are also able to change the DC Voltage supplied and the trigger parameter for the Oscilloscope. 
Thank you for reading the post, to learn more about using the OpenScope in LabVIEW check out this project. If you are interested in trying out these examples yourself but don’t have the right supplies you can purchase LabVIEW 2014 home bundle for only 50 dollars. You can also purchase the OpenScope MZ on Digilent’s website. Please comment with any questions or comments you may have.


Be the 1st to vote.

Leave a Reply

Your email address will not be published. Required fields are marked *