Test: An ADC for the Raspberry Pi (the MCP3x0x family)
An ADC for the Raspberry Pi: the MCP3x0x family
The Pi has no ADC. Pick a converter, wire it to SPI0, turn light into a code and watch the code come back over SPI.
An MCP3208 reads 2048 for 1.65 V with VREF = 3.3 V. What does an MCP3008 read for the same input?
Top view, pin 1 by the notch. Click a pin.
Pick a pin
The chip has three groups of pins: the analogue inputs, the SPI interface, and the supply, reference and grounds.
| Part | Inputs | Bits | Codes | LSB at 3.3 V |
|---|---|---|---|---|
| MCP3004 | 4 (14-pin) | 10 | 0–1023 | 3.22 mV |
| MCP3008 | 8 (16-pin) | 10 | 0–1023 | 3.22 mV |
| MCP3204 | 4 (14-pin) | 12 | 0–4095 | 0.81 mV |
| MCP3208 | 8 (16-pin) | 12 | 0–4095 | 0.81 mV |
The name encodes the part: MCP300x is 10-bit and MCP320x is 12-bit; the last digit is the number of inputs. The MCP3208 samples at up to 100 ksps at 5 V, 50 ksps at 2.7 V (datasheet DS21298). All four use the same SPI interface, and Linux’s mcp320x IIO driver supports each of them.
0 of 4 predictions made. The light, resistor and rail you set in tab 3 carry into the SPI frame.
What this does not model: the converter’s offset, gain and linearity errors, noise, the LDR’s slow response and its spread from part to part, the source impedance against the sample time (the front-end lab in Section 7.3 covers it), pseudo-differential mode, and SPI timing other than the bit order. The LDR curve is a typical power law, not a datasheet.
© 2026 Derek Molloy, Dublin City University. All rights reserved.