Using MCP3002 Dual Channel ADC on the Raspberry Pi


This project is to use the MCP3002 dual channel 10 bit ADC with SPI interface on the Raspberry Pi. The software is written in C.


Wire up the breadboard as shown.

Now download the SPI driver and example:


Unpack the tar file and change into directory by:

tar xf adc.tar
cd adc

Start the example by:

sudo ./atod

Then follow the on screen instruction. Select channel 0 when ask. Turn the trimpot you should see the bar graph change.

The main program is atod.c to edit this file use:

nano atod.c

Edit the required line then press CTL-X to save and exit. To re-compile the program use:

make all

Parts List


Short URL:

Tags: , ,

3 Responses to Using MCP3002 Dual Channel ADC on the Raspberry Pi

  1. john on 09/01/2013 at 15:20

    From looking at the code I’m guessing this can provide analog data at best every 32usec (plus whatever short wait function uses) does that sound right? Any idea on the actual speed/responsiveness of this setup? I need close to 100usec precision for some high speed photography apparatus I’m building. Thanks for the article!

    • hossam on 22/06/2015 at 00:39

      i want use mcp3202 spi with raspberry pi with matlab but h don’t know it’s cod

  2. onur cömert on 28/12/2014 at 17:35


    I runned with mcp3202c and RpiB+ this sample circuit.

    Thanks for share.

    Now I have a problem. I measure with ADC to 0-5 volt dc from the current sensor at following link:

    I add external power supply to the circuit because this sensor needs to 24 volt DC input power.

    how to mcp3202 connect to the current sensor?