PIR Sensor Based TV Time Limit Reminder

Project Overview

This project creates a TV time limit reminder that alerts when someone has been watching for too long. A PIR sensor detects when the viewing area is occupied, and a timer tracks how long the TV has been on. After a set period (e.g., 2 hours), a buzzer sounds as a reminder to take a break.

Difficulty: Beginner
Estimated time: 1-2 hours
Estimated cost: $15-20

How It Works

A PIR sensor monitors the couch or viewing area. When motion is detected, a timer starts. If motion continues for the set limit (e.g., 2 hours), a buzzer sounds to remind the viewer to take a break. The timer resets after a period of no motion (e.g., 5 minutes).

Materials Needed

  • Arduino Nano or Uno (1)
  • HC-SR501 PIR sensor (1)
  • Buzzer (1)
  • LED (optional, for status)
  • 220Ω resistor
  • Jumper wires
  • Power supply (5V 1A)

Circuit Diagram

Connection Table

VCC

5V

GND

GND

OUT

Digital Pin 2

Positive

Digital Pin 8

Negative

GND

Anode

Digital Pin 13

Arduino Code

// TV Time Limit Reminder with PIR
const int pirPin = 2;
const int buzzerPin = 8;
const int ledPin = 13;

const unsigned long timeLimit = 7200000; // 2 hours in milliseconds
const unsigned long resetDelay = 300000; // 5 minutes no motion to reset

unsigned long occupiedStartTime = 0;
bool occupied = false;
bool reminded = false;

void setup() {
  pinMode(pirPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  
  digitalWrite(buzzerPin, LOW);
  digitalWrite(ledPin, LOW);
  
  delay(60000);
}

void remind() {
  if (!reminded) {
    reminded = true;
    for (int i = 0; i < 5; i++) {
      digitalWrite(ledPin, HIGH);
      tone(buzzerPin, 2000, 500);
      delay(500);
      digitalWrite(ledPin, LOW);
      delay(500);
    }
  }
}

void resetTimer() {
  occupied = false;
  occupiedStartTime = 0;
  reminded = false;
  digitalWrite(ledPin, LOW);
}

void loop() {
  bool motion = digitalRead(pirPin) == HIGH;
  
  if (motion && !occupied) {
    occupied = true;
    occupiedStartTime = millis();
    reminded = false;
  }
  
  if (occupied && !motion && (millis() - occupiedStartTime > resetDelay)) {
    resetTimer();
  }
  
  if (occupied && !reminded && (millis() - occupiedStartTime > timeLimit)) {
    remind();
  }
  
  // Status LED indicates active timer
  if (occupied && !reminded) {
    digitalWrite(ledPin, (millis() / 1000) % 2 == 0 ? HIGH : LOW);
  }
  
  delay(100);
}

Installation Steps

  1. Assemble the circuit and test.
  2. Mount the PIR sensor facing the couch or viewing area.
  3. Position the buzzer where it can be heard.
  4. Adjust time limits in the code as desired.
  5. Place the Arduino in a discreet location.

Project Extensions

  • Add an LCD to display remaining time
  • Add a button to reset the timer manually
  • Add a relay to control the TV power
  • Add Wi-Fi to send notifications to a parent’s phone
  • Add different time limits for different times of day

Conclusion

This TV time limit reminder helps promote healthy viewing habits.

Leave a Reply

Your email address will not be published. Required fields are marked *

Component Pin Arduino Pin
PIR Sensor PIR Sensor PIR Sensor Buzzer Buzzer LED