Understanding data rate and bandwidth

Hi,

Can anyone tell me what the meaning of the data rate and bandwidth is? I saw somewhere, saying: “We generally use a sample are of about 820 Hz and a bandwidth of 330 Hz”. So what is the meaning of this? What is the difference between the sample rate and the bandwidth? I thought they were same thing!

Another issue is that in the datasheet of minimu-9 sensor, https://www.pololu.com/file/download/L3G4200D.pdf?file_id=0J491, on page 29 Table22, there are four terms:
DR, BW, ODR and Cut-off. What are they meaning?

Thanks!

The maximum frequency of a static signal that can be captured with a sampling rate of Fn is (Fn/2). This comes from Nyquist’s Sampling Theorem, and is known as the Nyquist frequency.

To avoid digital sampling artifacts, you have to make sure that no frequency above the Nyquist frequency is present in the signal, or you will get aliasing. Typically, you’ll use an analog filter before the digital sampling to remove frequencies above your Nyquist (and a little bit below, because real filters are far from ideal brick-wall filters.)

Also, for dynamic signals (signals that change phase/amplitude/frequency over time,) the error goes towards infinity as the frequency goes towards Nyquist, so you want to stay below Nyquist for your input.

Thus, if your output signal is 330 Hz, and your sampling frequency is 880 Hz, the Nyquist frequency is 440 Hz and thus your signal is at 3/4 of Nyquist, which is a reasonable place to be (slightly aggressive IMO.) For comparison, an oscilloscope with a “100 MHz bandwidth” will typically sample at 1 Gsample/second, and thus have a Nyquist of 500 Mhz. This is so that the “frequency close to Nyquist” problem doesn’t show up on your display.

Hope this helps.

Thank you for your explanation. So the bandwidth means the highest frequency in the analog signal, and the sample rate represents the frequency you sample the signal. And in theorem, sample rate should always be above 2 times of the bandwidth. Is my understanding correct?

And could you please explain the meaning of the table 22 on page 29 of this datasheet https://www.pololu.com/file/download/L3G4200D.pdf?file_id=0J491? There are four terms: DR, BW, ODR and Cut-off. What do they mean? Assuming I use the first entry of the table where ODR is 100Hz, so in my code, is it enough to read the registry at the frequency of 100Hz or I need to use a frequency more than 200Hz?

Hello. We discussed the meaning of Table 22 of the L3G4200D’s datasheet in another thread:

You do not have to read from the gyro at any particular rate.

–David

Hi,
I got some basic idea about the cut-off term in the thread you provided. But I still don’t fully understand. You said that I do not have to read from the gyro at any particular rate. What does it mean?

For example I set the ODR as 200Hz. In my Arduino (I use Arduino board) code, I need to read the sensor data at some particular rate in an infinite loop. I use the following code. My questions is that if I set the variable “rate” of the following code as “1”, does it output the same values in the 5 continuous loops? What if I set “rate=20”? Does it break the Nyquist’s Sampling Theorem?

void loop() {
  if (millis() - time >= rate)
  {
    gyro.read();
    compass.read();
    time = millis();
    counter = counter+1;
  
    Serial.print((int)gyro.g.x);
    Serial.print(" ");
    Serial.print((int)gyro.g.y);
    Serial.print(" ");
    Serial.print((int)gyro.g.z);
    Serial.print(" ");
  
    Serial.print((int)compass.a.x);
    Serial.print(" ");
    Serial.print((int)compass.a.y);
    Serial.print(" ");
    Serial.print((int)compass.a.z);
    Serial.print(" ");
  
    Serial.print((int)compass.m.x);
    Serial.print(" ");
    Serial.print((int)compass.m.y );
    Serial.print(" ");
    Serial.print((int)compass.m.z);
    Serial.print(" ");
  
    Serial.print(time);
    Serial.print(" ");
    Serial.println(counter);
  }
  
}

If you set the “rate” to 1, that would mean you are trying to read the gyro every 1 ms, which is OK. If you set “rate” to 20, that would mean you are reading the gyro every 20 ms, which is also OK. That theorem does not apply unless you are trying to measure some sort of high-frequency vibration with the gyro.

–David

So if I set “rate” to 1, I will get 5 continuous same reading from the gyro, since the frequency I set is 200Hz. Is that right?

Setting the rate to 1 is different from actually succeeding in reading the gyro every millisecond. If you actually succeed in reading the gyro every millisecond, you would see a lot of duplicate readings, but they won’t always be in groups of exactly 5 because of slight inaccuracies of the clocks involved.

–David

If the gyro doesn’t filter the signal, and you read it more seldom, then you may see that high-frequency vibration as aliasing in your readings.
It would probably have to be pretty strong to show up clearly as more than just low-level noise, though.

OK, you are right. I should have said that the theorem only applies if there are some strong high-frequency vibrations happening. --David