El_Ro_Eye
Like God's Sight || Arduino Nano based PIR motion tone alarm.
Components and supplies
1
Buzzer
1
Arduino Nano R3
1
Jumper wires (generic)
1
PIR Motion Sensor (generic)
1
LED (generic)
Tools and machines
1
Soldering iron (generic)
1
Hot glue gun (generic)
Apps and platforms
1
Arduino IDE
Project description
Code
Code
c_cpp
1int Bulb = 3; 2int buzzer = 4; 3int El_Ro_I = 2; 4 5int tone_duration = 200; 6int duration = 200; 7 8void CBAGFEDC(); 9void CDEFGABC(); 10 11void setup() 12{ 13 pinMode(Bulb, OUTPUT); 14 pinMode(El_Ro_I, INPUT); 15 pinMode(buzzer, OUTPUT); 16 Serial.begin(9600); 17} 18 19void loop() { 20 int alpha = digitalRead(El_Ro_I); 21 if (alpha == HIGH) 22 { 23 digitalWrite(Bulb,HIGH); 24 CBAGFEDC(); 25 CDEFGABC(); 26 } 27 else 28 { 29 digitalWrite(Bulb,LOW); 30 noTone(buzzer); 31 } 32} 33void CDEFGABC() 34{ 35 noTone(buzzer); 36 delay(duration); 37 tone(buzzer, 262, tone_duration); // c 38 delay(duration); 39 noTone(buzzer); 40 delay(duration); 41 tone(buzzer, 294, tone_duration); // d 42 delay(duration); 43 noTone(buzzer); 44 delay(duration); 45 tone(buzzer, 330, tone_duration); // e 46 delay(duration); 47 noTone(buzzer); 48 delay(duration); 49 tone(buzzer, 349, tone_duration); // f 50 delay(duration); 51 noTone(buzzer); 52 delay(duration); 53 tone(buzzer, 392, tone_duration); // g 54 delay(duration); 55 noTone(buzzer); 56 delay(duration); 57 tone(buzzer, 440, tone_duration); // a 58 delay(duration); 59 noTone(buzzer); 60 delay(duration); 61 tone(buzzer, 494, tone_duration); // b 62 delay(duration); 63 noTone(buzzer); 64 delay(duration); 65 tone(buzzer, 523, tone_duration); // c 66 delay(duration); 67} 68void CBAGFEDC() 69{ 70 noTone(buzzer); 71 delay(duration); 72 tone(buzzer, 523, tone_duration); // c 73 delay(duration); 74 noTone(buzzer); 75 delay(duration); 76 tone(buzzer, 494, tone_duration); // b 77 delay(duration); 78 noTone(buzzer); 79 delay(duration); 80 tone(buzzer, 440, tone_duration); // a 81 delay(duration); 82 noTone(buzzer); 83 delay(duration); 84 tone(buzzer, 392, tone_duration); // g 85 delay(duration); 86 noTone(buzzer); 87 delay(duration); 88 tone(buzzer, 349, tone_duration); // f 89 delay(duration); 90 noTone(buzzer); 91 delay(duration); 92 tone(buzzer, 330, tone_duration); // e 93 delay(duration); 94 noTone(buzzer); 95 delay(duration); 96 tone(buzzer, 294, tone_duration); // d 97 delay(duration); 98 noTone(buzzer); 99 delay(duration); 100 tone(buzzer, 262, tone_duration); // c 101 delay(duration); 102} 103 104
Code
c_cpp
1int Bulb = 3; 2int buzzer = 4; 3int El_Ro_I = 2; 4 5int tone_duration = 200; 6int duration = 200; 7 8void CBAGFEDC(); 9void CDEFGABC(); 10 11void setup() 12{ 13 pinMode(Bulb, OUTPUT); 14 pinMode(El_Ro_I, INPUT); 15 pinMode(buzzer, OUTPUT); 16 Serial.begin(9600); 17} 18 19void loop() { 20 int alpha = digitalRead(El_Ro_I); 21 if (alpha == HIGH) 22 { 23 digitalWrite(Bulb,HIGH); 24 CBAGFEDC(); 25 CDEFGABC(); 26 } 27 else 28 { 29 digitalWrite(Bulb,LOW); 30 noTone(buzzer); 31 } 32} 33void CDEFGABC() 34{ 35 noTone(buzzer); 36 delay(duration); 37 tone(buzzer, 262, tone_duration); // c 38 delay(duration); 39 noTone(buzzer); 40 delay(duration); 41 tone(buzzer, 294, tone_duration); // d 42 delay(duration); 43 noTone(buzzer); 44 delay(duration); 45 tone(buzzer, 330, tone_duration); // e 46 delay(duration); 47 noTone(buzzer); 48 delay(duration); 49 tone(buzzer, 349, tone_duration); // f 50 delay(duration); 51 noTone(buzzer); 52 delay(duration); 53 tone(buzzer, 392, tone_duration); // g 54 delay(duration); 55 noTone(buzzer); 56 delay(duration); 57 tone(buzzer, 440, tone_duration); // a 58 delay(duration); 59 noTone(buzzer); 60 delay(duration); 61 tone(buzzer, 494, tone_duration); // b 62 delay(duration); 63 noTone(buzzer); 64 delay(duration); 65 tone(buzzer, 523, tone_duration); // c 66 delay(duration); 67} 68void CBAGFEDC() 69{ 70 noTone(buzzer); 71 delay(duration); 72 tone(buzzer, 523, tone_duration); // c 73 delay(duration); 74 noTone(buzzer); 75 delay(duration); 76 tone(buzzer, 494, tone_duration); // b 77 delay(duration); 78 noTone(buzzer); 79 delay(duration); 80 tone(buzzer, 440, tone_duration); // a 81 delay(duration); 82 noTone(buzzer); 83 delay(duration); 84 tone(buzzer, 392, tone_duration); // g 85 delay(duration); 86 noTone(buzzer); 87 delay(duration); 88 tone(buzzer, 349, tone_duration); // f 89 delay(duration); 90 noTone(buzzer); 91 delay(duration); 92 tone(buzzer, 330, tone_duration); // e 93 delay(duration); 94 noTone(buzzer); 95 delay(duration); 96 tone(buzzer, 294, tone_duration); // d 97 delay(duration); 98 noTone(buzzer); 99 delay(duration); 100 tone(buzzer, 262, tone_duration); // c 101 delay(duration); 102} 103 104
Downloadable files
EL_RoI Wiring
EL_RoI Wiring

Comments
Only logged in users can leave comments