Automated Window Lock


In this article, we are going to see the light intensity controlled window which automatically locks when it gets dark or light intensity is reduced. In this article, we are going to use Servo motor and LDR ( photo resistor). During sunset, the windows will be automatically locked using the servo motor. It will open the window during daytime to allow sunlight because vitamin D is an essential component of the human body.
  1. Servo motor
  2. Arduino
  3. LDR
  4. Arduino Software
  5. Connecting wires
Steps to follow
Step 1
Open the Arduino software you have. I prefer the latest version.
Step  2
Select the Arduino board type and select the COM port to which Arduino is connected. Here, in our case, the COM port is COM15.
Step 3
Include the header file for Servo motor.
Step 4
Initialize the Servo motor and the LDR in the initial stage.
Step 5
Declare the pin 10 of Arduino for Servo motor.
Step 6
The code in the void loop indicates if the light intensity is decreased, the Servo motor will get ON and will close up to 90 degrees, that is, it will move on to the closed stage.
Step 7
Save the code and upload it to the Arduino UNO board.
Step 8
Now, let’s move on to the circuit diagram. Make connections as per the circuit diagram that is given below. The pin of the LDR goes to the analog pin of Arduino to get an analog input. The analog input which we get from the LDR is used to make calculations about the state of Servo motor which is connected to the 10th pin of Arduino.


In this article, we learned how to work with LDR and the Servo motor, and also, we saw how to integrate technologies to form or create products to make human life simple.

Similar Articles