Motion Sensor Light Switch(automatic Light Switch)

Photo of Adnanrk

Made by Adnanrk

About the project

I made a arduino based project which can switch on the light when someone passes by the door to enter the uses a ultrasonic sensor(distance sensor) to identify when someone cuts the wave and enters the room,then the servo switchs then button.This can be modified to turn of the light also,but for that you'll need two ultrasonic sensors to count the people entered the room and how many of them left the room so that it can operate accordingly.

Project info

Difficulty: Easy

Estimated time: 1 hour

Items used in this project

Hardware components

Arduino Uno Rev 3 Arduino Uno Rev 3 x 1
servo motor servo motor x 1
Ultrasonic Sensor HC-SR04 Ultrasonic Sensor HC-SR04 x 1
Female/Female Jumper Wires - 40 x 12" Female/Female Jumper Wires - 40 x 12" x 10
(6~12)v battery (6~12)v battery x 1

Software apps and online services

arduino IDE arduino IDE


video showing making procedure and working

Step 1: Components Required.

we'll need the following things:

1.Arduino uno

2.servo motor

3.A 5v battery

4.ultrasonic sensor(distance sensor)

5.some jumper wires

Step 2: Connect the Servo Motor

connection diagram(schematics) is given here(its in pdf)

Step 3: Connect the Ultrasonic Sensor

Step 4: Upload the Code

the code file is attached here,

copy the code from the document paste it in arduino IDE an upload it :)

Step 5: Connect Your Battery

Step 6: Some Instructions!!

Step 7: Finally!! Is How Its Attached.

Enjoy the hands free switching :)

Schematics and circuit diagrams

shematic of the circuit diagram:

use this diagram for the connections.


Required code:


Photo of Adnanrk


I am pursuing graduation in mechanical engineering.i am passionate about making creative & innovative mechanisms,science projects and also at a initial level of robotics(learning Arduino & programming)


Leave your feedback...