Jump to content
  • 0

Analog Discovery 2 with Python API


RobHe

Question

Hello,

I'm looking to buy a piece of hardware that can do the following:

-USB2.0 bus for communication to my PC

-At least one analog in channel (single ended or differential), >=1MS/s, >=12 bit resolution

- Python compatible SDK

 

Can you confirm the Analog Discovery 2 is the right one to use? The Python API just needs to start and stop a reading, and send the data back to the host.

 

Thanks,

Rob

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Hi @RobHe,

The Analog Discovery 2 will accomplish all of those things. The two differential analog input channels can do 100 MS/s at 14 bit resolution (more details on the specifications available in it's Specifications document: https://reference.digilentinc.com/test-and-measurement/analog-discovery-2/specifications).

The WaveForms SDK (included in the WaveForms software used to control the Analog Discovery 2, https://reference.digilentinc.com/software/waveforms/waveforms-3/start) does support Python and has a number of built-in examples. Some additional resources for WaveForms SDK can be found on it's Resource Center here: https://reference.digilentinc.com/software/waveforms/waveforms-sdk/start.

Let me know if you have any questions.

Thanks,
JColvin

Link to comment
Share on other sites

  • 0

Hi @JColvin. Thanks for the response. I'm prototyping with the Analog Discovery 2 and Waveforms SDK right now. It's really cool and easy to use.

One question for you: I noticed the max buffer size is 8192 (using the FDwfAnalogInBufferSizeInfo function). We're using a minimum acquisition frequency of 1MHz, and filterDecimate, so every 100th ADC acquisition is stored (100M / 1M). Does this mean the maximum amount of time data we can store is 8192 * (1/1M) = 8.192ms? 

Just want to double check my math. If we need to capture and store more data, and cannot change the acquisition frequency or filter type, how do we go about doing this? Is there another piece of hardware to use, or some other API call I should look into?

Thanks,

Rob

Link to comment
Share on other sites

  • 0

Hi @RobHe,

If you keeping the data within the device and then collecting it, then I believe your math is correct. If you don't need a ton more data, you could also use the FDwfDeviceConfigOpen function to be able to specify what configuration you want to use the AD2 in, such as configuration 2 which doubles the buffer size for the analog inputs.

However, since you mentioned that you had a minimum acquisition frequency of 1 MHz, you could also use the recording examples, such as AnalogIn_Record.py that is available in WaveFormsSDK/samples/py installation folder, which will let you effectively record an infinite number of samples at that rate.


If you want a higher acquisition rate I would recommend looking into the Analog Discovery Pro modules (https://digilent.com/reference/test-and-measurement/analog-discovery-pro-3x50/start) that use internal DDR3 RAM to enable much higher recording rates.

Let me know if you have any questions.

Thanks,
JColvin

Link to comment
Share on other sites

  • 0

Hi @RobHe,

I'm not sure where the list is in the SDK documentation itself ( @attila would be able to better answer this) but the way I would find out would be by opening the WaveForms software directly and going off of the configuration list in the WaveForms Device Manager. The configuration options will be in the same listed order (albeit with a 0-based index as far as I know).

Thank you,
JColvin

Link to comment
Share on other sites

  • 0

Hi @RobHe

The configurations are not listed in the manual.
See the WF app for the list or use the SDK.

image.png.4bdfc418508765ff58df5a65913b88d6.png

>python Device_Enumeration.py
DWF Version: b'3.16.36'
Number of Devices: 1
------------------------------
Device 0 :
        Name: 'b'Analog Discovery 2'' b'SN:210321A680EF'
        ID: 3 rev: 3
        Configurations:
        0. AnalogIn: 2 x 8192   AnalogOut: 2 x 4096     DigitalIn: 16 x 4096    DigitalOut: 16 x 1024
        1. AnalogIn: 2 x 16384  AnalogOut: 2 x 1024     DigitalIn: 16 x 1024    DigitalOut: 0 x 0
        2. AnalogIn: 2 x 2048   AnalogOut: 2 x 16384    DigitalIn: 0 x 0        DigitalOut: 0 x 0
        3. AnalogIn: 2 x 512    AnalogOut: 2 x 256      DigitalIn: 16 x 16384   DigitalOut: 16 x 16384
        4. AnalogIn: 2 x 8192   AnalogOut: 2 x 4096     DigitalIn: 16 x 4096    DigitalOut: 16 x 1024
        5. AnalogIn: 2 x 8192   AnalogOut: 4 x 4096     DigitalIn: 16 x 2048    DigitalOut: 8 x 256
        6. AnalogIn: 2 x 512    AnalogOut: 2 x 256      DigitalIn: 16 x 16384   DigitalOut: 16 x 16384
        7. AnalogIn: 2 x 8192   AnalogOut: 2 x 1024     DigitalIn: 16 x 16384   DigitalOut: 16 x 256

 

Link to comment
Share on other sites

  • 0

Hello @JColvin and @attila

As mentioned earlier in this thread, I'm using the AD Pro to measure and log data. It appears to have two configurations:

image.thumb.png.aa3beba024430df282feecd988b30c69.png

 

We're using Config 2 with the larger AnalogIn buffer.

I'm curious, the device is advertised as having 128MS total, yet adding up all the buffers in Config 2 totals about 410k. Is there a way for me to record data at a sampling rate greater than what can be streamed back to my PC via USB, and use a larger Analog In buffer than 131072 samples? I was under the impression I would have a much larger buffer to be able to utilize while logging data.

 

Thanks,

Rob

Link to comment
Share on other sites

  • 0

Hi Rob,

 

You may also be interested to look into pydwf. it's a Python binding for libdwf that should be quite a bit easier to use from Python. I am the author of the package.

One thing it does is that it makes it very easy to select configurations when opening devices, see the example below this link for how to do that: https://pydwf.readthedocs.io/en/latest/pydwf_api/pydwf_utilities.html#pydwf-utilities-opendwfdevice-function-reference.

Although I am also curious to know how the Analog Discovery Pro can gain access to these many-megasamples of buffering space, and how it is possible to access it programmatically. I have an AD3450 too, and I don't see the big buffer sizes listed in its configurations. (I will check tomorrow if I see a difference between Standard and Linux mode).

Edited by reddish
Link to comment
Share on other sites

  • 0

@attila

To clarify, what we're really looking for is something like a single buffer acquisition in which the buffer size is 134,217,728 instead of 131,072?  If this is not possible, then how do we achieve the recording of 134,217,728 samples at 50MHz?

Thanks,

Rob

Link to comment
Share on other sites

  • 0

Hi @RobHe @reddish

The DDRam record buffering is transparent for the API, it is done internally.
The normal recording process can be used. See the SDK/ samples/ py/ AnalogIn_Record.py AnalogIn_Record_Trigger.py AnalogOutIn_PlayRecord.py ...

The limits for this is are: 128MiS up to 125MHz for 1 enabled channel, 62MiS up to 62.5MHz for 2 channels, 32MiS up to 31.25MHz for 3-4 channels

I recommend using the latest version which brings fixes and improvements:

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...