Fake Firealarm

by jim6673 in Circuits > Arduino

1413 Views, 10 Favorites, 0 Comments

Fake Firealarm

fire alarm.jpg

This project was supposed to be 'crappy robot' but I failed this project......because it's not crappy! It's fabulous

Materials

1 Breadboard

1 auduino Uno

1 piezo buzzer

8 wires

1 LED

1 Resistor

1 LDR(light sensor)

Purpose

The purpose of making this is to annoy the teachers at school. If you think about it, the first thing that teachers do after entering the classroom is turning on the classroom light, right? The LDR(light sensor) will detect when the light turns on, and the buzzer and LED will activate like a fire alarm. This will make teachers annoying since they have to get out of the classroom to evacuate as soon as they enter the classroom. But I coded the alarm to activate after 10 seconds when the light turns on. This will make teachers more annoying because in 10 seconds, they might have prepared themselves to work.

Wiring

KakaoTalk_20161208_193535729.jpg
KakaoTalk_20161208_193538998.jpg
KakaoTalk_20161208_193542794.jpg
KakaoTalk_20161208_193546395.jpg

The first thing I connected the ground at the edge of the breadboard with the wire. This makes it's rows to have the property of ground. In the coding I set LED pin at pin number 13, Buzzer at pin number 12. So I connected the pin number 13 with the positive side of LED with the wire and the negative side to the ground. Then I connected the pin number 12 with the positive side of Piezo buzzer with the wire and connected the negative side to the ground. The positive side is the long leg and the short leg is negative. I connected LDR with the resistor, sharing one legs each. I wired the empty leg of LDR to 5V. Then I wired the empty leg of resistor to the ground. Finally, I wired A0 to the remainder leg of both LDR and the resistor. I uploaded 4 pictures in case you guys can't figure out the wires, since it's messy. Even with the 4 pictures, it's still hard to understand so I prefer watching it in fritzing...^^

Coding

const int ledPin = 13;

const int buzzerPin = 12;

const int ldrPin = A0; boolean isReady = false;

void setup() { Serial.begin(9600);

pinMode(ledPin, OUTPUT); pinMode(buzzerPin, OUTPUT); pinMode(ldrPin, INPUT); }

void loop() { int ldrStatus = analogRead(ldrPin); Serial.println(ldrStatus);

if (ldrStatus >= 800) {

if (isReady == false) { isReady = true; delay(10000); }

else{ tone(buzzerPin, 100); digitalWrite(ldrPin, HIGH); delay(100); noTone (buzzerPin); digitalWrite(ledPin, HIGH); delay(100); digitalWrite(ledPin, LOW);

Serial.println("--------- ALARM ACTIVATED ---------"); } }

else { noTone(buzzerPin); digitalWrite(ledPin, LOW); Serial.println ("ALARM DEACTIVATED"); } }

Here Is Fritzing!