I am using Raspberry pi 4 and I want to connect three MCP3008 ic. I am a little bit confused about how to SPI MISO and SPI MOSI and chip select of Raspberry pi to Dout Din and CS of each of the three MCP3008 ic's

Note: I need to read from the ics at the same time and DO NOT switch with them

Thanks in advance

MCP3008 schemetic diagram

  • Which part is confusing. Plenty of examples.
    – joan
    Dec 27, 2022 at 8:12
  • The connection itself. there is no problem regarding connecting clck because clck synchronizes all ic clocks to that of Raspberry Pi , but how to assure Raspberry pi will differentiate from the output of every ic?
    – Omar Alaa
    Dec 27, 2022 at 8:26
  • MCP3008 connects through serial communication with Raspberry pi through the three pins I mentioned in my question
    – Omar Alaa
    Dec 27, 2022 at 8:28
  • 1
    You seem to have arrived at a non-workable solution for whatever underlying problem you are trying to solve. You should have asked about the underlying problem in the first place.
    – joan
    Dec 27, 2022 at 18:22
  • 1
    @OmarAlaa the only way to read all three MCP3008 at the same time is to use a separate microcontroller for each one and synchronize the reading with one trigger signal ... that would allow you to read 3 of 24 inputs at the same time
    – jsotola
    Dec 27, 2022 at 19:08

3 Answers 3


If you just need all 3 ADCs to sample at the same time, you can do this by connecting all the clock signals together on one Pi O/P pin, all the MOSI signals together to another O/P pin, and all the CS signals together onto a third Pi O/P pin. Connect the 3 MISO signals to individual Pi I/P pins.

Now write some 'bit-banging' code to set the CS line low, then toggle the clock while outputting the command to the ADCs on the MOSI line, then keep toggling the clock and read the result on all 3 MISO lines simultaneously. This will give you 3 values that are very accurately aligned together, as requested.

What this won't give you is an accurate time-spacing between each measurement cycle; you can try triggering the code from an periodic interrupt, but it will be subject to pauses and delays due to higher-priority processes interrupting the transfer; maybe around 100 microseconds of jitter in the time-interval, but this very much depends on what else the CPU is doing.

If you also want accurate time-intervals between measurements, the code gets much more complex; I suspect it may be possible using SMI (Secondary Memory Interface) but it won't be easy.

  • Thanks Jayben... well done
    – Omar Alaa
    Dec 28, 2022 at 12:27

You connect all of the MISO (Master In Slave Out), MOSI (Master Out Slave In), SCLK (SPI Clock) together and to the appropriate pins on the pi. The CS\ (Chip Select) is an active low pin that enables the A/D converter so it will communicate with the pi. Each CS\ will need to be assigned to a different GPIO pin on the Pi. Only one of the pins is allowed to be asserted low at any given time. This is done to select that individual chip so you can communicate with it. If two or more are selected you will get garbage.

Your question was not clear, the parts you chose to my knowledge are not designed to be sinked.It sounds like you need a simultaneous converting A/D. Do a google search for "simultaneous converting A/D" there are many good ones available. This will allow you to convert all channels at one time then read the values sequentially. This is a SWAG as you have not given more details of your project such as data rates etc.

  • Thanks, but it is not suitable to me. My application receives stream of bits on the three ic's and prints its analog value. i need the three to work at the same time
    – Omar Alaa
    Dec 27, 2022 at 13:31

Your question keeps changing.

If you WANT independent, simultaneous conversion (depends on your definition of "simultaneous") you NEED to use different SPI devices. Although it is not clear WHY the small conversion time of MCP3008 would be a problem with sequential reading.

The BCM2711 has 6 (although not all are accessible on Pi4). I have only used SPI0, SPI1 but there is Device Tree support for all (in various combinations).

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.