This is an old revision of the document!


Electronic Door Greeter

Introduction

A simple device implemented using an Arduino which plays a sound whenever a person enters a room. The device, which is to be positioned at the entrance of a room, utilizes infrared sensors to do this. The device only plays a sound when it detects a person entering.

General Description

The device uses 2 infrared sensors and an infrared emitter to detect movement. The sensors detect the infrared reflection reflecting off an object passing in front of them. The device is able to tell the direction of movement of the object depending on which infrared sensor gets triggered first. A short sound will be played by the use of an active buzzer only when detecting an entry.

Block Scheme

untitled_diagram_1_.jpg

Required Components

  • Arduino Uno
  • Breadboard
  • Wires
  • Resistors
  • 2 IR sensors
  • IR source
  • Active Buzzer
  • Button

Hardware Design

Software Design

Notes:

  • The software was programmed using Arduino IDE. No additional libraries were used.
  • The IR sensors were designed for interpreting signals from remote controls and are thus sensitive mostly only to 3.8kHz IR signals.
  • The tone() function was used to generate this frequency for the IR emitter.
project.ino
const int buzzer=5;         //pin 5 is the buzzer output
const int ir_led=4;         //pin 4 is the ir_led output
const int push_button=3;    //pin 3 is the push_button input
volatile byte alarm = LOW;  //alarm state = on or off
 
int noteArray[] = {740, 587};
 
void setup(){
  Serial.begin(9600);
  pinMode(buzzer,OUTPUT);       //configure pin 5 as OUTPUT
  pinMode(ir_led, OUTPUT);      //configure pin 4 as OUTPUT
  //pinMode(push_button,INPUT); //configure pin 3 as INPUT
  attachInterrupt(digitalPinToInterrupt(push_button), on_off, RISING);
}
 
void loop(){
  if (alarm){
    int sensor0=analogRead(A0);
    int sensor1=analogRead(A1);
 
    Serial.println((String)"sensor0 = " + sensor0);
    Serial.println((String)"sensor1 = " + sensor1);
 
    if(sensor0 < 1000){
      buzzer_sound(true);
    } else if (sensor1 < 1000) {
      buzzer_sound(false);
    } 
 
  }
}
 
void on_off(){
  static unsigned long last_interrupt_time = 0;
  unsigned long interrupt_time = millis();
  // if interrupts come faster than 500ms, assume it's a bounce and ignore
  if (interrupt_time - last_interrupt_time > 500){
    alarm = !alarm;
    //digitalWrite(ir_led, alarm);
    tone(ir_led, 38000);
  }
  last_interrupt_time = interrupt_time;
}
 
void buzzer_sound(bool in_out){
  noTone(ir_led);
  delay(100);
  if(in_out){
    for(int i = 0; i < 2; i++){
        tone(buzzer, noteArray[i], 750);
        delay(500);
    }
  } else {
    for(int i = 1; i > -1; i--){
        tone(buzzer, noteArray[i], 750);
        delay(500);
    }
  }
  noTone(buzzer);
  tone(ir_led, 38000);
  delay(2500);
}

Video Demonstration

Conclusions

Working with IR technology was more complicated than anticipated. There's a lot of things that needs to be accounted for when choosing the proper IR component for your project.

If I were to work on another Arduino project in the future, I will definitely be doing more research into the needed components beforehand and try to minimize improvisation.

Resources

pm/prj2022/agmocanu/electronicdoorgreeter.1653682745.txt.gz · Last modified: 2022/05/27 23:19 by willi.maki
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0