Transform Your Raspberry Pi 4B with Sensors

The ultimate resource for connecting, programming, and deploying sensors with Raspberry Pi 4B. Discover compatible sensors, learn wiring guides, and get inspired by innovative projects.

Raspberry Pi 4B
Raspberry Pi 4B

Compatible Sensors

Browse our curated collection of sensors perfectly suited for Raspberry Pi 4B projects

Environment

DHT22 Temperature & Humidity Sensor

Digital

Precision humidity and temperature sensor with ±2% accuracy.

$5.99
Motion

HC-SR501 PIR Motion Sensor

Passive

Infrared motion detection sensor with adjustable sensitivity.

$3.25
Force

HX711 Load Cell Sensor

Analog

Weight measurement sensor capable of handling up to 10kg.

$7.80
Light

BH1750 Light Intensity Sensor

I2C

High-resolution ambient light sensor in the range of 1-65535 lux.

$2.99

GPIO Connection Guide

Power Connections

  • ✓ 3.3V Pin: Powers low-voltage sensors
  • ✓ 5V Pin: Powers high-voltage sensors
  • ✓ Ground Pin: Complete the circuit

GPIO Communication

  • ✓ I2C: For sensors with SDA/SCL pins
  • ✓ SPI: For high-speed communication
  • ✓ UART: For serial communication

Basic Python Example

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
SENSOR_PIN = 18

def reading(pin):
    GPIO.setup(pin, GPIO.IN)
    return GPIO.input(pin)

try:
    while True:
        sensor_value = reading(SENSOR_PIN)
        print(f"Sensor value: {sensor_value}")
        time.sleep(0.5)
except KeyboardInterrupt:
    GPIO.cleanup()

Raspberry Pi GPIO Diagram

3.3V
GPIO2
GPIO3
GND
GPIO4
GPIO14
GPIO15
GPIO17
GND
GPIO27
GPIO22
GPIO10
GPIO9
GPIO11
GND
GPIO0
GPIO Pins
Power
Digital I/O
I2C/SPI
Ground
UART
PWM

Sensor Connection Tips

  • ✓ Always disconnect power before wiring sensors
  • ✓ Double-check voltage requirements (3.3V vs 5V)
  • ✓ Use pull-up/pull-down resistors for digital inputs
  • ✓ Enable I2C/SPI interfaces via raspi-config

Featured Sensor Projects

Get inspired by projects built with Raspberry Pi 4B and sensors

Smart Home Hub

Control lights, monitor environment, and detect motion using various sensors.

Motion Temp/Humidity Door

Automated Plant System

Monitor soil moisture, light levels, and automate watering schedules.

Soil Light Water

Obstacle Avoidance Robot

Ultrasonic sensors and motion control for autonomous navigation.

Ultrasonic Motors IMU

Stay Updated

Get new sensor guides, project ideas, and Raspberry Pi tips delivered to your inbox.

Made with DeepSite LogoDeepSite - 🧬 Remix