Skip to content

Test: An ADC for the Raspberry Pi (the MCP3x0x family)

Interactive Lab

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?

← Start here
MCP32081CH02CH13CH24CH35CH46CH57CH68CH79DGND10CS/SHDN11DIN12DOUT13CLK14AGND15VREF16VDD

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.

PartInputsBitsCodesLSB at 3.3 V
MCP30044 (14-pin)100–10233.22 mV
MCP30088 (16-pin)100–10233.22 mV
MCP32044 (14-pin)120–40950.81 mV
MCP32088 (16-pin)120–40950.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.