Jump to content
  • 0

Impedance Analyzer Adapter Options Menu for Offset Sweep


Resul

Question

Hi,

There is an option on the Options menu called Samples. I want to increase the number of samples in capture at each frequency step considering resolution and accuracy. But, it really slows down the measurement process. My question is that how Waveform software can handle such high samples with very little effect. Do you handle all samples on the device at each frequency step without retrieving the PC software side? 

If yes, are there any API functions to achieve the same task? 

Quote


Samples: specifies the number of samples in capture to take at each frequency step. The default is maximum at up to 32ki. Higher number improves the resolution and accuracy but it can slow down the measurement process. 

 

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 1

Hi @Resul

I got a glitch due to setting the scope offset wrongly with opposite sign and the input entered in limitation. I will have to add some function or measurement to notify such.
I also notice there is bug in calculating the scope sample rate to obtain the certain amount of periods.

image.png.d75c1d2a231c52326f09be90eba577cc.png

image.png.593405fbe2b82bab9057a83ed7021d40.png

 

"""
   DWF Python Example
   Author:  Digilent, Inc.
   Revision:  2021-08-24

   Requires:                       
       Python 2.7, 3
"""

from ctypes import *
from dwfconstants import *
import math
import time
import sys
import numpy
import matplotlib.pyplot as plt

if sys.platform.startswith("win"):
    dwf = cdll.LoadLibrary("dwf.dll")
elif sys.platform.startswith("darwin"):
    dwf = cdll.LoadLibrary("/Library/Frameworks/dwf.framework/dwf")
else:
    dwf = cdll.LoadLibrary("libdwf.so")

version = create_string_buffer(16)
dwf.FDwfGetVersion(version)
print("DWF Version: "+str(version.value))

hdwf = c_int()
szerr = create_string_buffer(512)
print("Opening first device")
dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf))

if hdwf.value == hdwfNone.value:
    dwf.FDwfGetLastErrorMsg(szerr)
    print(str(szerr.value))
    print("failed to open device")
    quit()

dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0)) 

sts = c_byte()
reference = 1e3
freq = 1e3
start = -4.0
stop = 4.0
steps = 101

print("Reference: "+str(reference)+" Ohm  Frequency: "+str(freq)+" Hz Offset: "+str(start)+" V ... "+str(stop)+" V")

dwf.FDwfAnalogImpedanceReset(hdwf)
dwf.FDwfAnalogImpedanceModeSet(hdwf, c_int(8)) # 0 = W1-C1-DUT-C2-R-GND, 1 = W1-C1-R-C2-DUT-GND, 8 = AD IA adapter
dwf.FDwfAnalogImpedanceReferenceSet(hdwf, c_double(reference)) # reference resistor value in Ohms
dwf.FDwfAnalogImpedanceFrequencySet(hdwf, c_double(freq)) # frequency in Hertz
dwf.FDwfAnalogImpedanceAmplitudeSet(hdwf, c_double(0.5)) # 0.5V amplitude = 1V peak2peak signal
dwf.FDwfAnalogImpedanceOffsetSet(hdwf, c_double(start)) 
dwf.FDwfAnalogImpedanceConfigure(hdwf, c_int(1)) # start 

dwf.FDwfAnalogInChannelOffsetSet(hdwf, c_int(0), c_double(start)) # set Scope C1 offset to start
dwf.FDwfAnalogInChannelOffsetSet(hdwf, c_int(1), c_double(0)) # set Scope C2 offset to 0V

dwf.FDwfAnalogInFrequencySet(hdwf, c_double(freq*8192/16)) # override, periods are wrongly calculated in < v3.16.35

dwf.FDwfAnalogInConfigure(hdwf, c_int(0)) # re-configure Scope

time.sleep(1) # wait for the device, specially for the offsets to stabilize

rgOff = [0.0]*steps
rgRs = [0.0]*steps
rgXs = [0.0]*steps

for i in range(steps):
    vOff = start + i*(stop-start)/steps
    rgOff[i] = vOff
    dwf.FDwfAnalogOutOffsetSet(hdwf, c_int(0), c_double(vOff)) # adjust Wavegen 1 offset
    dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1)) # configure and start Wavegen 1
    dwf.FDwfAnalogInChannelOffsetSet(hdwf, c_int(0), c_double(vOff)) # adjust Scope C1 offset
    dwf.FDwfAnalogInConfigure(hdwf, c_int(1)) # configure Scope
    
    time.sleep(0.01) # settle time depends on the circuit/DUT
    
    dwf.FDwfAnalogInConfigure(hdwf, c_int(1)) # start Scope
    while True:
        if dwf.FDwfAnalogImpedanceStatus(hdwf, byref(sts)) == 0:
            dwf.FDwfGetLastErrorMsg(szerr)
            print(str(szerr.value))
            quit()
        if sts.value == 2:
            break
            
    resistance = c_double()
    reactance = c_double()
    dwf.FDwfAnalogImpedanceStatusMeasure(hdwf, DwfAnalogImpedanceResistance, byref(resistance))
    dwf.FDwfAnalogImpedanceStatusMeasure(hdwf, DwfAnalogImpedanceReactance, byref(reactance))
    rgRs[i] = abs(resistance.value) # absolute value for logarithmic plot
    rgXs[i] = abs(reactance.value)
    

dwf.FDwfAnalogImpedanceConfigure(hdwf, c_int(0)) # stop
dwf.FDwfDeviceClose(hdwf)

plt.plot(rgOff, rgRs, rgOff, rgXs)
ax = plt.gca()
ax.set_yscale('log')
plt.show()

 

Link to comment
Share on other sites

  • 0

I am performing CV measurements -2V to +2V on my custom PC application. The peak value is correct. But, I am receiving noisy results near 1.5 V. I could not understand why it happening. 

Hear the screenshots from me and Waveforms. There is no such distortion on Waveforms. Do Waveforms perform extra operations such as smoothing or something else?

----- Closing issue ---- 

My problem is solved. See other thread which is related with this question. 

Mr. @attila added new scripts to new software version (v3.16.35). See AnalogImpedance_OffsetSweepCp.py script. 

Regards. 

 

CV.png

 

WaveForms.png

Edited by Resul
closing issue
Link to comment
Share on other sites

  • 0

Hello,

I do not personally know the answer to your question, but wanted to let you know that your question is posted in the correct section of the Forum where the engineer most familiar with the WaveForms software will be able to see and respond to your question.

Thank you,
JColvin

Link to comment
Share on other sites

  • 0

I hope Mr. @attila can answer my question when he is available. 

And, I have a second question is that?

* How can change offset sweep voltage range -10V to +10V for capacitance-voltage measurements.  

Regards

Resul 

Edited by Resul
Add related second question.
Link to comment
Share on other sites

  • 0

Hi @Resul

1. To improve the resolution you could use the 2nd device configuration to have 16k sample buffer compared to the 8k in the 1st, default.

2. You may see noise around 1.5V because the reading enters in limitation. There is no additional filtering in the application.
In the SDK the offset for both channels is set to the offset level, in the application by default only channel 1 set to offset.

2.a Try changing the amplitude.
2.b Try setting the channel 2 offset to 0V or configure the Wavegen and Scope C1 offset manually:

...
FDwfAnalogImpedanceConfigure(hdwf, 1) // general configuration
FDwfAnalogInChannelOffsetSet(hdwf, 1, 0.0) // Scope C2 offset
for:
   FDwfAnalogOutNodeOffsetSet(hdwf, 0, 0, vOff) // change Wavegen offset
   FDwfAnalogOutConfigure(hdwf, 0, 1) // start wavegen
   FDwfAnalogInChannelOffsetSet(hdwf, 0, vOff) // Scope C1 offset
   FDwfAnalogInConfigure(hdwf, 0, 1) // start Scope
   while:
      FDwfAnalogImpedanceStatus(...
   FDwfAnalogImpedanceStatusMeasure(...

3. The AD2 Wavegen can output -5V to +5V
You could eventually use the negative supply to have a -5V reference and do 1 to +9V sweep range, then use the positive supply to have +5V reference and do -1 to -9V, or -4V for 0 to +8V and +4V for 0 to -8V.  Such 8V range of offset because you need about 1V for the signal.

Edit: correcting wavegen offset function and scope offset sign

Edited by attila
Link to comment
Share on other sites

  • 0

Hi again Mr. @attila,

1. I am shifting the -2V to +2V data capture to 0V to +2V. I am seeing the same noise at the same voltage location. But, it should be a shift on the axis if it hits the reading limit. So, I think there is another problem which is unknown currently.

2. I understood the concept of getting -10V/+10V sweep range. But. I tried to implement the code using the given shared pseudo-code. But, No luck. Because You have FDwf*AnalogImpedance*... functions to easy development for Impedance measurements. I am aware that these functions use the two other instruments under the hood. But, I do not know the orchestration. I am not receiving any voltage on the output. Maybe you block some functions if AnalogImpedance is configured. 
FDwfDeviceAutoConfigureSet(hdwf, c_int(0)) -> should be 0
And some instruments should be configured. But, I do not know the orchestration. 
Could you guide for development?

Regards
Resul 
 

 

Edited by Resul
fix type error
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...