Motion detection using PIR motion sensor and ATtiny85

<<< Previous : Program ATtiny45 / ATtiny85 using Arduino Uno

We had already seen the circuit for programming ATtiny45 / ATtiny85 using arduino uno in my previous page. Here, we will see a simple application circuit using ATtiny85 to sense the motion using PIR motion sensor. Circuit is done as shown in the following diagram.

Output terminal of motion sensor is connected to one of the digital input / output pin of ATtiny85. Similarly, buzzer is connected to another digital input / output pin of ATtiny85.
1 74165 using Arduino (copy)After completing the circuit, upload the following program to your ATtiny85. Read my previous page to get the step by step procedures of programming ATtiny85 using arduino uno.

// the setup routine runs once when you press reset:
void setup() {
  pinMode(1, OUTPUT);
  pinMode(0, INPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  
  int sensorValue = digitalRead(0);

  if(sensorValue==1)
  {
    digitalWrite(1, HIGH); 
    delay(3000);
  }

  else
  {
    digitalWrite(1, LOW);  
  }
  
  delay(1);        // delay in between reads for stability
}

If uploading is successful, a beep sound will be generated from buzzer when someone moves in front of the sensor. Watch the following video demonstration to see the working of circuit.

(Visited 3,036 times, 1 visits today)
paulpp644

A deep electronic enthusiast who spent most of my time for electronic experiments. I am also interested in publishing my experiments in my blog for helping other electronics enthusiasts.