Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Pooja Baraskar
Published © GPL3+

Burglar Alarm with PIR Motion Sensor

This article explains Burglar Alarms with a PIR Motion Sensor.

BeginnerFull instructions provided5,515
Burglar Alarm with PIR Motion Sensor

Things used in this project

Hardware components

Grove starter kit plus for Intel Edison
Seeed Studio Grove starter kit plus for Intel Edison
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Seeed Studio Buzzer
×1

Story

Read more

Schematics

WP_20150831_020.jpg

Code

Code

C/C++
    void loop()   
    {  
        if(isPeopleDetected())   //if it detects the moving people  
            turnOnBuzzer();  
        else  
            turnOffBuzzer();  
    }  
    void turnOnBuzzer()  
    {  
           digitalWrite(LED,HIGH);  
        for (int i = 0; i < length; i++)   
        {  
            if (notes[i] == ' ')  
            {  
                delay(beats[i] * tempo); // rest  
            }  
            else  
            {  
                playNote(notes[i], beats[i] * tempo);  
            }  
      
            // pause between notes  
            delay(tempo / 2);  
        }  
    }  
    void turnOffBuzzer()  
    {  
      digitalWrite(LED,LOW);      
      digitalWrite(speakerPin,LOW);  
    }  

Credits

Pooja Baraskar

Pooja Baraskar

25 projects • 178 followers
Pooja Baraskar is an accomplished software engineer, inventor, and technical author with over a decade of experience in the tech industry.

Comments