Jump to content
  • 0

Analog Discovery Wavegen Ramp


MaximJoey

Question

Hi,

I am using the Analog Discovery 2 to measure the frequency response of an LRA motor. The LRA motors have a resonant frequency and I wrote a C# application using the Waveforms SDK that uses the Wavegen to drive the motors over a range of frequencies around the resonant frequency to produce a graph of the amplitude response across the frequency range. A typical graph that I generate is attached. 

524px-Resonant_frequency_amplitude_svg.png.5d95cf215e607765b6ce6a30d9146d5e.png

Everytime I want to get a data point for a new frequency I call FDwfAnalogOutNodeFrequencySet and I measure the amplitude of the vibration output from an accelerometer via the scope feature. I know from my testing that every time I make a change to the frequency, the AWG is stopped for a moment and started again at the new frequency. The problem is, this stopping and starting causes issues when driving the LRA.

I've seen on this forum people asking the question of how to get a smooth frequency transition like here: 

And the answer has been that a smooth transition can be achieved using the sweep or the FM modulation features. I can confirm that both create smooth transitions across a frequency range however both features repeat after ramping to the frequency I want. Essentially, I want to gather amplitudes across a range of frequencies around the resonant frequency like 200-230Hz but without the stopping and starting that the calls to FDwfAnalogOutNodeFrequencySet cause.

 

The solution I came up with is to sweep from a lower frequency (~50Hz) to the frequency I want to measure the amplitude at (~200Hz) and then stay at that frequency so I can measure the vibration amplitude. Then, I will increment the final frequency by ~1Hz (this time ramping from 50 to 201Hz and so on) and capture the next amplitude data point. I want to do this across the range (200-230Hz) capturing 30 data points along the way to get my response curve.

Basically, I just need to be able to sweep up to a specific frequency and then stay at that frequency so I can measure the LRA vibration amplitude for that data point.

Does anybody have any advice how I can do this using the Sweep or FM modulation functionality?

One way I think this may be possible is to have a carrier sine wave at the frequency I want to sweep to and having the FM signal be a custom piecewise function that ramps first then is flat for the remaining duration (long enough for me to measure the vibration amplitude reliably). However I cannot figure out how to generate such a custom function and I am not sure if this will give me the result I want.

@attila your input would be greatly appreciated.

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

Hi @MaximJoey

You could use the FM custom signal to sweep in steps.

dwf.FDwfAnalogOutNodeEnableSet(hdwf, channel, AnalogOutNodeFM, c_bool(True))
dwf.FDwfAnalogOutNodeFunctionSet(hdwf, channel, AnalogOutNodeFM, funcCustom)
# FM waveform period 110 seconds, 10s for each of the 11 steps
dwf.FDwfAnalogOutNodeFrequencySet(hdwf, channel, AnalogOutNodeFM, c_double(1.0/110)) 
# FM will change the carrier frequency between -50% to +150%, for custom values in range of -1 and +1
dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, channel, AnalogOutNodeFM, c_double(1)) // 100%
dwf.FDwfAnalogOutNodeOffsetSet(hdwf, channel, AnalogOutNodeFM, c_double(0.5)) // 50%
rgdFM = (c_double*11)(-1,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1)
dwf.FDwfAnalogOutNodeDataSet(hdwf, channel, AnalogOutNodeFM, rgdFM, c_int(11))

dwf.FDwfAnalogOutNodeEnableSet(hdwf, channel, AnalogOutNodeCarrier, c_bool(True))
dwf.FDwfAnalogOutNodeFunctionSet(hdwf, channel, AnalogOutNodeCarrier, funcSine)
# FM will change 100Hz in steps: 50, 70, 90... 250Hz; Carrier x (1 + FM_Offset + FM_Custom x FM_Amplitude); 100Hz x (100% + 50% + [-1,-0.8...+1] * 100%)
dwf.FDwfAnalogOutNodeFrequencySet(hdwf, channel, AnalogOutNodeCarrier, c_double(100)) 
dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, channel, AnalogOutNodeCarrier, c_double(1))
dwf.FDwfAnalogOutNodeOffsetSet(hdwf, channel, AnalogOutNodeCarrier, c_double(0))

The frequency is stable in each step for 10 seconds. In this time the Scope/AnalogIn can perform multiple captures and identify which contains stable frequency based on peak magnitude.

I will try to add soft adjustment option for Wavegen/AnalogOut, without restarting the instrument in future version.

Link to comment
Share on other sites

Hi @MaximJoey

It is implemented for the next version.
The Analog Discovery AWGs change gain at 1V amplitude and this could cause a glitch on the output, for instance when the amplitude is dynamically changed from 1V to 1.1V. This can be compensated from the device firmware.
I hope to have time next week to make the firmware modification and to build installers.

Frequency change from 1 to 2 Hz:
image.png.5848f5cd00d1637490f75be0a451699f.png

Amplitude change from 0 to 2V:
image.png.591f1dcc91e18f5509f22c92771f0c43.png

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...