Concept:
The inspiration for this project came from a common issue in my home: my siblings often leave kitchen drawers and cabinet doors open after grabbing snacks. This habit leads to my cat sneaking into these spaces, where she can hide for hours. To solve this, I came up with the idea of creating a simple sensor-based system that alerts my siblings when they forget to close a drawer or cabinet. By using a light sensor, this system can detect when a drawer or door is left open and activate a notification, such as an LED, to remind them to close it. This project combines basic electronics with a practical problem-solving approach to keep both the kitchen organized and my cat safe.
Highlight:
The highlight of this project was developing a functional switch system that alerts users when a drawer is left open. I began by connecting a light sensor to a 10k resistor in a voltage divider circuit, which allowed me to monitor light changes accurately. I added a red LED and a green LED, each with its own 330-ohm resistor, connected to digital pins 10 and 11.
void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); // Set pin modes for LEDs pinMode(10, OUTPUT); // Red LED pinMode(11, OUTPUT); // Green LED } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin A2: int sensorValue = analogRead(A2); // print out the value you read: Serial.println(sensorValue); delay(1); // delay in between reads for stability if (sensorValue > 600) { // Turn on red LED and turn off green LED digitalWrite(10, HIGH); digitalWrite(11, LOW); } else { // Turn on green LED and turn off red LED digitalWrite(10, LOW); digitalWrite(11, HIGH); } }
Then, using code adapted from Week 9 lecture slides, I programmed the LEDs to respond to light levels: the red LED illuminates when the sensor detects that a drawer is open, and the green LED lights up when the drawer is closed. Finally, I mounted the light sensor inside the drawer and tested the setup. As designed, the red LED serves as an alert when the drawer is open, while the green LED confirms it is securely closed. This project successfully provided a practical solution to alerting users to close drawers, helping prevent pets from accessing open spaces.
Demonstration: