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
| Component |
Pin |
Arduino Pin |
PIR Sensor |
VCC
5V
PIR Sensor |
GND
GND
PIR Sensor |
OUT
Digital Pin 2
Buzzer |
Positive
Digital Pin 8
Buzzer |
Negative
GND
LED |
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
- Assemble the circuit and test.
- Mount the PIR sensor facing the couch or viewing area.
- Position the buzzer where it can be heard.
- Adjust time limits in the code as desired.
- 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.