Hope someone can help me get started. As I realize MCP3008 200 k samples per second. This is what I want because the thing I want to measure only is a few hundred microseconds. But will the Raspberry Pi manage to take all the samples in from the ADC? Most of the samples I have to sort out, and then I have to calculate a mean value of samples is left. I've read around a bit about SPI and it is well explained with code as it is called bitbanging, this is maybe not quite good as it is quite slow. I'm no expert in programming but has been involved in some c + + programming.

1 Answer 1


For your type of usage, I would not use the bit-bang SPI. The RPi also has a hardware SPI bus, this can be used up to a clock rate for the SPI bus of 20Mhz. If you just want a couple of microseconds of data from the ADC and do some calculations with that, that will not be a problem at all. Please read the discussion that is going on on this question: RPi as a Sound Level Meter?

One user (scruss) of this site suggested this link which explains the hardware SPI bus on the RPi and how to use it.

The datasheet of the ADC can help you further on how to enable and disable and control the ADC itself, there is also a link to that document in the references question.


As scruss pointed out correctly, you'll need to supply 5V to the ADC to get the amount of samples per second. This implies that you will need to convert the logic levels of the bus from and to 5V for the ADC. An example of how this can be done is here. But there are more ways to get this done.

  • 1
    It might be difficult to get 200k samples/s without using a logic level shifter, as that's the maximum speed at Vdd=5 V. The data sheet quotes 75k samples/s at 2.7 volts, so running from a 3V3 supply you'd likely hit a limit of about 106800 samples/s, if the rates are linear with supply voltage. That would be at a clock rate of APB/130, or 1.923 MHz.
    – scruss
    Feb 2, 2013 at 3:55
  • Hello and thank you for responding so quickly. There are many things I have to look a little closer at here. That I need to supply the ADC with 5V I know, but I thought I could use the PIN2 GPIO pins as outputs 5V from what I understand. hobbytronics.co.uk/raspberry-pi-gpio-pinout
    – Odin
    Feb 2, 2013 at 7:59
  • You can use that pin to supply the 5v to the ADC.
    – ikku
    Feb 2, 2013 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.