Raspberry Pi sensors and modules on a breadboard on a wooden table

Raspberry Pi Sensors: The 26 Most Important Modules at a Glance

Want to connect your Raspberry Pi to the real world – measure temperature, detect motion, keep an eye on air quality or turn a motor? Then you need the right sensors and modules. The choice is huge, and when you’re starting out it’s easy to lose track.

In this overview we cover the 26 most important Raspberry Pi sensors and modules, sorted by what they’re for, with the key specs, comparison tables and clear recommendations. We have our own guides for many of these modules and link to them where they fit.

In short

Most projects only need a handful of cheap modules that connect over I2C or a single GPIO pin.

  • Climate: DHT22 to get started, BME280 for a weather station, DS18B20 for water and outdoor use.
  • Motion and display: the HC-SR501 PIR sensor and the small SSD1306 OLED display.
  • Important: the GPIO pins only tolerate 3.3 V. Analog sensors also need an ADC such as the MCP3008 or ADS1115.

Which interfaces does the Raspberry Pi have?

Most modules use one of these interfaces:

InterfaceWiresDevices at onceTypical sensors
I2CSDA + SCL + GND + 3.3 VUp to 112 addresses, one per deviceBME280, BH1750, SSD1306, INA219
SPIMOSI, MISO, SCLK, CSSeveral (one CS pin each)MCP3008, MFRC522, NRF24L01+
1-WireOne data wire + GND + 3.3 VMany (on one wire)DS18B20*
UARTTX + RXOne per UARTGPS NEO-6M, MH-Z19C
GPIO1–2 pins (digital)Depends on free pinsDHT22, HC-SR04, PIR
Links marked with * are affiliate links, which makes them advertising. If you buy through one, I earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases. Learn more

Tip: I2C is the most convenient interface – several devices share the same four wires. You enable it in raspi-config just like SPI: enable SPI and I2C. Which pin does what is shown in our GPIO guide.

1. Temperature & humidity

Weather station, greenhouse control or home automation – temperature and humidity come up again and again in Raspberry Pi projects. The sensors differ a lot in accuracy and wiring, though.

DHT11, DHT22, SHT31, DS18B20 or BME280 – which one should you pick?

SensorTemp. accuracyHumidity accuracyInterfaceApprox. priceRecommendation
DHT11*±2 °C±5 %GPIO (proprietary single-wire protocol)€1–2Only for trying things out
DHT22*±0.5 °C±2–5 %GPIO (proprietary single-wire protocol)€3–5Best for beginners
SHT31*±0.2 °C±2 %I2C€10–16When precision matters
DS18B20*±0.5 °C– (temperature only)1-Wire€2–4Liquids and outdoors
BME280*±0.5 °C±3 %I2C/SPI€5–10Weather station (with air pressure)

DHT22 / AM2302 – the classic

DHT22 AM2302 temperature and humidity sensor module
The DHT22 comes as a bare sensor or as a module on a small board – the module is easier to wire up.

The DHT22 delivers reliable readings, is cheap and works with the usual libraries. The big brother of the DHT11 measures from -40 to +80 °C and 0–100 % relative humidity. It uses a proprietary single-wire protocol – that’s not the same as 1-Wire on the DS18B20, so you can’t mix the two on one line.

Note: the DHT22 delivers a new reading at most once every 2 seconds. If you need faster readings, pick a different sensor.

Raspberry Pi 5: the old Adafruit_DHT library no longer works on the Pi 5, use adafruit-circuitpython-dht instead. Why older GPIO libraries fail on the Pi 5 is explained in our article on RPi.GPIO and the Pi 5, and GPIO with Python compares the current libraries.

➜ View DHT22 on Amazon*

SHT31 – when accuracy counts

SHT31 temperature and humidity sensor module with pin header
The SHT31 usually sits on a small breakout board with an I2C connection.

Sensirion’s SHT31 measures temperature to a typical ±0.2 °C (0–90 °C) and humidity to ±2 % and sits on the I2C bus. It costs more than the DHT22 but gives faster, steadier readings – a good fit when tenths of a degree matter.

➜ View SHT31 on Amazon*

DS18B20 – waterproof and flexible

DS18B20 waterproof temperature probe
The waterproof DS18B20 sits in a stainless steel sleeve at the end of a cable.

The DS18B20 comes in two versions: as a bare sensor in a small TO-92 package and as a waterproof metal probe. The probe works well in aquariums, for soil temperature or outdoors. The 1-Wire protocol lets you run several sensors on the same line – ideal if you want to measure temperature in different places.

You need a 4.7 kΩ resistor between the data line and 3.3 V (pull-up). Modules on a small board usually have it already, with the bare probe you add it yourself. The data line goes to GPIO 4 by default. Enable 1-Wire with sudo raspi-config under Interface Options → 1-Wire, or add this line to /boot/firmware/config.txt and reboot:

dtoverlay=w1-gpio

Our guide temperature recording with the DS18B20 shows how to log the readings over time.

➜ View DS18B20 probe on Amazon*

2. Air pressure, temperature & humidity in one: BME280

BME280 barometric sensor for temperature, humidity and pressure
The BME280 on a breakout board, most modules support I2C and SPI.

Bosch’s BME280 is a typical sensor for weather stations. It measures temperature, humidity and air pressure at the same time – over I2C or SPI. It isn’t more accurate than the DHT22 for temperature and humidity, but it reads faster, sits conveniently on the I2C bus and adds air pressure. That lets you follow the weather trend and even roughly calculate altitude.

MeasurementRangeAccuracy
Temperature-40 to +85 °C±0.5 °C (0–65 °C)
Humidity0–100 %±3 %
Air pressure300–1100 hPa±1 hPa

Bosch’s BME680 adds a gas sensor for volatile organic compounds (VOC), which gives you a rough idea of indoor air quality. It doesn’t measure temperature or humidity more accurately.

➜ View BME280 on Amazon*

3. Air quality & gas sensors

Air quality sensors keep an eye on indoor air, feed a CO₂ monitor or measure particulate matter.

MQ series – cheap but imprecise

MQ-2 gas and smoke sensor module
MQ sensors such as the MQ-2 have an analog and a digital output.

The MQ sensors (MQ-2, MQ-7, MQ-135 and so on) are very cheap metal-oxide gas sensors. They react to various gases but need careful calibration and always measure a mix. They work for alarms (“gas present: yes/no”), not for accurate measurements. The heater inside needs 5 V and draws noticeable current. On the MQ-2, the datasheet values only apply after at least 48 hours of preheating, so let a new sensor run for two days before you calibrate it. After that, it still needs a few minutes after each power-on before the readings settle.

Important: the Raspberry Pi has no analog inputs. Read the analog output through an ADC such as the MCP3008 (see ADC modules below). Because the module runs on 5 V, the analog output can reach 5 V – a voltage divider brings it down to 3.3 V at most. Before you connect the digital output (DO), which only reports “above/below threshold”, check it with a multimeter in both states – turn the potentiometer past the threshold once to switch it. If it reads above 3.3 V in either state, it needs a voltage divider too before it goes to a GPIO pin.

➜ View MQ sensors on Amazon*

MH-Z19C – the CO₂ sensor for serious use

MH-Z19 series NDIR CO2 sensors in different versions
Modules from the MH-Z19 series – they all measure CO₂ with the NDIR method.

For real CO₂ measurements, use the MH-Z19C. It uses NDIR (non-dispersive infrared) and reports CO₂ in ppm – essential for ventilation control or CO₂ monitors you can rely on. It runs on 5 V, while its UART lines use 3.3 V and connect straight to the Pi. Many older guides still mention the MH-Z19B: Winsen no longer makes it, and the MH-Z19C has the same size and the same outputs (UART and PWM).

PropertyValue
Range400–5000 ppm CO₂ (2,000 or 10,000 ppm on some versions)
Accuracy±(50 ppm + 5 % of reading)
InterfaceUART / PWM
Supply5 V

➜ View MH-Z19C on Amazon*

PMS5003 / SDS011 – PM2.5 particulate sensor

PMS5003 laser particulate matter sensor PM2.5
The PMS5003 is flat and compact, a fan pulls air through the measuring chamber.

To measure particulate matter (PM2.5 and PM10), go for the PMS5003 (Plantower) or the SDS011 (Nova Fitness). Both use laser scattering to measure the size and number of particles. The PMS5003 is more compact, the SDS011 is larger.

SDS011 Nova PM particulate matter sensor
The SDS011 often comes with a USB adapter, so it connects to the Pi without soldering.

Both connect over UART, and the SDS011 often ships with a USB adapter. These sensors are used, for example, in the Sensor.Community network.

➜ View PMS5003 on Amazon* | View SDS011 on Amazon*

4. Light & brightness

Light sensors enable automatic lighting, twilight switches or color detection. Both sensors in this category sit on the I2C bus, so they’re easy to connect.

BH1750 – the easiest way to measure lux

BH1750 light sensor I2C lux
The BH1750 module (often sold as GY-302) measures brightness directly in lux.

The BH1750 gives you lux values directly, without any calibration on your side, and is extremely easy to connect. Range: 1 to 65,535 lux. For grow lights, automatic blinds or a twilight switch it does the job.

➜ View BH1750 on Amazon*

TCS34725 – RGB color detection

TCS34725 RGB color sensor
The TCS34725 has its own LED that lights up the object while measuring.

If you want to detect color and not just brightness, you need the TCS34725. It measures the red, green and blue components and also reports overall brightness. Ideal for sorting machines, color calibration or lighting projects.

➜ View TCS34725 on Amazon*

5. Motion detection & distance measurement

Motion and distance sensors show up in lots of projects – from a simple burglar alarm to robot control.

HC-SR501 PIR sensor – classic motion detection

HC-SR501 PIR motion detector
Under the white dome of the HC-SR501 sits the actual infrared sensor.

A PIR (passive infrared) sensor detects the heat radiation of moving people and animals. It outputs a simple 3.3 V digital signal (high/low) that goes straight to a GPIO pin. Two potentiometers set sensitivity and hold time. Our guide Raspberry Pi PIR motion sensor walks you through it step by step.

Limitation: PIR sensors need a line of sight. They don’t work through walls or glass.

➜ View HC-SR501 on Amazon*

RCWL-0516 – motion without line of sight

RCWL-0516 microwave motion sensor
The RCWL-0516 is a small radar board without a lens.

The RCWL-0516 uses microwaves (Doppler radar) instead of infrared. It detects movement through wood, plastic and thin walls – handy for hidden installations. Be aware that it also reacts to pets and moving objects such as curtains in a draught.

➜ View RCWL-0516 on Amazon*

HC-SR04 – ultrasonic distance measurement

HC-SR04 ultrasonic distance sensor
The HC-SR04 sends and receives ultrasound through its two transducers.

The HC-SR04 is an inexpensive ultrasonic sensor and measures distances from 2 cm to 4 m with about ±3 mm accuracy. It runs on 5 V, and its echo pin then outputs 5 V as well, so put a voltage divider (5 V → 3.3 V) in front of it – the Pi’s GPIO pins only tolerate 3.3 V.

SensorMethodRangeAccuracyApprox. price
HC-SR04*Ultrasound2 cm – 4 m±3 mm€2–3
VL53L0X*Laser (ToF)up to about 2 m±3 % (up to 1.2 m)€5–8

➜ View HC-SR04 on Amazon*

VL53L0X – laser time-of-flight sensor

VL53L0X time-of-flight laser distance sensor
The VL53L0X is barely bigger than a fingertip.

STMicroelectronics’ VL53L0X measures how long an infrared laser pulse takes to return (ToF = time of flight). It sits on the I2C bus, runs on 3.3 V directly at the Pi and is much smaller than the HC-SR04. For robots, obstacle detection or fill-level measurement it’s the more modern choice.

➜ View VL53L0X on Amazon*

6. Orientation, acceleration & GPS

Orientation sensors detect tilt, rotation and vibration, while a GPS module provides position and accurate time – both typical for robots, vehicles and trackers.

MPU-6050 – gyroscope and accelerometer on one chip

MPU-6050 gyroscope and accelerometer
The MPU-6050 module is usually sold as GY-521.

The MPU-6050 combines a 3-axis gyroscope with a 3-axis accelerometer on a cheap module. It sits on the I2C bus. Typical uses: balancing robots, gesture control, vibration alarms.

If you also need the compass heading, pick a 9-axis module with a magnetometer, for example one based on the ICM-20948.

➜ View MPU-6050 on Amazon*

NEO-6M GPS module – position anywhere

NEO-6M GPS module for Raspberry Pi
The NEO-6M module with its ceramic antenna attached.

u-blox’s NEO-6M is an inexpensive GPS module. It connects over UART and delivers NMEA data with position, speed and time. Keep in mind that it needs a clear view of the sky (indoors it barely works) and a few minutes for the first fix. Raspberry Pi GPS module shows the setup, and Raspberry Pi GPS tracking is a complete project.

➜ View NEO-6M GPS on Amazon*

7. Connecting analog sensors: ADC modules

Unlike the Arduino, the Raspberry Pi has no analog inputs. To use analog sensors (potentiometers, MQ gas sensors, photoresistors, joysticks …), you need an external analog-to-digital converter (ADC).

MCP3008 – the SPI classic

MCP3008 8-channel ADC SPI
The MCP3008 comes as a chip in a DIP package and fits straight into a breadboard.

8 channels, 10-bit resolution, SPI interface: the MCP3008 is cheap, well documented and supported directly by gpiozero. 10 bits give you 1024 steps between 0 V and the reference voltage (3.3 V on the Pi).

➜ View MCP3008 on Amazon*

ADS1115 – more precise over I2C

ADS1115 16-bit ADC I2C
The ADS1115 module has four analog inputs.

The ADS1115 offers 16-bit resolution over I2C, which makes it much finer than the MCP3008. It also has a programmable gain amplifier (PGA) that suits small voltages, such as load cells or current sensors. It has 4 channels.

➜ View ADS1115 on Amazon*

8. Measuring current & voltage: INA219

INA219 current and voltage sensor I2C
The INA219 module with its measuring resistor (shunt) on the board.

The INA219 measures voltage, current and power at the same time over I2C. You wire its shunt resistor in series with the line whose current you want to measure. Ideal for monitoring batteries, solar setups, motors or power supplies.

PropertyValue
Voltage range0–26 V
Max. current3.2 A (with the usual 0.1 Ω shunt)
InterfaceI2C
AddressesUp to 4 modules at once (on the usual boards)

➜ View INA219 on Amazon*

9. RFID & NFC: MFRC522

MFRC522 RFID card reader module
The MFRC522 set with reader module, card and key fob.

RFID readers are ideal for access control, attendance tracking or simple identification. The MFRC522 module sits on the SPI bus. It reads and writes MIFARE cards and tags at 13.56 MHz. Sets usually include a white card and a key fob.

Raspberry Pi 5: the mfrc522 Python library relies on RPi.GPIO and doesn’t run on the Pi 5. Our guide RFID RC522 on the Raspberry Pi 5 shows how to do it without RPi.GPIO.

➜ View MFRC522 RFID set on Amazon*

10. Displays: which one for what?

Often you want to show readings right on the device – without an extra computer or phone. Two displays are especially good for this:

SSD1306 OLED – small, bright, I2C

SSD1306 OLED display 0.96 inch I2C
The 0.96-inch OLED with SSD1306 has 128 × 64 pixels.

The 0.96-inch OLED display with the SSD1306 controller has 128 × 64 pixels, needs no backlight (the pixels light up themselves), has excellent contrast and connects to the I2C bus with just four wires.

➜ View SSD1306 OLED on Amazon*

16×2 LCD with HD44780 (I2C adapter)

The classic green or blue 16×2 LCD. With the I2C adapter (PCF8574) on the back, the wiring shrinks from 16 to 4 wires. It’s cheaper than an OLED but has less contrast and only shows text. Raspberry Pi LCD display control shows how to drive it.

➜ View 16×2 I2C LCD on Amazon*

11. Motors & actuators

Sensors measure, actuators move something. With any motor, keep in mind that the GPIO pins only provide the control signal – the motor gets its power from a separate source.

SG90 servo motor

SG90 micro servo motor
The SG90 is a micro servo with three wires.

The SG90 is an inexpensive micro servo for hobby projects. It turns between 0 and 180° and is controlled with a PWM signal. The 3.3 V signal from a GPIO pin is enough, but power it from a separate 5 V source. Typical uses: robot arms, camera pan, valve control.

➜ View SG90 servo on Amazon*

L298N – driving two DC motors

L298N dual H-bridge motor driver
The L298N board with its large heat sink and screw terminals for the motors.

DC motors, for example in small robots, need a motor driver – the GPIO pins deliver far too little current. The L298N drives two motors in both directions and handles up to 2 A per channel. Ideal for simple robot vehicles.

➜ View L298N motor driver on Amazon*

28BYJ-48 stepper motor + ULN2003 driver

28BYJ-48 stepper motor with ULN2003 driver
The 28BYJ-48 usually comes as a set with the ULN2003 driver board.

Stepper motors turn in precise steps – without feedback about their actual position. The 28BYJ-48 is a very cheap stepper motor and usually comes as a set with the ULN2003 driver board. Typical uses: pointers, camera tracking, blind control.

➜ View 28BYJ-48 + ULN2003 on Amazon*

12. Radio: NRF24L01+ for wireless communication

NRF24L01+ 2.4GHz radio module
The NRF24L01+ comes with a PCB antenna or as a version with an external antenna.

The NRF24L01+ is a 2.4 GHz radio module with 250 kbit/s, 1 Mbit/s or 2 Mbit/s. The lowest data rate gives the longest range. With a clear line of sight, sellers quote up to about 100 m for the PCB antenna version and up to about 1,100 m at 250 kbit/s for the version with an amplifier and external antenna. Indoors, walls and 2.4 GHz Wi-Fi can eat into that advantage. It sits on the SPI bus and suits simple radio networks, for example when sensor nodes should exchange data without Wi-Fi.

Note: the module needs a stable 3.3 V supply. Unreliable operation is often down to a weak power supply – a 100 µF capacitor between VCC and GND helps. For Wi-Fi sensors in a smart home, an ESP32 with ESPHome is often the easier route.

➜ View NRF24L01+ on Amazon*

Sensor quick finder: all at a glance

Sensor/moduleCategoryInterfaceApprox. priceDifficulty
DHT22*Temp. + humidityGPIO€3–5⭐ Beginner
SHT31*Temp. + humidity (precise)I2C€10–16⭐ Beginner
DS18B20*Temperature1-Wire€2–4⭐ Beginner
BME280*Temp. + humidity + pressureI2C/SPI€5–10⭐ Beginner
MQ-2*Gas (alarm)Analog via ADC€2–5⭐⭐ Intermediate
MH-Z19C*CO₂UART€35–45⭐⭐ Intermediate
PMS5003*Particulate matterUART€20–30⭐⭐ Intermediate
SDS011*Particulate matterUART/USB€25–35⭐⭐ Intermediate
BH1750*LightI2C€2–5⭐ Beginner
TCS34725*ColorI2C€5–8⭐⭐ Intermediate
HC-SR501 PIR*MotionGPIO€1–3⭐ Beginner
RCWL-0516*Motion (radar)GPIO€2–4⭐ Beginner
HC-SR04*DistanceGPIO€2–3⭐ Beginner
VL53L0X*Distance (laser)I2C€5–8⭐⭐ Intermediate
MPU-6050*Orientation + accelerationI2C€3–6⭐⭐ Intermediate
NEO-6M GPS*PositionUART€10–20⭐⭐ Intermediate
MCP3008*ADC (analog)SPI€2–5⭐⭐ Intermediate
ADS1115*ADC (precise)I2C€3–6⭐⭐ Intermediate
INA219*Current + voltageI2C€3–6⭐⭐ Intermediate
MFRC522*RFIDSPI€3–6⭐⭐ Intermediate
SSD1306 OLED*DisplayI2C€3–8⭐ Beginner
16×2 LCD (I2C)*Display (text)I2C€3–8⭐ Beginner
NRF24L01+*Radio 2.4 GHzSPI€3–6⭐⭐ Intermediate
SG90 servo*ActuatorPWM (GPIO)€2–5⭐ Beginner
L298N*Motor driverGPIO€3–6⭐⭐ Intermediate
28BYJ-48 + ULN2003*Stepper motorGPIO€3–6⭐⭐ Intermediate
* Affiliate links (advertising). Learn more

Frequently asked questions about Raspberry Pi sensors

Which sensor is best for beginners?

To get started, we recommend the DHT22 for temperature and humidity and the HC-SR501 PIR sensor for motion. Both are cheap, well documented and can be read with a few lines of Python.

What is the difference between I2C, SPI and UART?

I2C needs only two data wires, and several devices share the bus – ideal for sensors and small displays. SPI is faster and needs a separate chip select line per device, typical for ADCs, RFID readers and radio modules. UART is a serial link between exactly two devices, for example GPS modules or the MH-Z19C CO₂ sensor.

Can I connect analog sensors directly to the Raspberry Pi?

No. Unlike the Arduino, the Raspberry Pi has no analog inputs. You need an external ADC such as the MCP3008 (SPI) or the ADS1115 (I2C) to measure analog voltages.

Which temperature sensor is the most accurate?

Among the affordable sensors, the SHT31 is the most accurate at a typical ±0.2 °C. For most projects, though, the DHT22 (±0.5 °C) or the BME280 (±0.5 °C, but with air pressure) is enough.

Do these sensors work with the Raspberry Pi 5?

Yes, the sensors themselves do. Older Python libraries can fail there, though, if pip pulls in the original RPi.GPIO package with them, as mfrc522 does. For the DHT22, use adafruit-circuitpython-dht, and for the MFRC522 RFID reader, use an approach without RPi.GPIO.

How many I2C sensors can I run at the same time?

Every device on the I2C bus needs its own address, and a little over 100 are usable. In practice, fixed addresses are the limit: two identical sensors often only work together via an address jumper or an I2C multiplexer such as the TCA9548A.

What do I need to watch out for with 5 V sensors?

The Raspberry Pi’s GPIO pins work at 3.3 V and can’t take 5 V. If a sensor outputs 5 V on a data line, such as the echo pin of the HC-SR04, you need a voltage divider or level shifter. The DS18B20 also needs a 4.7 kΩ pull-up between data and 3.3 V, which modules usually have built in.

Conclusion: the most important Raspberry Pi sensors at a glance

For a solid start, a set of DHT22 (temperature), HC-SR501 (motion) and an SSD1306 OLED (display) is enough – inexpensive as a set and covered by plenty of guides online.

For a weather station, the BME280 is a better choice than the DHT22: one sensor for temperature, humidity and air pressure on the I2C bus. If you want air quality as well, add an MH-Z19C for CO₂ and, if needed, a PMS5003 for particulate matter.

For robotics projects, the MPU-6050 (orientation), HC-SR04 (distance) and L298N (motor driver) are the classic trio.

Which sensors do you use in your projects? Let us know in the comments – maybe there’s a sensor we’ve missed!

Similar Posts