Automated Window Lock

Introduction

 
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.
 
Requirement
  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.
 
IoT
 
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.
 
IoT
 
Step 3
 
Include the header file for Servo motor.
 
IoT
 
Step 4
 
Initialize the Servo motor and the LDR in the initial stage.
 
IoT
 
Step 5
 
Declare the pin 10 of Arduino for Servo motor.
 
IoT
 
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.
 
IoT
 
Step 7
 
Save the code and upload it to the Arduino UNO board.
 
IoT
 
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.
 
IoT
 

Summary

 
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.