Jump to content
  • 0

Error 24: Invalid sampling rate


Aravindv

Question

Hi

While trying to run the python examples using eclipse and PyDev, I get the error message "Error 24: Invalid sampling rate" while trying to run the a_in_scan_file.py file. Any idea why this might be happening. Also, are there any other documentation available to get further information on these examples

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Thank you for the quick response. 

 

Yes, I did leave the sampling rate at 100. When I lowered it, I was able to get it to work. So I guess I will have to figure out the rate that can be supported. Is this rate dependent on the number of channels I choose? Is there a limit on the buffer size or seconds size as well? 

 

Also, is it possible to choose individual random channels that need to be logged as opposed to choosing a range from 0 to 3 or 0 to 5.

Link to comment
Share on other sites

  • 0

The maximum single-channel voltage measurement for the USB-2408 is 1100 S/s assuming the Data Rate setting is 3750 Hz. Thinks of Data Rate as a low pass filter setting. Most applications use 60 Hz for the Data Rate, which provides good thermocouple measurements. Page 13 of the user manual has the formula for calculating sample rates. For example, four channels at 60 can be read no faster than 14 S/s.https://www.mccdaq.com/pdfs/manuals/USB-2408.pdf.

The following function demonstrates how to configure a group of channels for Type-K thermocouple with a Data Rate (ADDATARATE) of 60. 

def config(board_num: int, n_channels: int):
    for ch in range(n_channels):
        ul.set_config(
            InfoType.BOARDINFO, board_num, ch,
            BoardInfo.ADCHANTYPE, AiChanType.TC
        )
        ul.set_config(
            InfoType.BOARDINFO, board_num, ch,
            BoardInfo.CHANTCTYPE, TcType.K
        )
        ul.set_config(
            InfoType.BOARDINFO, board_num, ch,
            BoardInfo.ADDATARATE, 60
        )

 

a_in_scan_2408.txt

Link to comment
Share on other sites

  • 0

Thanks for the clarification. I will try this.

 

To understand more clearly, when I set one channel to sample at 3750S/s sampling rate, the maximum throughput I can get is 1102.94Hz. Or in other words, there is averaging of roughly 3.4 samples in this extreme case. If I set the throughput to be 60Hz, while setting the sampling rate to 3750Hz for one channel, there will be averaging of approximately 62 samples and every data point logged is an average of 62 samples. Is this a right understanding of the settings?

Link to comment
Share on other sites

  • 0

Don't get the data rate mixed up with the sample rate. The data rate dictates how much the A/D converter sample the signal. If you want the most accuracy, set the data rate low, like 60. If you want a faster sample rate, set the data rate higher. 

Link to comment
Share on other sites

  • 0

I am trying to understand the difference between the two terms here so that I can make sense of the data that is being logged. If the ADC is sampling at 3750Hz and the max throughput is 1102.94Hz, the scaling ratio is around 3.4, Is this equivalent to an averaging operation is my question. This is my understanding based on figure 9 on page 14 of the above document. Is this correct?

 

Link to comment
Share on other sites

  • 0

Ok. I am referring to the below section in the document 

"The USB-2408 A/D converter performs averaging, and the number of averages equals 30,000/data rate. Figure 9 shows an example of the relationship between data rate and resolution. In this example, channel 0 is sampled 3,000 times over 100 ms, and all samples are averaged into one sample. Then channel 1 is sampled 600 times over 20 ms, and the samples are averaged into one sample. The final samples are available at a maximum rate of approximately 8 Hz (8.245 Hz)."

 

When it says THE USB 2408 A/D converter performs averaging, what does that mean? This is my question. Is the final data that is logged in to the CSV file, the averaged numbers? 

Link to comment
Share on other sites

  • 0

The averaged data is logged to your CSV file. When it says channel 0 will be sampled 3000 times over 100mS, you never see the 3000 samples only the averaged value. This is all done inside the sigma-delta A/D chip. If you read up on sigma-delta A/D chips, you find that they run at very high speeds but are unusable without lots of averaging (aka oversampling). However, with averaging they produce very accurate results.

Link to comment
Share on other sites

  • 0

Ok. So can I understand that the term throughput rate refers to the rate at which the averaged data is finally getting logged to the CSV file?

I looked at the data sheet of the ADC and it is an 8-channel converter with a max rate of 30KSPS. From that number, the max single channel sample rate ( data rate) of 3750Hz ( 30000/8) makes sense, and a switching time of 0.64ms between channels. Are there two ADC chips inside the USB2408 to provide the 16 channels?

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...