Bird and Animal Reppeller Arduino Project

Circuit diagram:

Code:

#include <SD.h>                       
#define SD_ChipSelectPin 10            
#include <TMRpcm.h>                   
#include <SPI.h>
int pir = 8;
int val;
TMRpcm tmrpcm;

void setup()
{
  pinMode(pir, INPUT);
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);

tmrpcm.speakerPin=9;            

Serial.begin(9600);
if(!SD.begin(SD_ChipSelectPin))
{
  Serial.println(“SD fail”);
  return;
}

}

void loop()
{
  val=digitalRead(pir);
  if(val==1)
  {


Serial.print(“Speaker on”);
Serial.print(“\n”);
tmrpcm.setVolume(6);
tmrpcm.play(“gun.wav”);

 digitalWrite(2,HIGH);
  digitalWrite(3,LOW);
   digitalWrite(4,HIGH);
    digitalWrite(5,LOW);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
 delay(300);
 digitalWrite(2,LOW);
  digitalWrite(3,HIGH);
   digitalWrite(4,LOW);
    digitalWrite(5,HIGH);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
    delay(300);
    digitalWrite(2,HIGH);
  digitalWrite(3,LOW);
   digitalWrite(4,HIGH);
    digitalWrite(5,LOW);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
 delay(300);
 digitalWrite(2,LOW);
  digitalWrite(3,HIGH);
   digitalWrite(4,LOW);
    digitalWrite(5,HIGH);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
    delay(300);
    digitalWrite(2,HIGH);
  digitalWrite(3,LOW);
   digitalWrite(4,HIGH);
    digitalWrite(5,LOW);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
 delay(300);
 digitalWrite(2,LOW);
  digitalWrite(3,HIGH);
   digitalWrite(4,LOW);
    digitalWrite(5,HIGH);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
    delay(300);
    digitalWrite(2,HIGH);
  digitalWrite(3,LOW);
   digitalWrite(4,HIGH);
    digitalWrite(5,LOW);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
 delay(300);
 digitalWrite(2,LOW);
  digitalWrite(3,HIGH);
   digitalWrite(4,LOW);
    digitalWrite(5,HIGH);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
    delay(300);
    digitalWrite(2,HIGH);
  digitalWrite(3,LOW);
   digitalWrite(4,HIGH);
    digitalWrite(5,LOW);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
 delay(300);
 digitalWrite(2,LOW);
  digitalWrite(3,HIGH);
   digitalWrite(4,LOW);
    digitalWrite(5,HIGH);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
    delay(300);
    digitalWrite(2,HIGH);
  digitalWrite(3,LOW);
   digitalWrite(4,HIGH);
    digitalWrite(5,LOW);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
 delay(300);
 digitalWrite(2,LOW);
  digitalWrite(3,HIGH);
   digitalWrite(4,LOW);
    digitalWrite(5,HIGH);
    delay(300);
     digitalWrite(2,LOW);
  digitalWrite(3,LOW);
   digitalWrite(4,LOW);
    digitalWrite(5,LOW);
delay(9000);

  }
else
{
digitalWrite(9, LOW);
Serial.print(“Speaker off”);
Serial.print(“\n”);

}

}

2 thoughts on “Bird and Animal Reppeller Arduino Project”

  1. Romel Delugar jr.

    what should be the circuit diagram if it is added a water level sensor and a battery and windmill as a source of power?,the water level sensor will alarm when the water reach the limit.

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart