top of page
Search

Life Saver Project: Door-Activated Study Mode

  • Writer: thestudentprojects
    thestudentprojects
  • May 17
  • 3 min read

ree

🛠️ The Student Projects – Your Innovation Partner

The Student Projects is a creative and passionate platform dedicated to helping engineering and diploma students bring their final year project ideas to life. We specialize in Arduino-based, IoT-based, Embedded Systems, and Python projects for ECE, EEE, and CSE branches.

From idea to execution – we provide:

  • ✅ Ready-made projects with full documentation

  • ✅ Custom project development based on your concepts

  • ✅ Complete support including code, circuit, simulation, and report

  • ✅ Help with competitions like Hackathon etc.

  • Reasonable prices + student-friendly guidance

Whether you're building something basic or showcasing innovation, we're here to make sure your project stands out.

📍Based in Hyderabad – Projects delivered PAN India 🇮🇳


Step-by-Step Guide:

This guide will walk you through building a system that automatically switches your computer screen to a study resource when you open the door, using an Arduino, an IR sensor, and a Python script.


Hardware Setup

  1. Gather Components:

    • Arduino Uno

    • IR Sensor

    • USB cable (Arduino)

    • Jumper wires

  2. Make Connections:

    • Circuit
      Circuit

      Connect the IR sensor to the Arduino as shown in the circuit diagram:

      • IR Sensor VCC to Arduino 5V

      • IR Sensor GND to Arduino GND

      • IR Sensor OUT to Arduino Digital Pin 2


Software Setup

1. Arduino Setup

  1. Install Arduino IDE:

  2. Open Arduino IDE

  3. Create New Sketch

  4. Copy Arduino Code:


Arduino code:

const int irSensorPin = 2; // Connect the digital IR sensor's output pin to Arduino digital pin 2 int doorOpen = false; // Flag to track if the door is considered "open" void setup() { Serial.begin(9600); pinMode(irSensorPin, INPUT); Serial.println("Digital IR Sensor Ready"); } void loop() { int sensorValue = digitalRead(irSensorPin); // Check for door opening (HIGH signal) and only trigger once if (sensorValue == HIGH && !doorOpen) { Serial.println("DOOR_OPENED"); doorOpen = true; // Set the flag to prevent repeated triggers } // Check for door closing (LOW signal) and reset the flag if (sensorValue == LOW && doorOpen) { doorOpen = false; // Reset the flag, ready for the next opening } delay(100); // Small delay }


  1. Connect Arduino: Connect Arduino to computer with USB.

  2. Select Arduino Board: Tools > Board > Arduino Uno

  3. Select Arduino Port: Tools > Port > (Your Arduino Port)

  4. Upload Code: Sketch > Upload



2. Python Setup

  1. Install Python:

  2. Install PySerial:

    • Open terminal/command prompt and run:

      pip install pyserial


  3. Create Python Script:

    • Create a new file (e.g., life_saver.py).

  4. Copy Python Code:


Python script:

import serial

import webbrowser

import time


# --- Configuration ---

serial_port = 'COM10' # Replace with your Arduino's serial port

baud_rate = 9600

study_url = "https://www.youtube.com/watch?v=jNOy11yq0gU" # Replace with your desired study webpage

trigger_message = "DOOR_OPENED"


try:

arduino_serial = serial.Serial(serial_port, baud_rate)

print(f"Connected to Arduino on {serial_port}")

time.sleep(2) # Give time for serial connection to establish


while True:

if arduino_serial.in_waiting > 0:

data = arduino_serial.readline().decode('utf-8').strip()

print(f"Received from Arduino: '{data}'")

if data == trigger_message:

print(f"'{trigger_message}' received! Opening: {study_url}")

webbrowser.open_new_tab(study_url)


except serial.SerialException as e:

print(f"Error opening serial port '{serial_port}': {e}")

except KeyboardInterrupt:

print("Exiting...")

finally:

if 'arduino_serial' in locals() and arduino_serial.is_open:

arduino_serial.close()

print("Serial port closed.")


  1. Edit Python Script:

    • Set serial_port to your Arduino's port (e.g., 'COM3').

    • Set study_url to your desired webpage.

3. Run the Project

  1. Connect Arduino: Arduino connected, code uploaded.

  2. Open Terminal/Command Prompt

  3. Navigate to Script: cd to the directory of life_saver.py.

  4. Run Script: python life_saver.py

  5. Test: Open/close door. Verify study URL opens.

 
 
 

Comments


bottom of page