-
Notifications
You must be signed in to change notification settings - Fork 12
Basic Signal Measurement
The microcontroller the Tsunami uses - the same one used in the Arduino Leonardo - has a built in Analog to Digital Converter, and for low speed signals - up to about 15 kilohertz - most applications would simply use that to do signal measurement. That might do the job for audio (though purists will tell you otherwise), but there are a lot of interesting things to measure that are a lot faster than 15 kilohertz.
One solution is to use a high speed external analog to digital converter. This is the solution benchtop equipment like oscilloscopes use, but fast ADCs tend to be expensive, and they generate a lot of data, which you have to process before you can get the useful information about the signal that you wanted in the first place. Fortunately, there's a better way.
For a great number of applications, you don't care about the exact shape of the signal, you only care about a few important parameters. Two of these are the frequency and the amplitude of the signal, and the Tsunami can measure these directly. We'll go into exactly how in a future post, but for now we'll take it as a given.
Measuring these on the Tsunami is very straightforward: the function measurePeakVoltage()
returns the peak voltage measured on the input, and measureFrequency()
returns the measured frequency. Here's a simple example that reads these values once a second and reports them back over USB to your computer:
void setup() {
Serial.begin(115200);
Tsunami.begin();
}
void loop() {
Serial.print(Tsunami.measureFrequency());
Serial.print(" ");
Serial.println(Tsunami.measurePeakVoltage());
delay(1000);
}
As you can see, getting basic details on the input signal is as straightforward as asking the Tsunami for them.