
X-Ranging
Time-of-Flight (ToF) distance sensor module used for precise distance measurement. Uses laser-based ranging to measure distances with millimeter accuracy, enabling precise altitude hold and obstacle distance measurement.
WHAT YOU'LL LEARN
- Understanding Time-of-Flight distance sensing
- I2C sensor data reading
- Precise distance measurement techniques
- Altitude-aware flight control
DOWNLOADS
The Challenge
Build a program that uses the ToF sensor for precise distance measurement and altitude-aware drone control.
Understanding the Add-On
The X-Ranging module is a Time-of-Flight (ToF) distance sensor that uses laser-based ranging to measure distances with millimeter accuracy. Unlike ultrasonic sensors that use sound waves, ToF sensors emit infrared laser pulses and measure the time it takes for the reflected light to return. This enables highly precise distance measurements, making it ideal for altitude hold, obstacle detection, and terrain following applications.
Wiring & Connections
Connect the X-Ranging to the I2C port on the Primus V5/X2 board. The X-Ranging sensor communicates via I2C. Ensure the connector is firmly seated and the sensor lens is unobstructed for accurate readings.
| Primus V5/X2 Pin | Peripheral |
|---|---|
| GND on I2C port | GND on X-Ranging module |
| VCC on I2C port | VCC on X-Ranging module |
| SDA on I2C port | SDA on X-Ranging module |
| SCL on I2C port | SCL on X-Ranging module |
How It Works
Approach The ToF sensor is initialized over I2C and configured for continuous ranging mode. Distance readings are polled each loop cycle and can be used to control altitude or trigger actions based on proximity thresholds. Code Logic Explained On Start: The I2C bus is initialized and the ToF sensor is configured with its default I2C address. The sensor is set to continuous ranging mode for real-time measurements.Pluto Loop: On each cycle, the sensor is polled for the latest distance reading in millimeters. This value can be used for altitude-based control logic, such as maintaining a set height or triggering actions when an object is within a certain range.On Stop: The sensor is placed in standby mode and I2C communication is properly terminated.
Real-World Applications
Precise altitude holding Distance-based obstacle avoidance Terrain mapping and following
Try Further
Ready for the next challenge? Try these extensions to deepen your understanding. 1Create a terrain-following drone that maintains constant height above ground. 2Build a precise landing system using ToF for touchdown detection. 3Combine with IR sensor for multi-directional obstacle awareness. Pluto Drone Add-On Projects — Compatible with Pluto 1.2 (Primus V5) & Pluto X (Primus X2) — Drona Aviation
PlutoBlocks Code
PlutoBlocks code for this module is coming soon. Stay tuned for updates!
PlutoIDE Code (C++)
PlutoIDE C++ code for this module is coming soon. Stay tuned for updates!
Real-World Applications
Try Further
Ready for the next challenge? Try these extensions to deepen your understanding.
