Introduction: Door Open Alarm With Linkit One

This is a device that indicates by buzzing whenever the door crosses the specified distance giving a red light indication.This has been developed by linkit one board received in the giveaway! Its total cost is ~63$ including ~60$ linkit one board.Here's video of it in action :-

Step 1: Things Required

We need:-

  1. Linkit one
  2. USB cord
  3. 8 Jumper wires (male to female)
  4. L.E.D red
  5. L.E.D all except red color
  6. Buzzer
  7. Battery (optional)
  8. Hc-SR04 ultrasonic distance sensor

Step 2: Connecting Jumper Wires

We need 8 jumper wires ,connect them all to the male ports of sensor ,leds and buzzer.

  1. Connect positive terminal of red l.e.d to digital pin 11 and other to gnd
  2. Connect + terminal of other led to digital pin 10 and other to gnd
  3. Connect +ve terminal of buzzer to digital pin 9 and other is to be taken common with red L.E.D's negative as we have less gnd ports.
  4. Connect echo to digital pin 12
  5. Connect trig to digital pin 13
  6. Connect Vcc to +5 pin (positive supply)
  7. Connect gnd to gnd (negative)

Step 3: Code

This is the sketch of it.

Some code and wiring inspired by http://en.wikiversity.org/wiki/User:Dstaub/robotcar */

#define trigPin 13 #define echoPin 12 #define led 11 #define led2 10 #define buzzer 9

void setup() { Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(led, OUTPUT); pinMode(led2, OUTPUT); pinMode(buzzer, OUTPUT); }

void loop() { long duration, distance; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; if (distance < 50) { digitalWrite(led,HIGH); digitalWrite(buzzer,HIGH); digitalWrite(led2,LOW);

}else { digitalWrite(led,LOW); digitalWrite(buzzer,LOW); digitalWrite(led2,HIGH); } if (distance >= 200 || distance <= 0){ Serial.println("Out of range"); } else { Serial.print(distance); Serial.println(" cm"); } delay(800);

Step 4: Making Enclosure

Make a small box in which the setup can fit easily and then insert all the components to the box holes and also paste an instructables robot sticker from your pile.

Step 5: Test!

Test it by using battery or simply use charger output that is too 5 volts! Check if buzzer and red led are working simultaneously and also if the white l.e.d turns ON whenever there is noting in between.If it is OK,then congratulations! The l.e.d s may appear a little dull that's why I used a dark place for demonstration!

Step 6: Done!

Stick it on the wall adjacent to door of room which you think has important valuables in it.You can change the distance of reaction by changing the value of 50 in the code.It is in cms.You can check the distance in serial monitor giving an estimate of it.

I hope you enjoyed!

Thank you!

Comments

author
MinhL6 (author)2015-11-08

may be you don't believe me, a module alarm when the door open is very simple it use a magetic sensor , a kit include 2 peace link together , when take it apart it arlarm , you can stick it in your door , your windows ......... and cost only 3 usd . sell alot of in vietnam , it come from china , if you want i buy for you one .

author
DylanD581 (author)2015-11-07

This could also be used to alert you if a door is open during the winter!

author
DIY Hacks and How Tos (author)2015-11-07

Fun DIY security system.

About This Instructable

2,463views

55favorites

License:

Bio: Thank you instructables!!
More by Gursimran Singh 425:Plant BoxDIY CNC For 60$ (Large Work Area)Advanced Mosquito Repeller and Swatter
Add instructable to: