{"id":21095,"date":"2017-07-05T08:24:52","date_gmt":"2017-07-05T15:24:52","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=21095"},"modified":"2021-06-11T09:18:54","modified_gmt":"2021-06-11T16:18:54","slug":"using-the-openscope-mz-in-labview","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/using-the-openscope-mz-in-labview\/","title":{"rendered":"Using the OpenScope MZ in LabVIEW"},"content":{"rendered":"<p>Recently, I have been trying to make some example VI&#8217;s to show people how they can connect to their <a>OpenScope MZ<\/a> through\u00a0<a>LabVIEW<\/a>. The OpenScope MZ is an extremely\u00a0versatile\u00a0device, and at its current price point of only 89 dollars you get a lot of bang\u00a0for your buck. This along with its Wi-Fi communication abilities allow it to be a great product for\u00a0makers, 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&#8217;s a great tool for getting used to LabVIEW&#8217;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.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-21194 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/32449730274_bb36afe3e7_o-577x600.png\" alt=\"\" width=\"465\" height=\"484\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/32449730274_bb36afe3e7_o-577x600.png 577w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/32449730274_bb36afe3e7_o-768x799.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/32449730274_bb36afe3e7_o-984x1024.png 984w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/32449730274_bb36afe3e7_o-800x832.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/32449730274_bb36afe3e7_o.png 1442w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/p>\n<h3 id=\"toc-openscope-mz-communication-protocol-2\">OpenScope MZ Communication Protocol<\/h3>\n<p>Before I talk about my examples I am going to explain how <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a> communicates with the <a href=\"https:\/\/digilent.com\/shop\/openscope-mz-open-source-all-in-one-instrumentation\/\">OpenScope MZ. <\/a>This\u00a0<a href=\"https:\/\/digilent.com\/reference\/software\/openscope\/communication-protocol\" rel=\"nofollow\">page<\/a>\u00a0is a reference for the OpenScopes communication protocols. All\u00a0commands are JSON objects (start with &#8216;{&#8216; and with &#8216;}&#8217; 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.<img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-21229 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/3-1-600x199.png\" alt=\"\" width=\"600\" height=\"199\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/3-1-600x199.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/3-1-768x255.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/3-1-1024x339.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/3-1-800x265.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/3-1.png 1198w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>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 <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a>, 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.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-21231 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/2.png\" alt=\"\" width=\"323\" height=\"116\" \/><\/p>\n<p>This <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a> VI has you input the <a href=\"https:\/\/digilent.com\/shop\/openscope-mz-open-source-all-in-one-instrumentation\/\">OpenScopes<\/a> URL (http:\/\/ followed by it&#8217;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.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-21230 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/1-600x158.png\" alt=\"\" width=\"600\" height=\"158\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/1-600x158.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/1-768x202.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/1.png 776w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<h3 id=\"toc-labview-examples-3\">LabVIEW Examples<\/h3>\n<p>Now that you have a basic understanding of how to communicate with the <a href=\"https:\/\/digilent.com\/shop\/openscope-mz-open-source-all-in-one-instrumentation\/\">OpenScope <\/a>from <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a>\u00a0we\u00a0will walk through each of the three example VI&#8217;s.<\/p>\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\">\n<div class=\"draftster-block draftster-paragraph\">\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\"><strong>GPIO<\/strong><\/div>\n<\/div>\n<div class=\"draftster-block draftster-paragraph\">\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\">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.<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-21201 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/GPIOp-600x543.png\" alt=\"\" width=\"600\" height=\"543\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/GPIOp-600x543.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/GPIOp-768x694.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/GPIOp-800x723.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/GPIOp.png 804w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/div>\n<\/div>\n<div class=\"draftster-block draftster-paragraph\">\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\">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&#8217;s input is high.<\/div>\n<div><\/div>\n<\/div>\n<div class=\"draftster-block draftster-paragraph\">\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\"><strong>Logic Analyzer <\/strong><\/div>\n<\/div>\n<div class=\"draftster-block draftster-paragraph\">\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\">This next <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a> example allows you to access the logic analyzer instrument data and functions.<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-21197 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/LogicAnalyzerp-600x448.png\" alt=\"\" width=\"600\" height=\"448\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/LogicAnalyzerp-600x448.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/LogicAnalyzerp-768x573.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/LogicAnalyzerp-1024x764.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/LogicAnalyzerp-800x597.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/LogicAnalyzerp.png 1356w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/div>\n<\/div>\n<div class=\"draftster-block draftster-paragraph\">\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\">This example allows you to adjust the trigger parameters by changing the &#8220;triggerSetParameters Send&#8221; control. You can do this by changing the numbers next to &#8220;risingEdge&#8221;: and &#8220;fallingEdge&#8221;: to the decimal equivalent of the 10-bit binary number where each bit represents its\u00a0corresponding channel.<\/div>\n<\/div>\n<div class=\"draftster-block draftster-paragraph\"><\/div>\n<div class=\"draftster-block draftster-paragraph\">\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\"><strong>Oscilloscope \/ AWG \/ DC power supply<\/strong><\/div>\n<\/div>\n<div class=\"draftster-block draftster-paragraph\">\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\">This final <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a> 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.<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-21199 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/Oscope-AWG-DCPowersupplyp-600x294.png\" alt=\"\" width=\"600\" height=\"294\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/Oscope-AWG-DCPowersupplyp-600x294.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/Oscope-AWG-DCPowersupplyp-768x377.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/Oscope-AWG-DCPowersupplyp-1024x502.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/Oscope-AWG-DCPowersupplyp-800x393.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/Oscope-AWG-DCPowersupplyp.png 1881w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/div>\n<\/div>\n<div class=\"draftster-block draftster-paragraph\">\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\">In this example, you are able to set the parameters of the waveform by changing the Waveform send command.\u00a0<span style=\"font-size: 14px;\">You are also able to change the DC Voltage supplied and the trigger parameter for the Oscilloscope.\u00a0<\/span><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-21195 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/33024342250_42aaedfecd_o-479x600.png\" alt=\"\" width=\"479\" height=\"600\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/33024342250_42aaedfecd_o-479x600.png 479w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/33024342250_42aaedfecd_o-768x962.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/33024342250_42aaedfecd_o-818x1024.png 818w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/33024342250_42aaedfecd_o-800x1002.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/33024342250_42aaedfecd_o.png 1198w\" sizes=\"auto, (max-width: 479px) 100vw, 479px\" \/><\/div>\n<\/div>\n<div class=\"draftster-block draftster-paragraph\"><\/div>\n<div class=\"draftster-block draftster-paragraph\">\n<div class=\"public-DraftStyleDefault-block public-DraftStyleDefault-ltr\">Thank you for reading the post, to learn more about using the OpenScope in LabVIEW check out this Hackster.io<a href=\"https:\/\/www.hackster.io\/austin-stanton\/using-the-openscope-mz-in-labview-8f0ee4\"> project<\/a>. If you are interested in trying out these examples yourself but don&#8217;t have the right supplies you can purchase <a>LabVIEW 2014 home bundle<\/a> for only 50 dollars. You can also purchase the <a>OpenScope MZ<\/a> on Digilent&#8217;s website. Please comment with any questions or comments you may have.<\/div>\n<\/div>\n<\/div>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-21095 jlk' data-task='like' data-post_id='21095' data-nonce='87acbb1af5' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-21095 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-21095 jlk' data-task='unlike' data-post_id='21095' data-nonce='87acbb1af5' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-21095 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-21095 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Combine the power of LabVIEW with the OpenScope MZ!<\/p>\n","protected":false},"author":42,"featured_media":21193,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4323,4312,1563],"tags":[499],"ppma_author":[4493],"class_list":["post-21095","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","category-usb-scopes-analyzers-generators","category-guide","tag-oscilloscope"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/06\/33024340530_aba00b5fe8_o.png","authors":[{"term_id":4493,"user_id":42,"is_guest":0,"slug":"astanton","display_name":"Austin Stanton","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/0cc9db2caf6344c8f78ea46c21570f33a954c45596addf479125043e52431de0?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/21095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=21095"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/21095\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/21193"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=21095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=21095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=21095"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=21095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}