Skip to content
If this is your first visit, please click here to learn about shipping and delivery.
If this is your first visit, please touch here to learn about shipping and delivery.
Eight-pin through-hole integrated circuit package

Add Two Analogue Inputs with an MCP3002: SPI Bring-Up and Measurement Checks

An external ADC is useful when a controller lacks analogue inputs or its existing channels are already occupied. The MCP3002 offers a compact way to add two inputs, but getting numbers over SPI is only the first milestone. The next is establishing that those numbers represent the voltage you intended to measure.

A good bring-up separates three questions: is the interface communicating, is the analogue input settling correctly, and is the conversion from code to engineering units valid?

Establish the device and supply arrangement

PMD Way's MCP3002 ADC IC is listed in an eight-pin DIP package. Check the device marking and package orientation before wiring. A generic package photograph is not a substitute for reading the pin-one mark on the actual component.

The Microchip MCP3002 datasheet specifies 10-bit conversion, a 2.7–5.5 V supply and two single-ended inputs or a pseudo-differential pair. Its supply also serves as the reference. Maximum throughput is specified as 200 ksps at 5 V and 75 ksps at 2.7 V; neither figure promises that an application loop will achieve that rate.

Choose a supply compatible with the controller's logic levels and the sensor range. A supply-voltage range does not imply automatic level conversion between a 5 V ADC and a 3.3 V processor. Check input thresholds and output limits in both directions, including chip select and clock.

Make a connection map before assembly

For the documented eight-pin package, CS/SHDN is pin 1, CH0 pin 2, CH1 pin 3, VSS pin 4, DIN pin 5, DOUT pin 6, CLK pin 7 and VDD/VREF pin 8. Confirm the drawing's viewing direction.

Connect controller output to ADC DIN and ADC DOUT to controller input. Keep a written map using signal names, rather than relying solely on wire colours. Use the board manufacturer's pinout to locate its SPI interface.

Follow the ADC's decoupling and layout guidance. Keep analogue wiring away from fast digital return currents and avoid long loose connections during initial testing. Inspect the circuit with power removed, then check the supply at the IC before attaching a sensor.

Start with one known input

Use a stable, low-impedance test source within the permitted input range. Begin near ground, then test a middle-of-range voltage verified by a suitable meter. Keep the unused channel at a defined valid level for a repeatable experiment.

Record raw codes before adding calibration, smoothing or unit conversion. A test display that immediately converts everything into temperature can hide a byte-alignment error behind plausible-looking numbers.

Compare several points rather than expecting one exact code. Small changes between adjacent codes can be normal; gross scale errors, a stuck maximum or values that move in large binary steps deserve investigation before the sensor is introduced.

Verify the SPI transaction

The MCP3002 supports SPI modes corresponding to mode 0 and mode 3. Follow its timing diagram for the start bit, channel selection and result alignment. Use a permitted clock rate and honour both conversion and acquisition timing.

Arduino's official API reference documents SPISettings, beginTransaction() and endTransaction(). Set clock, bit order and mode explicitly for the device. Shared-bus software should restore the correct transaction settings whenever it accesses the ADC.

A logic analyser helps answer specific questions: does chip select frame the intended transfer, are clocks present, and does the returned bit sequence change with the applied voltage? Save a capture from a known input alongside the software version. That provides a useful reference if later changes break the interface.

Understand what the reference means

A 10-bit converter has 1,024 code intervals. With an illustrative 3.300 V reference, one ideal interval is about 3.223 mV. A first-order voltage estimate is Vin ≈ code × Vref / 1024, while remembering quantisation, endpoint behaviour and real converter errors.

Code 512 then corresponds approximately to 1.650 V. If software assumes 3.300 V while the actual reference is 3.200 V, the same code corresponds to about 1.600 V. Displaying more decimal places does not correct that reference error.

Analog Devices' sensor excitation guide explains ratiometric measurement: the converter measures the input relative to its reference. A sensor or divider excited from the same reference can produce a useful ratio even when the supply varies. An independently generated absolute voltage requires a different error assessment.

For a position-control experiment, compare the raw ratio with the physical position. For an absolute voltage measurement, measure and account for the reference, divider tolerance and meter uncertainty.

Check source impedance and channel settling

A SAR ADC input includes a sampling capacitor that must settle during acquisition. Microchip's acquisition-time explanation describes why source impedance affects this process. Use the specific ADC's input model and timing requirements rather than applying a generic resistance limit.

A high-value divider can look correct on a voltmeter yet fail to charge the ADC's sampling network adequately. A buffer or revised source network may be needed. Simply delaying between software calls does not necessarily lengthen the relevant acquisition phase; check when the device actually samples.

Test each channel alone, then alternate between two well-separated known voltages. If results change with channel order or clock rate, investigate settling and transfer timing. Do not conceal that pattern with a moving average.

Build a useful validation record

Tests to complete before adding application features
Test What to record
Several known DC levels Meter reading, raw code and reference voltage.
Repeated samples at a fixed input Spread, outliers and any periodic interference.
Alternating channels Whether the previous channel affects the next reading.
Different allowed clock rates Any change in accuracy or communication reliability.
Application load switching Noise associated with displays, motors or radio activity.

After those checks, connect the real sensor and verify its complete output range, startup behaviour and fault conditions. Pseudo-differential operation does not authorise arbitrary below-ground inputs; remain within the documented input limits.

When selecting from the analogue-to-digital IC collection, match the converter to the measurement task. A verified interface, suitable input drive and honest reference model are what turn additional channels into reliable measurements.

Previous article Battery Power for Arduino Projects: Voltage Range, Runtime and Regulator Heat