Organize and Share your Electronics the way you want. Sign-Up for a free account now. It takes only 30 seconds!

PIR motion sensor interface with AVR-microcontroller ATMEGA32

PIR motion sensor interface with AVR-microcontroller ATMEGA32

Passive Infra red sensor also known as PIR sensors is capable of detecting motion or movement within a certain range. These type of sensors have wide range of applications in our daily life and it is essential to learn the interfacing method. This article is going to demonstrate the PIR motion sensor interface with AVR microcontroller.

APPLICATIONS OF PIR SENSOR:

Lets see some of the common applications of PIR sensor for better understanding.

  1. Automated doors in shopping malls.
  2. Lifts
  3. Garden lights
  4. Parking areas

PIR SENSOR:
pir-sensor-module-pin-diagram

 

The PIR sensor detect only bodies (hot materials and living objects) in motions not the static ones. This sensor uses Infra red beam to detect the motion and only covers a certain space based on the sensor model, i advise you to go through the manufacturer datasheet to know about the range. This sensor module gives only two output states that is logic High 1 which is equivalent to 3.3 V and logic low 0 equivalent to 0 V.

SCHEMATIC DESIGN:

pir-sensor-interface-circuit-diagram

WORKING:

The PIR sensor is interfaced with Atmega32 AVR microcontroller to detect the motion around the environment. Atmega32 considers any voltage between 2V to 5V as logic high. Hence PIR sensor is directly interfaced to the input pin of the controller.

The circuit shown above will read the status of the output of the PIR sensor and switch ON the LED when there is a motion detected and switch OFF the LED when there is nothing. Output pin of the PIR sensor is connected to PortC.0 pin of the atmega32.  LED is connected through PORTB.0  of the microcontroller.

CODE:

 

#include<avr/io.h>
#define F_CPU 800000UL
#include<util/delay.h>
int main()
{
DDRC=0x00; //configuring PortC pin 0 as input
PORTC=0x00; 
DDRB=0x01; // configuring PortB as output
PORTB=0x00; // buzzer/LED off

while(1)
{
 if((PINC&(1<<0)))            // check for sensor pin PC.0 using bit
  {
   PORTB=0x01;           // buzzer /LED on
   _delay_ms(5000);
   PORTB=0x00;
  }
  else
  PORTB=0x00;  // buzzer/LED off
}           

return 0;
}

NOTE:

  • Use a current limiting resistor with the LED.
  • You can increase or decrease the delay of activation that is LED ON time.
  • You can also use buzzer in place of LED in the above circuit.

The post PIR motion sensor interface with AVR-microcontroller ATMEGA32 appeared first on Gadgetronicx.

Read more Here







 

More Articles to Read

Peeqo is a desktop bot that communicates through GIFs
Peeqo is a desktop bot that communicates through GIFs
Using a Programmable Input Multiplier to Minimize Integer Boundary Spurs
Using a Programmable Input Multiplier to Minimize Integer Boundary Spurs
Serial seven segment LED display shield
Serial seven segment LED display shield
G-code controlled drawing plotter
G-code controlled drawing plotter
An Arduino round word clock
An Arduino round word clock
The Sandwich-o-Matic will make your lunch automatically
The Sandwich-o-Matic will make your lunch automatically
Scalar Network Analyser Jr
Scalar Network Analyser Jr
An Arduino-controlled automated whiskey distillery
An Arduino-controlled automated whiskey distillery
The Rex800 looks like a dinosaur Terminator
The Rex800 looks like a dinosaur Terminator
Home Environment Monitor
Home Environment Monitor
Understanding the Operation of the Frequency Synthesizer in Maxim’s RF Transceivers
Understanding the Operation of the Frequency Synthesizer in Maxim’s RF Transceivers
App note: EPIC: Electro-Pyrotechnic Initiator Chip Resistor
App note: EPIC: Electro-Pyrotechnic Initiator Chip Resistor
Noisy ESP8266
Noisy ESP8266
App note: Noise analysis for high-speed op amps
App note: Noise analysis for high-speed op amps
Skill Sunday: Arrays
Skill Sunday: Arrays
App note: Infrared remote control implementation with MSP430FR4xx
App note: Infrared remote control implementation with MSP430FR4xx
Gesture Controlled Smart Home
Gesture Controlled Smart Home
Design for a Wideband, Differential Transimpedance DAC Output
Design for a Wideband, Differential Transimpedance DAC Output
Wrist thrusters let you fly through the water effortlessly
Wrist thrusters let you fly through the water effortlessly
Bertan/Spellman 225-20R HV power supply teardown
Bertan/Spellman 225-20R HV power supply teardown

Top


Shares