I am using MCP3008 with Raspberrypi Model B. MCP3008 is sampling the analog signal. But is there any way through which I can verify if it is correct or not. For example, I need a sampling rate of 1.5 kHz, so I read the sample every 666 us. But then I am not sure how to verify the number of samples it has acquired in one second.

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

If you take a sample at a rate of 1.5 kHz, why do you need to verify how many you get in 1 second?
– Dmitry GrigoryevSep 25 '18 at 13:06

2 Answers
2

By current sampling rate I assume you mean the number of samples taken in the last second.

Take a time-stamp as you take a sample and increment a sample count. If the number of seconds in the time stamp is different from the previous number of seconds then display and then zero the sample count.

A good approach would be to ditch the delay functions inside Python (probably that's what's you on), inside Linux (means that you just hope for the operating system to be time-accurate, and it never is critically accurate). Exploit hardware interrupts which are super-well defined if used correctly.
You will set an interrupt to occur and trigger your sampling period; take an idea from here: