Tsunami
TonyAR
—
2017-06-24T10:33:51Z —
#1
I've recently purchased a Tsunami (must have been old stock I think!) however I'm having some issues with it.
I cannot seem to get an even frequency sweep - it drops off markedly below ~50Hz and above ~800kHz.
I have an Arduino driven AD9850 DDS module, and that is almost perfectly flat between 10Hz -> 1MHz+
Additionally, when I run the Tsunami test suite, I am seeing failures as below:
Test suite output:
Executing test suite...
# usb_id = 583430353230158C10
Read USB ID... OK
# input_offset = 58
Test zero offset... OK
# output_offset_neg = -1270
Test offset adjustment... FAIL
output_offset_neg: -1270 is not between -1239 and -839
# input_amp_6 = 3248
# input_amp_1 = 605
# input_amp_0 = 83
Test amplitude adjustment... FAIL
input_amp_0: 83 is not between -3280 and -2980
# input_freq_1k = 1000
# input_phase_1k = 30
Test frequency and phase... FAIL
input_phase_1k: 30 is not between 999 and 1001
Press enter to rerun test suite.
Are these failures normal? I note that someone else on the forum has reported these too.
I am using what I believe to be the latest libraries as I only downloaded and installed it all during this past week.
Thanks.
nickjohnson
—
2017-09-02T19:10:25Z —
#2
Hi,
I'm sorry about the long delay responding; it appears something went wrong with email notifications.
When you say the frequency sweep is uneven, are you looking at output amplitude, or measured input amplitude?
The first failure looks like a minor drift, but the other two are more surprising. Do you have the input and output connected via a BNC cable?
TonyAR
—
2017-09-03T08:56:11Z —
#3
The uneven frequency response was measured using loopback (BNC linking input & output), but I see the same response pattern when I measure a device with a known flat (wideband) response.
For the test suite I also had the input and output connected via a BNC cable.
nickjohnson
—
2017-09-03T09:31:41Z —
#4
Some dropoff at high frequency is expected due to the input filters; see this post and this post for an example of the baseline frequency response. Below about 50Hz, the averaging period of the peak detector is too short, leading to a lot of noise.
The test failures are still surprising, though; how are you measuring frequency response?
TonyAR
—
2017-09-03T11:31:30Z —
#5
I am using a sketch based on your sample provided on Github, but I have added some routines to enable selection of fixed frequency, amplitude and also to define the sweep frequency.
This is all controlled from a vb.net application I wrote.
So all this does, is a log sweep (can be 1/3, 1/6, 1/12, 1/24 octave) selectable in my interface (pictured at the bottom of this post)
This is the sketch (I think this is the current sketch - I'm not near my test PC right now).
/* usage:
* c responds with connected (used for testing the connection)
* f 1000 sets the frequency to 1k / ~1Vp
* d 1000 3 sets frequency to 1k and voltage to ~3Vp
* s 20 20000 26 3 initiates a 3rd octave sweep of 20 -> 20k at ~3Vp
* octave values are: 1/3rd (25.9921) | 1/6th (12.2462) | 1/12th (5.9463) | 1/24th (2.930)
* It's not recommended to use the 1/24th option as it creates far too many points
* The amplitude of the sweep is output in dBu
* At initial startup, the generator is set to 1kHz / 2Vp
*/
#include <SPI.h>
#include <tsunami.h>
#define MAXBUF 40
double freqValue = 0;
double freqStart = 0;
double freqEnd = 0;
double freqStep = 0;
double freq = 0;
double Volts = 0;
double outputVolts = 0;
char freqStr[MAXBUF];
int bufPos = 0;
char byteIn = 0;
void setup() {
// Initialize the Tsunami
Serial.begin(115200);
while (!Serial)
{}
Serial.println("Initialising...");
Tsunami.begin();
//Tsunami.reset(false);
Tsunami.setAmplitude(2000); // 2Vp
Tsunami.setFrequency(0, 1000.0);
// Tsunami.enableSignOutput();
memset(freqStr, 0, sizeof(freqStr));
}
void fixedFreq() {
char *fEnd1, *fEnd2;
freq = abs(strtod(freqStr + 2, &fEnd1));
outputVolts = abs(strtod(fEnd1, &fEnd2));
if (outputVolts >= 5) {
outputVolts = 5;
}
outputVolts = outputVolts * 1000;
Tsunami.setAmplitude(outputVolts);
Tsunami.setFrequency(freq);
Serial.print("Set frequency to: ");
Serial.println(freq);
Serial.print("Set voltage to: ");
Serial.println(outputVolts);
memset(freqStr, 0, sizeof(freqStr));
byteIn = 0;
bufPos = 0;
}
void loop() {
while (Serial.available())
{
byteIn = Serial.read();
if (bufPos < sizeof(freqStr))
freqStr[bufPos++] = byteIn;
else
{
bufPos = 0;
byteIn = 0;
memset(freqStr, 0, sizeof(freqStr));
Serial.println("Error: Command too long. Ignored.");
}
}
if (byteIn == 0x0a) {
switch (freqStr[0]) {
// fixed frequency
case 'c': // check if connected
Serial.println("Connected");
break;
case 'd': // assign static frequency and amplitude
fixedFreq();
break;
case 'f': // 1kHz tone at fixed amplitude
freqStart = 0;
freqEnd = 0;
freqStep = 0;
freqValue = strtod(freqStr + 2, NULL);
Serial.print("Frequency ");
Serial.print(freqValue);
Serial.print(" Voltage ");
Serial.println("1000");
Tsunami.setFrequency(freqValue);
Tsunami.setAmplitude(1000);
break;
case 's': // sweep
freqValue = 0;
delay(500);
mySweep();
break;
default:
Serial.println("Unknown command");
}
memset(freqStr, 0, sizeof(freqStr));
byteIn = 0;
bufPos = 0;
}
}
void mySweep() {
freqValue = 0;
delay(500);
char *fEnd1, *fEnd2;
freqStart = abs(strtod(freqStr + 2, &fEnd1));
freqEnd = abs(strtod(fEnd1, &fEnd2));
freqStep = abs(strtod(fEnd2, &fEnd1));
outputVolts = abs(strtod(fEnd1, &fEnd2));
if (outputVolts >= 5) {
outputVolts = 5;
}
outputVolts = outputVolts * 1000;
Tsunami.setAmplitude(outputVolts);
delay(50);
if (freqStep == 0) {
Serial.println("Error: Please select sweep type");
}
Serial.println("# Sweep:");
Serial.print("# Start: ");
Serial.print(freqStart);
Serial.print(" End: ");
Serial.print(freqEnd);
Serial.print(" Octave: ");
Serial.print(freqStep);
Serial.print(" Output Voltage: ");
Serial.print(outputVolts);
Serial.println("");
for (double freq = freqStart; freq < freqEnd; freq = freq + (freq / 100) * freqStep) {
Tsunami.setFrequency(freq);
if (freq <= 1000) {
delay(500);
}
delay(10);
// read voltage and convert to mV
double mVoltsPk = Tsunami.measurePeakVoltage();
double milliVolts = (mVoltsPk / 1000);
// convert mV to RMS
double mVoltsRMS = (milliVolts * 0.7071);
// convert RMS to dBu
double logV = 20 * log10(mVoltsRMS / 0.775);
delay(10);
Serial.print(freq);
Serial.print(",");
Serial.println(logV);
}
Serial.println("# end");
}
davideprint
—
2018-04-23T10:28:13Z —
#7
Sam840
—
2018-07-31T11:17:43Z —
#8
I had the same issues while working on another essay, suddenly my system started reseting. I was so worried because haven't saved any copy of that on my computer. I had no choice but to write another one. But the last version was even better than previous, you can look here
Ellen_Ace
—
2018-08-15T12:21:43Z —
#9
Sometimes when you're trying to nail down a failing test you need a quick way to run just the thing thats broken, instead of your whole suite or a whole test case.For writing good test you need to have good writing. Best writing tips you`ll find here click here