Jose Romaní
Published © LGPL

Presence Detector with an Alarm 1.0 (for Robotic Dinohedges)

Consists of an alarm that warns when the presence of a person is detected on a house entrance or room. It is based on Arduino modules.

IntermediateFull instructions provided1,803
Presence Detector with an Alarm 1.0 (for Robotic Dinohedges)

Things used in this project

Hardware components

ELK-COGITI Material Para Curso COGITI
This is material for a course of collegiated engineers in Galicia (Spain) mainly. The kit cotaines a lot of components, not all necessary. In case someone prefers to buy components separately, I suggest the ones bellow
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
It is the presence detector. I put the orange potentiometers turned all towards left so the sensitivenes is 3m and the output signal is 3 s high.
×1
passive buzzer
Do not confuse with an active buzzer
×1
Arduino UNO
Arduino UNO
Use an Arduino Uno rev. 3
×1
9V battery (generic)
9V battery (generic)
Goes attached to the following component to power the Arduino Uno trough the Jack
×1
9V to Barrel Jack Connector
9V to Barrel Jack Connector
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
This jumpers above are orientative. Really I bought a kit with all the components and others on the following link: https://www.electrio.es/epages/80295836.sf/es_ES/?ObjectPath=/Shops/80295836/Products/%22ELK-%20COGITI%22
×1
ELEGOO 130pcs Solderless Flexible Breadboard Jumper Wires 4 Different Lengths Male To Male
ELEGOO 130pcs Solderless Flexible Breadboard Jumper Wires 4 Different Lengths Male To Male
×1
LED (generic)
LED (generic)
Optional. Not necessary if you use the attached LED of pin 13 of Arduino Uno
×1
Resistor 220 ohm
Resistor 220 ohm
Optional. Not necessary if you use the LED of pin 13 of Arduino Uno
×1
Breadboard (generic)
Breadboard (generic)
Whichever breadboard
×1

Software apps and online services

Arduino IDE
Arduino IDE
fritzing.org
Not strictly necessary. Only for documentation.

Story

Read more

Schematics

presence_alarm.fzz

These are the protoboard and schematics of the project. Nevertheless the PCB schematic should be review for another expert on this field

presence detector protoboard schematic

Presence detector schematic

Code

Presence detector 200

Arduino
Load this code to your Arduino Uno. The delay for the alarm is 200ms
/* Adjusted with potentiometers of PIR:
 * Sensitiveness: 3m
 * Duration HIGH: 3s minimum
 */
void setup() {
  pinMode(12, INPUT); //PIR
  digitalWrite(12,LOW);
  pinMode(13,OUTPUT); //LED
  digitalWrite(13,LOW);
  pinMode(11, OUTPUT);//Buzzer
}

void loop() {
  while(!digitalRead(12)){};
  analogWrite(11,127); //most audible sound
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(11,0);
  digitalWrite(13,LOW);
  delay(200);
}

Presence detector 500

Arduino
Or the following code, equal to the first but with a different frequency of LED blink and alarm sound. The delay for the alarm is 500ms
#define LED 13
#define BUZZER 11
#define PITCH 127
void setup()
{
  pinMode(BUZZER, OUTPUT);
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW);
}

void loop()
{ 
  bool PIR = digitalRead(12);
  if (PIR){
  digitalWrite(LED,HIGH); //encender LED
  analogWrite(BUZZER,PITCH); //Hacer sonar el BUZZER 0-255
  delay(500);
  digitalWrite(LED, LOW);
  analogWrite(BUZZER, 0);
  delay(500);
  }
}

Credits

Jose Romaní

Jose Romaní

8 projects • 4 followers
Industrial Technical Engineer in Electronics and Automation

Comments