This project uses an ultrasonic sensor to detect nearby objects and turn on an LED when something comes within a certain distance.
The system continuously measures distance using the ultrasonic sensor:
- If an object is detected within 100 cm, the LED turns ON
- If no object is nearby, the LED stays OFF
This simulates a motion-activated light system, although it is based on distance detection rather than true motion sensing.
- Arduino Uno
- Ultrasonic Sensor (HC-SR04)
- LED
- Resistor (220Ω recommended)
- Jumper wires
- Breadboard
- VCC → 5V
- GND → GND
- TRIG → Pin 2
- ECHO → Pin 3
- Anode (+) → Pin 4 (through resistor)
- Cathode (−) → GND
-
The ultrasonic sensor measures distance, not actual motion
-
Detection range depends on environment and obstacles
-
You can adjust sensitivity by changing this line:
if(distance < 100)
- Add a buzzer for alerts
- Reduce delay for faster response
- Use a PIR sensor for true motion detection
- Add an LCD display to show distance
Richard Aldo Makendi