555 timer LED flasher
The most famous chip in electronics, blinking an LED about once a second.
Shop by category
Shop all componentsThe MCP3008 is a 10-bit, 8-channel analog-to-digital converter that talks over SPI. The Pi sends three bytes to ask for a channel and gets back a value from 0 to 1023. This project reads a potentiometer on channel 0 and an LDR module on channel 1 with the plain spidev library, so you can see the exact bytes exchanged.
Tick anything you already have and the total updates.
LDR light sensor module
Follow the colours: red is power, dark grey is ground, blue is a signal.
The Pi's own 3.3 V; nothing extra.
mcp3008.pyimport spidev, time
spi = spidev.SpiDev()
spi.open(0, 0) # bus 0, CE0
spi.max_speed_hz = 1_000_000
def read(ch):
r = spi.xfer2([1, (8 + ch) << 4, 0]) # start bit, single-ended channel, padding
return ((r[1] & 3) << 8) | r[2]
while True:
pot = read(0)
light = read(1)
print(f"pot {pot:4d} ({pot * 3.3 / 1023:.2f} V) light {light:4d}")
time.sleep(0.5)
SPI is not enabled or CS is on the wrong pin.
VREF is missing or the input is above 3.3 V.
Add a 100 nF capacitor between VDD and GND close to the chip.
The Pi's pins are 3.3 V only; a 5 V MCP3008 would send 5 V back to the Pi.
Thousands of readings per second from Python, far more than most sensors need.
Yes, gpiozero has an MCP3008 class; spidev just shows what happens underneath.
7 parts: MCP3008 8-Channel 10-Bit ADC IC, SPI, Raspberry Pi 4 Model B 2GB RAM Single Board Computer, Official Raspberry Pi 32GB A2 Class Micro SD Card, Rotary Potentiometer Module 10k (3-Pin), Generic Photosensitive Resistor Sensor Module for Arduino – Light Dependent Resistor (LDR), Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 1-2 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (mcp3008.py).
About ₹8,069 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How an ADC works; SPI communication from Python; Scaling a raw reading to volts.
The most famous chip in electronics, blinking an LED about once a second.
Press once and the light stays on for about 11 seconds, then goes off by itself.
A running light like the one on Knight Rider, made from two classic chips.
Touch two wires with a fingertip and an LED lights: skin current switches a transistor pair.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.