# Motion Tracking with Sensors for Microcontrollers

Research by Blackbox into various sensors that can used with microcontrollers to track persons, objects, colours or other motions. What kind of differents sensors are there to use and what are the pro’s and con’s of each sensor?

#### **Sensors of Interest:**

Sensing Distance and Proximity:

- **Ultrasonic Sensor**
- **Infrared Sensors / IR  
    [Infrared (IR) break-beam](https://bookstack.hku.nl/books/arduino-things/page/infrared-ir-break-beam-sensor)**
- **PIR Motion Sensor**
- **Microwave Doppler Radar Sensor**
- **Grove IR Disctance interrupter**

More advanced sensing:

- **LiDAR,<span class="Apple-converted-space"> </span>**
- **ToF, Time-of-flight sensors**
- **HuskyLens AI Vision**

Can also be used:

- **LDR Photocell sensors**
- **Capacitance sensors**
- **PhotoDiodes**

##### **Ultrasonic Sensor<span class="Apple-converted-space"> </span>**

[![grove-ultrasonic-distance-sensor-preview_1-1-1030x773.png](https://bookstack.hku.nl/uploads/images/gallery/2023-04/scaled-1680-/grove-ultrasonic-distance-sensor-preview-1-1-1030x773.png)](https://bookstack.hku.nl/uploads/images/gallery/2023-04/grove-ultrasonic-distance-sensor-preview-1-1-1030x773.png)

##### [**Example project**](https://bookstack.hku.nl/books/arduino-things/page/ultrasonic-of-pir-sensor-arduino-touchdesigner)

The Ultrasonic Sensor is arguably the most common distance measuring sensor, also known as the Sonar sensor. It detects the distance to objects by emitting high-frequency sound waves. The object needs to be in line with the sensors not so wide range. Used a lot in DIY distance measurement projects, robotics, smart cars, drones. Most common used sensor is the *HC-SR04.*

**+**

- not affected by colour object or transparency.
- Works well in dim places

**-<span class="Apple-converted-space"> </span>**

- limited detection range
- Not good in tracking fast objects
- Unable to measure objects with extreme textures or surfaces.

Detection is good for example; knowing if someone ‘entered’ the space and switch on video. Not so good for when you want one or multiple persons tracked.<span class="Apple-converted-space"> </span>


[![Screenshot 2023-04-25 at 15.54.47.png](https://bookstack.hku.nl/uploads/images/gallery/2023-04/scaled-1680-/screenshot-2023-04-25-at-15-54-47.png)](https://bookstack.hku.nl/uploads/images/gallery/2023-04/screenshot-2023-04-25-at-15-54-47.png)

#####   


##### **Infrared Sensor (IR) <span class="Apple-converted-space"> </span>**

##### **<span class="Apple-converted-space">[![Screenshot 2023-04-25 at 15.54.51.png](https://bookstack.hku.nl/uploads/images/gallery/2023-04/scaled-1680-/screenshot-2023-04-25-at-15-54-51.png)](https://bookstack.hku.nl/uploads/images/gallery/2023-04/screenshot-2023-04-25-at-15-54-51.png)  
  
[Example project](https://www.makerguides.com/sharp-gp2y0a21yk0f-ir-distance-sensor-arduino-tutorial/)  
</span>**

IR distance sensors work through the principle of triangulation; measuring distance based on the angle of the reflected beam. Used a lot in TV’s, computers and laptops, distance measurement projects, security systems, monitoring and control applications.

Recommended sensor: *80cm Infrared Proximity Sensor - GP2Y0A21YK*

**+**

- Small size
- Daytime and Nighttime usage
- Able to measure the distance of objects that have complex surfaces unlike ultrasonic sensors

**-**

- Limited measurement range
- Affected by environment conditions and hard objects

[![Screenshot 2023-04-25 at 15.55.03.png](https://bookstack.hku.nl/uploads/images/gallery/2023-04/scaled-1680-/screenshot-2023-04-25-at-15-55-03.png)](https://bookstack.hku.nl/uploads/images/gallery/2023-04/screenshot-2023-04-25-at-15-55-03.png)

#### **PIR Motion Sensor**

#### **<span class="Apple-converted-space">[![Screenshot 2023-04-25 at 15.54.55.png](https://bookstack.hku.nl/uploads/images/gallery/2023-04/scaled-1680-/screenshot-2023-04-25-at-15-54-55.png)](https://bookstack.hku.nl/uploads/images/gallery/2023-04/screenshot-2023-04-25-at-15-54-55.png)</span>**

#### **<span class="Apple-converted-space">[Example project](https://bookstack.hku.nl/books/arduino-things/page/ultrasonic-of-pir-sensor-arduino-touchdesigner) </span>**

Passive infrared (PIR) sensors are sensitive to infrared (IR) rays and are mostly used for motion detection where humans move in or out of the sensor range.

Used a lot in appliances and gadgets for home or business (room detection). Also in DIY projects.

All living objects, whose body temperature is more than 0°C, emit the heat in form of infrared radiation through their body, also called as thermal radiations. This Radiated energy is invisible to human eye. These Signals can be detected by using PIR sensor which is specially designed for such purpose.

<figure class="image" id="bkmrk-grid-eye-illusion">![Grid Eye Illusion](https://www.electronicwings.com/storage/PlatformSection/TopicContent/121/description/1_Grid_Eye_Illusion.PNG)<figcaption>Grid eye illusion</figcaption></figure>**PIR sensor i.e. Passive Infrared Sensor**, passive word indicates PIR Sensor does not generate or radiate any energy for detection purposes. PIR Sensors don't detect or measure "**HEAT**"; they detect the infrared radiation emitted or reflected from objects.They are small, inexpensive, low power and easy to use. They are commonly found at home, medical, factories etc. areas.

[Link to more info about PIR sensors](https://www.electronicwings.com/sensors-modules/pir-sensor)


##### **Microwave Doppler Radar Sensor**

**[![Screenshot 2023-04-25 at 16.00.00.png](https://bookstack.hku.nl/uploads/images/gallery/2023-04/scaled-1680-/screenshot-2023-04-25-at-16-00-00.png)](https://bookstack.hku.nl/uploads/images/gallery/2023-04/screenshot-2023-04-25-at-16-00-00.png)**

<span class="Apple-converted-space">For most of our Arduino projects that require knowing if someone has left or entered the area, the [PIR sensor](https://lastminuteengineers.com/pir-sensor-arduino-tutorial/) is an excellent choice. However, because they only detect movement from living things, they will generate fewer false alarms.</span>

<span class="Apple-converted-space">This is where a microwave sensor like the RCWL-0516 comes in handy. The RCWL-0516 microwave sensor detects any movement from any object and does not rely on heat signatures, making it more reliable in hot environments where a PIR sensor may not be as effective.</span>

[More about Doppler Microwave sensors here](https://lastminuteengineers.com/rcwl0516-microwave-radar-motion-sensor-arduino-tutorial/?utm_content=cmp-true)

**[![Screenshot 2023-04-25 at 16.01.44.png](https://bookstack.hku.nl/uploads/images/gallery/2023-04/scaled-1680-/screenshot-2023-04-25-at-16-01-44.png)](https://bookstack.hku.nl/uploads/images/gallery/2023-04/screenshot-2023-04-25-at-16-01-44.png)And a tutorial explaining the <span class="Apple-converted-space">RCWL-0516 Microwave Doppler Radar </span>sensor and running a beginner test can be found [here by CircuitDigest ](https://circuitdigest.com/microcontroller-projects/arduino-rcwl-0516-radar-sensor-interfacing).**


#### **Grove IR Disctance interrupter**

is used to detect any object blocking the path of light. The module consists of an IR LED and a photosensor (phototransistor) pair. The light emitted by the IR LED gets reflected by any object placed in front of the sensor and this reflection is detected by the photosensor(phototransistor). Any white (or lighter) colored surface reflects more than black (or darker) colored surface.

[![IR-dist-intr.png](https://bookstack.hku.nl/uploads/images/gallery/2026-03/scaled-1680-/tPpir-dist-intr.png)](https://bookstack.hku.nl/uploads/images/gallery/2026-03/tPpir-dist-intr.png)

When the reflected light is detected, it produces **Digital HIGH** (or Binary **1**) output on the **SIG** pin. The on-board LED indicator will also glow. If no reflection is detected or if the object is too far from the sensor, the output on the **SIG** pin stays at **Digital LOW** (Binary 0). The on-board LED indicator will be off as well. The detectable range of this sensor is 7.5–40 cm. The module incorporates a Rail-to-Rail Operational Amplifier to amplify the output of phototransistor. There is a potentiometer which can be used to adjust the gain of the amplifier, that is, sensitivity of detection.  
[More info &amp; sample project here](https://bookstack.hku.nl/books/arduino-things/page/grove-ir-distance-interrupter-v12)

####  **Lidar TF Luna  
  
[![TF-Luna_LiDAR_Range_Sensor.png](https://bookstack.hku.nl/uploads/images/gallery/2025-03/scaled-1680-/tf-luna-lidar-range-sensor.png)](https://bookstack.hku.nl/uploads/images/gallery/2025-03/tf-luna-lidar-range-sensor.png)**

TF-Luna is a single-point ranging Lidar based on the TOF principle. With its unique optical and electrical design, it adopts an 850nm infrared light source to achieve stable, accurate, and highly sensitive distance measurements.   
[More information here](https://www.waveshare.com/wiki/TF-Luna_LiDAR_Range_Sensor)

**[Lidar TF Luna Sensor](https://bookstack.hku.nl/books/arduino-things/page/lidar-with-arduino-tf-luna-sensor) example project**