DEV Community

Hedy
Hedy

Posted on

Does motion sensor catch velocity?

Short answer: most “motion sensors” don’t measure velocity directly – they just detect that something is moving.
But some types can give you velocity (or let you calculate it).

Let’s break it down by common sensor types:

1. PIR motion sensors (the classic home alarm sensor)

These little white domes in rooms/corridors:

  • Detect changes in infrared heat (your body moving across zones).
  • Output: basically just “motion / no motion” (a digital on/off).
  • They do not tell you:
    • how fast you’re moving
    • in which direction
    • how far you’ve moved

So: PIR = presence / motion detected, not velocity.

2. Ultrasonic & microwave radar motion sensors

These send out waves and look at the Doppler shift:

  • If an object moves toward/away from the sensor, the reflected frequency changes.
  • From that frequency shift, you can calculate radial velocity (speed along the line-of-sight).

In simple modules (like cheap radar motion sensors):

  • They often still just give you a “motion” signal (like PIR).
  • But technically, with more advanced processing, radar / Doppler sensors can give velocity.

3. Accelerometers & IMUs (in phones, robots, drones)

  • Measure acceleration, not velocity directly.
  • If you integrate acceleration over time, you get velocity.
    • Pros: works without external references.
    • Cons: integration drift → errors grow over time if you don’t correct with other sensors (GPS, camera, etc.).

So: yes, you can get velocity from an accelerometer, but it needs math + correction.

4. Optical flow & camera-based motion

  • A camera + algorithm tracks how pixels move between frames.
  • From that, you can compute speed and direction (e.g., a robot moving over the floor).

Again, the basic “motion detected” is easy; precise velocity is a higher-level calculation.

5. TL;DR

  • Typical consumer motion sensor in a room (PIR) → only “something moved”, no velocity.
  • Radar / ultrasonic motion sensors → can measure velocity (via Doppler), though cheap ones often just output “motion”.
  • Accelerometers / IMUs → give acceleration; with integration and processing you can get velocity.
  • Vision/optical flow → velocity is computed in software from image motion.

Top comments (0)