Camera module
The Camera Module 3 (Sony IMX708) costs $25 and is the one part in the shop that does not touch the GPIO header. It plugs into the Pi's CSI camera connector on its ribbon cable, and in circuit.py that connection is a single wire from pi.CSI to the module's CSI pin. From Python it is controlled with Picamera2, the current camera library for Raspberry Pi OS — the old picamera library does not work on current systems. The Camera (picamera2) page covers the full API.
Pins
| Pin | What it is | Type |
|---|---|---|
| CSI | Ribbon to the Pi's CAMERA connector | io |
In circuit.py:
Camera()— Camera module — $25- Pins: 1
One pin, because the ribbon carries power, ground, the MIPI CSI-2 lanes and the control channel together.
Wiring it in circuit.py
from wiring import *
pi = Pi()
camera = Camera()
pi.CSI >> camera.csiThe real ribbon has a direction: its contacts face the board's HDMI side. In the simulator the single wire is the whole connection — and it is also how Picamera2() finds the camera, so a program can tell "camera present" from "no camera" by whether the constructor succeeds.
Driving it in main.py
from picamera2 import Picamera2
from time import sleep
camera = Picamera2()
camera.configure(camera.create_preview_configuration())
camera.start()
camera.capture_file("photo.jpg") # lands in /home/pi
camera.stop()
sleep(0.5)capture_file() writes JPEG or PNG into the Pi's home folder, picked from the file extension; in the Lab the Files panel shows what was captured. capture_array() returns a NumPy frame and capture_image() a PIL image. Without the camera wired, Picamera2() raises IndexError: list index out of range, the same error the real library gives with no camera connected.
Electrical notes
- Sensor: Sony IMX708, a 4608 × 2592 (11.9 MP) array with 1.4 µm pixels, a 66° field of view and phase-detect autofocus.
- The three standard modes are 1536 × 864 at 120 fps, 2304 × 1296 at 56 fps and 4608 × 2592 at 14 fps.
- It is powered from the CSI connector, not the header: nothing to budget on the 3V3 or 5V rails.
- Always
stop()orclose()the camera when finished, or the sensor stays active — in the simulator that keeps the module's activity LED lit. - Ribbon cables are fragile and orientation matters; a reversed or loose ribbon is the usual cause of
Picamera2()failing on real hardware.
Simulator vs real hardware
- The picture source is a feed setting: a deterministic
test sceneby default, this computer's webcam, or a still image. Sensor noise, vignetting and white balance are knobs; a larger picture can be fed from the Lab and the model still adds those imperfections. - Frames are rendered up to 1920 × 1080: a request for the full 11.9 MP still is scaled down, keeping the aspect ratio (so the saved "still" is really 1920 × 1080). The array format follows the stream configuration (
XBGR8888,BGR888,RGB888). - In judged runs there is no page to draw the picture:
capture_array()returns a grey frame andcapture_file()a minimal JPEG. Objective tests must not check pixel values. - There is no
capture_requestloop, no video encoders, no preview window (start_preview()does nothing) and no multi-camera support.global_camera_info()always reports the one IMX708 even when nothing is wired — usePicamera2()itself to check the ribbon.
Going deeper
- The full API walkthrough: Camera (picamera2) — configurations, metadata and the judged-run behaviour.
- Primer: I²C, SPI, UART and 1-Wire — CSI is a different bus again.
- Parts that do touch the header, for contrast: LDR, GPS, MPU-6050.
Further reading
- Camera Module 3 product brief — sensor, modes and lens specifications.
- Picamera2 manual — the official guide to the library.
- picamera2 on GitHub — examples and release notes.