How to wire a Raspberry Pi home monitor

A Raspberry Pi home monitor wires a DHT22 temperature and humidity sensor, an HC-SR501 motion sensor and a 2-channel relay module to a Raspberry Pi 4's 40-pin header. The DHT22 runs from the 3.3 V rail, and the motion sensor and relay module run from 5 V. Each signal takes its own GPIO pin.
Wire it
Raspberry Pi 15W USB-C Power Supply (PS1)
PS1 USB-CtoU1 USB-C PWR5VDC (+)
Temperature & Humidity Sensor (B1)
U1 1 3V3toB1 VCC3.3VDC (+)B1 DATAtoU1 7 GPIO4Digital I/O (3.3V)10k pull-up to 3V3U1 9 GNDtoB1 GND0VDC (-)
PIR Motion Sensor (B2)
U1 2 5VtoB2 VCC5VDC (+)B2 OUTtoU1 11 GPIO17Digital I/O (3.3V)MotionU1 14 GNDtoB2 GND0VDC (-)
Relay Module 2-Channel 5V (K1)
U1 4 5VtoK1 VCC5VDC (+)U1 20 GNDtoK1 GND0VDC (-)U1 29 GPIO5toK1 IN1Digital I/O (3.3V)LightU1 31 GPIO6toK1 IN2Digital I/O (3.3V)Fan
Parts on the Codex
- Raspberry Pi 15W USB-C Power Supply
- Raspberry Pi 4 Model B 4GB
- Temperature & Humidity Sensor
- PIR Motion Sensor
- Relay Module 2-Channel 5V
Check ratings against the datasheet for the parts you buy before wiring.