Jump to content
  • 0

Analog Discovery 2 with Python API


Zach

Question

Hello, 

I ma using the AD2 and I am trying to get python to control it. I followed the intrusions here  https://digilent.com/reference/test-and-measurement/guides/waveforms-sdk-getting-started and I have attached my python code.

I have tied the positive Power Supply to Scope Ch. 1 positive and Ground to Scope Ch. 1 negative, 
I have tied the negative Power Supply to Scope Ch. 2 positive and Ground to Scope Ch. 2 negative just as a simple test.

in the code I connected to the AD2   then I set up the the variable power supply to output +3V and -2V.

the I opened the oscilloscope and and tried to ready the voltages on the two channels

and one last measurement I tried to use the multimeter. 

all I get as an output 0.0

 

any help world be great, or if you have some already written code that you know works and would be willing to shar it would be great

Elex exsample.py

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 1

Hi @Zach

You probably need to add a bit of delay (time.sleep(0.1)) between the supply enable and scope measure to let the supply ramp up.

The AD2 does not have DMM. The WF app AC/DC/RMS measurements are not available in SDK, but this can be implemented in custom app based on scope capture data.

Use the following as initialization to keep the device running after close/app exit.
dwf.FDwfParamSet(DwfParamOnClose, c_int(0)) # 0 = run, 1 = stop, 2 = shutdown
 

image.png

Link to comment
Share on other sites

  • 0

HI @attila

I did what you suggested and and it worked but there is one problem.

when I set the power source to +4 and -3 and give it a delay of 0.5s I get +2.76V and -3.03V
I tried  to a set of different voltages on the power source and and negative has its full range but the positive has a range of 0V - 2.76V. When I use WF and do the same thing on there it douse everything as expected, measuring +4V and -3V, as it should.

Do you know why the positive voltage has such a limited range while the negative douse not?     

CODE: {

_switch_variable_(device, True, True, True, 4, -3)
time.sleep(0.5)

open_oscilloscope(device)
measurement = measure_oscilloscope(device, 1)
print(measurement)

measurement = measure_oscilloscope(device, 2)

print(measurement)

close_oscilloscope(device)

}

the output : {

2.7616048222499296
-3.0329990513535074

}

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...