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.

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

Include the header file for Servo motor.

IoT

Step

Initialize the Servo motor and the LDR in the initial stage.

IoT

Step

Declare the pin 10 of Arduino for Servo motor.

IoT

Step

 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

Save the code and upload it to the Arduino UNO board.

IoT

Step

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.

Up Next
    Ebook Download
    View all
    Learn
    View all