Boaz Lawnce
Published © GPL3+

El_Ro_Eye

Like God's Sight || Arduino Nano based PIR motion tone alarm.

IntermediateProtip1,250
El_Ro_Eye

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Buzzer
Buzzer
×1
Jumper wires (generic)
Jumper wires (generic)
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

EL_RoI Wiring

Code

Code

C/C++
int Bulb = 3;
int buzzer = 4;
int El_Ro_I = 2;

int tone_duration = 200;
int duration = 200;

void CBAGFEDC();
void CDEFGABC();

void setup()
{
  pinMode(Bulb, OUTPUT);
  pinMode(El_Ro_I, INPUT);
  pinMode(buzzer, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int alpha = digitalRead(El_Ro_I);
  if (alpha == HIGH)
  {
    digitalWrite(Bulb,HIGH);
    CBAGFEDC();
    CDEFGABC();
  }
  else
  {
    digitalWrite(Bulb,LOW);
    noTone(buzzer);
  }
}
void CDEFGABC()
{
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 262, tone_duration); // c
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 294, tone_duration); // d
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 330, tone_duration); // e
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 349, tone_duration); // f
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 392, tone_duration); // g
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 440, tone_duration); // a
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 494, tone_duration); // b
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 523, tone_duration); // c
  delay(duration);
}
void CBAGFEDC()
{
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 523, tone_duration); // c
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 494, tone_duration); // b
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 440, tone_duration); // a
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 392, tone_duration); // g
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 349, tone_duration); // f
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 330, tone_duration); // e
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 294, tone_duration); // d
  delay(duration);
  noTone(buzzer);
  delay(duration);
  tone(buzzer, 262, tone_duration); // c
  delay(duration);
}

Credits

Boaz Lawnce

Boaz Lawnce

11 projects • 27 followers
Electronics Engineer, Founder, Hobbyist....

Comments