More With MATLAB And The Analog Discovery 2

If you frequent the Digilent Blog or our Forum, you may have heard that the Analog Discovery 2 is now supported in the MATLAB Data Acquisition toolbox! With the release of MATLAB 2018b, the Analog Discovery 2 is now included as one of the many hardware devices supported by MATLAB.

The Data Acquisition Toolbox Support Package for the Analog Discovery 2 includes libraries for:

  • Read data from the two oscilloscope channels (analog input)
  • Control and generate data from the two waveform generators (analog output)
  • Characterize ICs and measure behavior of the circuit and IC components
  • Configure the sampling rate of the Analog Discovery device
  • Trigger the start of your data acquisition
  • Find and display Digilent Analog Discovery device settings

Today we are going to provide some examples of these libraries and documentation. The first example is the result of running the demo that runs the Waveform Generator and Oscilloscope. In the example below, they are plugged into each other:

We can also run this demo as a live script.  Running the demo as a live script allows the code and results to live on the same page and be shown live. This is similar to the Python Jupyter notebooks example from the WaveForms Asset Store.

 

 

Result of running the same demo as a live script.
The results of running the demo as a live script (scrolled down to the graph).

 

It can be helpful to have an idea of the structure as well when using these resources. To break it down:

MATLAB: The programming language and development environment

Data Acquisition Toolbox: Specific set of examples and libraries that allows the use of Data Acquisition hardware

Analog Discovery Hardware Support Package: Additional download that allows the use of the Analog Discovery 2 in the Data Acquisition Toolbox. Downloading and installing this also adds three examples to the example folder. One that uses the Scope, one that uses the Wavegen and one that uses both.

If you are confused on how to acquire the Analog Discovery hardware package, first make sure that you must also have the Data Acquisition Toolbox installed.  Then within MATLAB, go to add a hardware package.

This opens the Add-On manager where you can see all the hardware Add-Ons.

Click on the Add-on manager for the Analog Discovery. This works for the Analog Discovery 2, despite only having a photo of the original Analog Discovery board.

You can also download it from the hardware support page on the web.

If you have any further questions or issues with getting up and running, make sure to head over to the Forum for support!

 

Author

  • Miranda Hansen

    I enjoy creative writing, engineering, thinking, building, exploring and sharing with people. Huge aficionado of spending time thinking about things that “don’t matter.” I am very interested in unconstrained creativity. I love cross-discipline ideas and all of their integration into complete original systems. And I like things that do things.

About Miranda Hansen

I enjoy creative writing, engineering, thinking, building, exploring and sharing with people. Huge aficionado of spending time thinking about things that “don’t matter.” I am very interested in unconstrained creativity. I love cross-discipline ideas and all of their integration into complete original systems. And I like things that do things.

View all posts by Miranda Hansen →

4 Comments on “More With MATLAB And The Analog Discovery 2”

  1. Data Acquisition Toolbox support requires version 3.7.20 of the Digilent Waveforms driver.
    When using Waveforms today, the current driver is 3.18.1. If you want to use MATLAB you are forced to downgrade your current version of Waveforms.
    I hope the required driver could be 3.7.20 or newer. If not, I will tick to Waveforms and drop using Data Acquisition Toolbox support.

    1. Hey John! The Mathworks version locks the support so that they can fully test and support the functionality. We are working with them to try to unlock version control hopefully in 2022.

      1. Is there any update on this? I have brought the Discovery 2 board and trying to interface with MATLAB 2022b. However, after installing supported package, the board is not enlisted in the daqlist. Please share any related information if any.

Leave a Reply

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