Raspberry Pi practice problem · I²C, SPI, UART & 1-Wire
Quiet the noise
HardBudget $12Python · gpiozero
Every ADC reading carries some noise. This MCP3008 is on a noisy board: a single read wanders by several counts. Averaging N reads shrinks the noise by √N.
Build: a potentiometer on channel 0 of an MCP3008 on SPI with CS on CE0 (the knob + ADC board kit is pre-wired).
Program: every 0.5 s take 64 readings of channel 0 (with spidev or gpiozero's MCP3008(channel=0).raw_value), average them and print the rounded result:
Knob: 410
The test sets the knob to 40 % (ideally 409.6 counts), then 80 % (819.2) at 3 s. Every printed value must be within ±2 counts of the ideal.