Introduction: Arduino Door Alarm With Text Alerts
This is an Arduino based door alarm that uses a magnetic reed switch to determine the door state and has an audible alarm and a text message based alarm.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Set Up Arduino Uno and Breadboard
Step 2: Add the Ethernet Shield
Plug the Ethernet Shield into the top of the Arduino.
Step 3: Connect the Power and Ground Rail
Connect the power rail to the 5v pin and the ground rail to the ground pin on the Arduino
Step 4: Connect the Reed Switch
Connect the COM terminal on the switch to the ground rail and the Normally Open (NO) terminal to pin 8 on the Arduino
Step 5: Add the LEDs
Connect a red, yellow, and green LED to the ground rail and a resistor to each positive lead of the LED and connect the red one to pin 6, the yellow to pin 5, and the green to pin 4.
Step 6: Add the Buzzer
Connect the negative pin of the buzzer to the ground rail and the positive pin to pin 12 on the Arduino.
Step 7: Connect the Switches
Connect the switch for the message toggle to pin 11 and the switch for the sound toggle to pin 10. Connect the other leg on the switch to the ground rail for each switch.
Step 8: Add the Push Button
Connect one leg of the button the ground rail and the other to pin 2 on the Arduino.
Step 9: Connect the First LCD Screen
Connect the VCC pin to the power rail, the GND pin to the ground rail, the SCL pin to A5, and the SDA pin to A5 on the Arduino.
Step 10: Add in the Second LCD Screen
Connect the LCD screen to the same rail as the first one.
Step 11: Mount the Reed Switch
Put the piece with the terminals on the frame of the door. Place the magnetic portion to the door right under the switch so it will still toggle the switch. You can use a multimeter or listen to see if the switch activates when the door is opened or closed.
Step 12: Upload the Code
Upload the code to the Arduino.
Step 13: Set Up the Alert Messages
First create a twilio.com account, you can use the free version. Just create a project and a phone number and write down the Account SID and Auth Token.
Upload the Twilio PHP Master to your web server from https://packagist.org/packages/twilio/sdk
Upload the alert.php code to the same directory. You will have to change the file extension to remove the .txt from the end.
Open the script and change lines 10 and 11 to the Account SID and Auth Token. Change line 17 to your phone number and line 20 to the phone number you got from Twilio. Change line 22 to the text that you want to receive.
Step 14: Use the Alarm
Set the switches to if you want to receive an alert text or have the alarm sound and arm the system with the push button. When the door is opened, the alarm will go off until the button is pressed to reset the system.