DIY: Door Alarm System Using the Arduino Uno

by Changes Tracker in Circuits > Arduino

11059 Views, 32 Favorites, 0 Comments

DIY: Door Alarm System Using the Arduino Uno

030220141182.jpg
This is a door alarm system which can be easily built and installed. It uses the basic principle outlined by the Arduino Uno Designers that is to use the Sensor, Microcontroller and the Actuator. In this design the sensor is the Hall-effect device (A1324) together with a permanent magnet (or you can use your own electromagnet), the micro-controller is the ATmega 328 embedded in the Arduino Uno and lastly the actuator is a 8ohm speaker used with a 555 timer and a optocoupler. It can be powered
using the5V power supply of the Arduino Uno. It is highly sensitive, low cost and easy to construct and install.



Arduino Uno or any version of Arduino
Hall effect device (A1301, or A1324 or A1325)
Optocoupler (4N25)
555 Timer
Permanent magnet (electromagnet)
Diode (1N4007)
220ohm and 1kiloohm resistors
8ohm speaker
5V power supply (or any below 12V)
Connecting cables
Prototyping board
0.1 microfarad and 10microfarad capacitor

Positioning the Sensors

030220141177.jpg
Grab a long cable with three wires inside, solder the Hall device to the ends of the cable taking note of the color code. Get to your door and open it. Find a way of attaching the Hall device and the magnet such that when the door opens the magnetic field strength being sensed by the Hall device decreases

Wiring

030220141178.jpg
Wire from your door to your workstation

Get the Cable to Your Work Station

030220141179.jpg
With the cable to your work station you can do whatever your want

Welcome Arduino Uno

040220141201.jpg
Having the data cable with you, grab the Arduino Uno and do some wiring according to the Circuit diagram provided.

Sketch

030220141180.jpg
Time for some coding

int const opto = 2;
int const sensor = A0;
const float controlVal = 600;

void setup(){
  pinMode(opto, OUTPUT);
  pinMode(sensor, INPUT);
  Serial.begin(9600);
}

void loop(){
  int sensorVal = analogRead(sensor);
  int mapped = map(sensorVal, 510, 560, 1023, 0);
  if (mapped >= controlVal){
    digitalWrite(opto, HIGH);
  }
    else {digitalWrite(opto, LOW);
    } 
  delay(100);
}

Components Together

030220141182.jpg
030220141183.jpg
030220141184.jpg
030220141185.jpg
030220141186.jpg
Assemble the components on a bread board, taking consideration on the pins of the 555 timer, opto-coupler and  Arduino Uno

Door Open and Door Closed

030220141188.jpg
030220141194.jpg
030220141195.jpg
Run a test with the door open and with the door closed. You can control the sensitivity with the controlVal in the Arduino Sketch

Last Touch

030220141196.jpg
030220141197.jpg
030220141198.jpg
After getting it to work you can then do whatever you want with it. You can improve on the sound quality, sensitivity, housing or even add more components to make it nicer. Cheers!!!