All modules
Intermediate18 min read

Sensor Selection Guide

LIDAR, ultrasonic, stereo depth, IMU — what each one actually does, when to use it, and the integration mistakes that waste a week.

The sensor stack for mobile robots

Most indoor mobile robots need four sensing capabilities: ranging (how far is that wall?), mapping (what does the room look like?), localization (where am I in that map?), and ego-motion (how fast am I moving, which direction?). Different sensors answer different questions.

How far is that wall?
LIDAR or ultrasonic
What does the room look like?
LIDAR (2D/3D map)
What is that object?
Depth camera + AI
How fast am I moving?
Wheel encoders + IMU

LIDAR vs ultrasonic

LIDAR (RPLIDAR A1)Ultrasonic (HC-SR04)
Range0.15–5.5m0.02–4m
Coverage360° 2D scanSingle cone ~15°
Resolution1° angular, 2000 samp/sSingle point, ~50ms cycle
Maps rooms?Yes (SLAM)No — point detection only
Cost~$99~$3.50
Best forFull room mapping, nav2Simple obstacle avoidance, MCU tier
InterfaceUSB (serial)GPIO (2 pins per sensor)
ROS2 supportrplidar_ros2 (active)Manual GPIO node needed

Ultrasonic for proof-of-concept at $83. LIDAR when you need a map and nav2 integration.

Depth cameras: what “stereo” actually means

Stereo depth cameras (OAK-D Lite, RealSense D435) use two cameras with known separation (baseline) to triangulate depth from disparity — how much offset exists between the same point in left and right frames. Wider baseline = better depth at long range. Smaller baseline = better accuracy up close.

OAK-D Lite baseline: 75mm. Good for 0.3–8m range — ideal for indoor mobile robots. RealSense D435 baseline: 50mm (D435), 95mm (D455). D455 is better for large spaces; D435 is better near 0.3m.

ATTENTION — texture requirement

Passive stereo fails on featureless surfaces (white walls, glass, mirrors). Both OAK-D Lite and D435 can lose depth on plain walls. Active stereo (RealSense with IR projector) handles this better. OAK-D Lite handles it at medium range (>0.5m) — close-range plain walls are a weakness.

IMU: the sensor everyone underestimates

IMU (Inertial Measurement Unit) gives acceleration + angular rate. Fuse it with wheel odometry and you get much better dead-reckoning. The MPU-6050 (RP2350 kit) gives 6DOF (gyro + accel). The MPU-9250 (Mobile-Light kit) gives 9DOF (adds magnetometer for heading).

  • Gyro drift: all gyros drift over time. Fusion algorithms (Madgwick, Mahony) compensate but don't eliminate drift.
  • Vibration sensitivity: motor PWM can corrupt IMU readings. Mount on dampened standoffs, sample at 100Hz.
  • I2C address conflicts: MPU-6050 is 0x68/0x69. SSD1306 is 0x3C/0x3D. Scan the bus before assuming addresses.
  • Calibration required: gyro bias, accelerometer scale. Do this on every power-up if precision matters.