

Learn analog sensor interfacing and autonomous landing control in this intermediate project. The LDR module measures ambient light intensity, and you'll program the drone to automatically land when it enters a dimly lit area - combining ADC reading, threshold logic, and timed flight commands for smart environment-aware behavior.
Build a program for the drone that automatically lands when it enters an environment with low light levels.
An LDR (Light Dependent Resistor) is a sensor whose resistance changes based on the intensity of light falling on it. More light produces lower resistance (and lower ADC readings), while less light produces higher resistance (and higher ADC readings). The sensor returns analog values from 0 to 4096 via the ADC port, providing a continuous measure of ambient brightness. Bright Light 500-2500Normal Light >2500Dim Light 0-4096ADC Range 105Landing Speed >=2500Dim Threshold 5000msTimer Period 3-5sLanding Time
Connect the LightSense to the ADC port on the Primus V5/X2 board. Position the LDR so it faces outward from the drone body, unobstructed by propellers or frame. Environmental lighting conditions vary - calibrate the threshold (2500) for your specific environment.
| Primus V5/X2 Pin | Peripheral |
|---|
PlutoBlocks code for this module is coming soon. Stay tuned for updates!
PlutoIDE C++ code for this module is coming soon. Stay tuned for updates!
Ready for the next challenge? Try these extensions to deepen your understanding.
| VCC on ADC port | VCC on LDR Sensor |
| GND on ADC port | GND on LDR Sensor |
| Signal on ADC port | A0 on LDR Sensor |
Approach We use a 5-second repeating timer to control the landing duration. The drone checks if the LDR reading exceeds the dim-light threshold (2500) and if the timer has triggered, then initiates landing at speed 105. Code Logic Explained On Start: Timer1 is set as a repeating timer with a 5000ms (5 second) interval. This longer timer is necessary because landing takes 3-5 seconds depending on hovering height.Pluto Loop: The code prints the current LDR value to the console for debugging ("LDR_value", Read ADC Pin ADC_1). It then checks two conditions: the ADC reading is greater than or equal to 2500 (indicating dim light) AND Timer1 has triggered. When both conditions are met, the drone executes a landing command at speed 105 and prints "Landed" to confirm. The 5-second timer ensures the drone has enough time to complete the landing maneuver. Yellow LED (Red + Green) indicates the loop is running.On Stop: Timer1 is reset to clean up. Landing Speed >=2500Dim Threshold 5000msTimer Period 3-5sLanding Time
Environment-aware autonomous landing Light-guided drone navigation Day/night adaptive drone behavior
Ready for the next challenge? Try these extensions to deepen your understanding. 1Build a light-flash follower drone that moves toward the brightest light source. 2Add a second LDR to create a wall-line following drone that tracks light/dark boundaries. 3Combine with the GlowLite module to auto-activate lights when entering dark areas. Pluto Drone Add-On Projects — Compatible with Pluto 1.2 (Primus V5) & Pluto X (Primus X2) — Drona Aviation