Acquisition with Analog Discovery 2

Hi,
In order to acquire analog data, I use the Analog Discovery 2 from Digilent. I used the "Data Acquisition Toolbox" and the "Digilent Analog Discovery Support from MATLAB" package.
I achieve to get data in a tab and want to automatically launch the acquisition when the power is high enough. Maybe using a trigger ?
I also can't use the App, my device doesn't appear and the "Refresh" button doesn't change anything.
If someone already used this device can help me !
Thanks

 Accepted Answer

Brian Hu
Brian Hu on 26 Nov 2018
Hi Christophe,
There are a few workflows that you may be interested in looking into. First, make sure that you can detect the Analog Discovery 2 on a separate Digilent software to make sure that your issue is not due to hardware connection. Please also make sure that you have the correct support package for Digilent Analog Discovery Hardware downloaded. I have included the support package in the link below.
After verifying this, you will want to successfully connect to the Analog Discovery 2 device through MATLAB then transmit and receive data. The examples below might be useful for you to get started.
Lastly, if you are interested in launching acquisition when a certain variable reaches a threshold or triggers, you may want to consider using MATLAB callbacks to accomplish this. An alternative would be to have a control for loop within the code that triggers when the power read from the device exceeds your intended threshold. If you are interested in using callback functions, here are a few links that may be helpful.

4 Comments

Hi Brian,
Thank you for your answer.
The Support Package is included and it works. But the device still not appears in the "Analog Input Recorder" App.
I achieve to receive data and to save it. For my project I have an signal emitted every 15s which last 1s, see picture below. Currently, to record it I have to set a 20s acquisition and to select manually the data containing the message.
I saw the two links of your message and the "Software-Analog Triggered Data Capture" is interesting. But I have a few problems :
ch1.TerminalConfig = 'SingleEnded';
>>> For this type of channel, the 'TerminalConfig' property is not settable. It has a value
of 'Differential'.
As I can't configure it, it is necessarily 'Differential'.
s.IsContinuous = true;
>>> You cannot use the "IsContinuous" property with Digilent hardware.
It mains that I can't let the device run automatically ?
startBackground(s);
>>> Method 'startBackground' is not supported on objects of class 'daq.di.Session'
I think I can't acquire and do operations in the mean time.
message.png
I believe the reason why you cannot see the device on the Analog Input Recorder app is due to the fact that the Support Package provides extra functionalities and accessibility for MATLAB to use the device, but it may not provide an interface through the Analog Input Recorder app.
If you are interested in acquiring data from the device every 15 seconds, but you do not require an incredibly precise measurement of time, one approach you can try is to use the inputSingleScan(s) function within a for loop that pauses for 15 seconds between iterations. Ultimately, it will depend on your workflow and what you are trying to accomplish, but by doing this you can perform other tasks such as processing data within the same loop if necessary.
I think that the function 'inputSingleScan(s)' may be a solution but how can we launch it when we have the first emission ? Because if we launch it when there is no emission, we will miss others.
Please refer to the following documentations for the current hardware limitations with Analog Discovery devices.
If you want to use a digital trigger, this example might be helpful for you to get started.
Otherwise, you can also try rapidly triggering inputSingleScan until the first signal is read, then follow with startForeground in order to capture data. Like you mentioned previously, there is currently no functionality for startBackground with the device you are using.

Sign in to comment.

More Answers (0)

Categories

Find more on Data Acquisition Toolbox in Help Center and File Exchange

Products

Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!