For our Hackster IOT project we have created a home security alarm system utilizing a magnetic reed switch. This system is a cheap alternative to the expensive commercial home security systems in the world today. The switch can be attached to any door/ opening in your home including the front door, refrigerator, or a window. Figure 1 below shows the setup of this project.
Figure 1: setup of reed switch and buzzer on particle photons
The system ultimately works by reading the voltage drop from a magnetic reed switch. When a door is closed the reed switch is close enough together that it will keep the system closed. This will result in a full voltage transfer between the nodes. When the door is opened, the switch opens resulting in a loss of voltage which is read by a particle code. This code is created on the particle build page, and will post an event called "door open" on the particle console page when the voltage drop is read (Figure 2). A second code was set up as a variable transfer from the first photon to call the second photon to power the D7 led that supplies power to the buzzer when the door open event is published. These two codes can be seen at the bottom of this page.
Figure 2: Particle Console Page
When the door open event is published, a notification is sent to the users email using IFTTT. Also, a second IFTTT applet was created to compile the door status data into a google docs spreadsheet. Using this data, a bar graph of how many times the door was opened at certain times throughout the day was created. Figure 3 below shows the two IFTTT applets, and Figures 4 and 5 show the responses of these applets.
Figure 4: Chart of time vs door openings
Figure 5: Email of door status sent through IFTTT
In setting up the devices, one wire of the magnetic reed switch was connected to D0 on the photon and the second wire was connected to D1. On the second photon, the buzzer was connected from the D7 pin to ground. This setup can be seen in the attached circuit diagrams below. Also attached below is a YouTube video that explains the full setup and functionality of this project.