GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsUSB (UVC) cameras need no driver on Linux: the Pi sees them as /dev/video0. The Waveshare OV2735 is a 2 MP USB-C camera with a small board that is easy to mount. A Python script with OpenCV compares each frame with a slowly updated background; when enough pixels change, it records 10 seconds of video to the SD card.
Respect privacy: do not record neighbours or public areas, and tell people a camera is in use.
Tick anything you already have and the total updates.
Waveshare OV2735 2 MP USB camera
Follow the colours: red is power, dark grey is ground, blue is a signal.
Official Pi supply.
motion.pyimport cv2, time, os
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280); cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
MIN_AREA, CLIP_S = 5000, 10
bg = None
os.makedirs("clips", exist_ok=True)
while True:
ok, frame = cap.read()
if not ok:
time.sleep(1); continue
gray = cv2.GaussianBlur(cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY), (21, 21), 0)
if bg is None:
bg = gray.astype("float"); continue
cv2.accumulateWeighted(gray, bg, 0.05)
diff = cv2.threshold(cv2.absdiff(gray, cv2.convertScaleAbs(bg)), 25, 255, cv2.THRESH_BINARY)[1]
if cv2.countNonZero(diff) > MIN_AREA:
name = time.strftime("clips/%Y%m%d-%H%M%S.avi")
h, w = frame.shape[:2]
out = cv2.VideoWriter(name, cv2.VideoWriter_fourcc(*"MJPG"), 15, (w, h))
end = time.time() + CLIP_S
while time.time() < end:
ok, frame = cap.read()
if ok:
cv2.putText(frame, time.strftime("%d-%m-%Y %H:%M:%S"), (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)
out.write(frame)
out.release(); print("saved", name)
Try another USB port and cable; check 'dmesg' after plugging in.
Light changes or a fan; raise MIN_AREA or point the camera away from windows.
Lower the resolution to 640x480 on a Pi 3 or Zero.
Yes, it is a standard UVC camera; the script also runs on a PC with OpenCV.
Yes, use a streaming tool such as MediaMTX or the 'motion' package.
Not in the dark; use an IR camera and IR light for night use.
4 parts: Waveshare OV2735 2MP USB Camera (A) w/ USB-C & SH1.0 Header, Raspberry Pi 4 Model B 2GB RAM Single Board Computer, Official Raspberry Pi 32GB A2 Class Micro SD Card and Official Raspberry Pi 4 USB-C Power Supply – 15.3W. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (motion.py).
About ₹10,156 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
UVC cameras on Linux; Simple motion detection with frame differences; Saving video clips with OpenCV.
Respect privacy: do not record neighbours or public areas, and tell people a camera is in use.
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Records where you went every five seconds, ready to open on a map.
Two boards, two radios: press the button at the gate and it rings indoors.
Check temperature, humidity and pressure from any phone on your Wi-Fi.
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.