# Knowledge base: real Raspberry Pi boards, modules and hobby projects Built by `make kb` (`scripts/build_kb.py`) from cached sources in `data/kb/raw/` (git-ignored). Every fact carries its source. Nothing here was written by a language model: facts come from official source files, parsed code, or datasheet passages confirmed by at least two sources. | File | Contents | Main sources | |---|---|---| | `boards.json` | 32 boards (16 in scope: every Linux Pi with a 40-pin header), SoC, header type; per GPIO family (BCM2835/6/7 + RP3A0, BCM2711, RP1): alternate functions GPIO0–27, default pulls, drive strengths, input thresholds, hardware-PWM channels | raspberrypi/documentation source (line-level links), raspberrypi/utils `pinctrl`, BCM2711/BCM2835 datasheets | | `sensors_src.yaml` | 19 modules (PIR, HC-SR04, relay boards, DHT22, DS18B20, SG90, buzzers, L298N, IR, MQ-2, soil, WS2812, button, LED, LDR, line sensor, encoder, DC motor) with signal levels, v1 action mapping, caveats; 39 source references (29 unique URLs) | datasheets, GPIO Zero docstrings, vendor/tutorial pages found with Firecrawl | | `projects.json` | 122 real project scenes (GPIO Zero recipes + 30 Raspberry Pi Foundation projects): device → BCM pin, operations, conflicts; 88 usable under spec 1.0 | gpiozero examples (AST), raspberrypilearning repos (AST + regex) | | `sources.json` | Repo commits, licences, datasheet and module URLs | | ## Verification - **Alternate functions:** the `pinctrl` tables were compared cell by cell with independent datasheets. - RP1: 252/252 cells equal to the frozen spec's datasheet-verified table. - BCM2711: 168/168 equal in substance vs the CM4 datasheet (4 cells differ only as BSCSL vs I2CSL naming). - BCM2835: 36/36 GPIO-function cells equal vs BCM2835 ARM Peripherals §6.2. - **Module facts:** each needs a primary source (datasheet or library docs) or two independent sources. - **LLM extraction is not trusted.** Firecrawl's JSON extraction mis-stated facts on the first docs page, and on one project page it fabricated an entire project (a "Smart Home Automation System" with a DHT11 on GPIO 4) when the page did not render. Firecrawl is used for discovery and quoted passages only; project facts come from the source repositories. ## Board differences that matter for a future spec 2.0 | | BCM2835/6/7, RP3A0 (Pi 1 B+/A+, 2, 3, Zero, Zero 2 W) | BCM2711 (Pi 4, 400, CM4) | RP1 (Pi 5, 500, CM5) | |---|---|---|---| | Hardware PWM | 2 channels: GPIO12+18 share PWM0 ch0, GPIO13+19 share ch1 | same as left | 4 channels: 12, 13, 18 (ch2, shared with 14), 19 (ch3, shared with 15) | | Drive strength | 2–16 mA in 2 mA steps, default 8 mA | same register, half the current; default 4, max 8 mA | 2/4/8/12 mA, reset 4 mA | | Input thresholds | V_IL ≤ 0.9 V, V_IH ≥ 1.6 V | V_IL ≤ 0.8 V, V_IH ≥ 2.0 V | (not in docs) | | Default pulls | GPIO0–8 up, 9–27 down | GPIO0–8 up, 9–27 down | not stated per pin (D-05) | | Alt functions | pinctrl table | pinctrl table (adds SPI3–6, UART2–5, I2C3–6) | frozen spec table | Spec 1.0 labels stay Pi 5/RP1-only. These rows are what a board-aware spec 2.0 would need to encode. ## Conflicts for human review - **`see-like-a-bat` (official project)** wires a vibration motor straight to GPIO 14 and drives it with PWM. This contradicts the official GPIO docs ("Do not connect motors directly to the GPIO pins"), spec F-NO-DIRECT-MOTOR and D-01 (no PWM on GPIO14/15). Excluded from positive examples; the spec rule wins. - `interactive-traffic-lights-python` uses pin 28 (a board pin number mixed into BCM code) and `led_builtin.py` uses the Pi's internal activity/power LEDs (GPIO 35/47). Both excluded. - Two module label mappings are marked `needs_review` and unused: HC-SR04 "measure distance", because the spec doesn't say which reason applies; and LDR "light level", which comes from RC timing rather than a true analog read.