In this Instructable you will walk through the steps to build an IoT alarm. This is an inexpensive home made alarm system with reasonable price and it is accessible to internet through WiFi. The alarm is triggered when someone opens the door or turn on the light of your room. This project can be helpful to you whether you really want to set up an alarm to protect your room or if you simply want to practice your coding skills for Node MCU. Another option is to use the light sensor as alarm clock that will wake you up everyday at sunrise.
Step 1: Parts
Components required for this project:
1. Node MCU board.
2. Light theremin + 330 ohm resistor - used to detect the light power in the room.
3. Door switch reed - used to detect the door opening scenario.
4. Speaker - used to play the alarm
5. Jumper cables
6. Mobile phone with blynk app + account - used to control the alarm from your phone.
7. Adafruit account - used to control the theremin sensor and see statistics gathered from the alarm circuit.
Step 2: Circuit Flow
Once the circuit is connected to an energy power the alarm will wait to be triggered from the blynk app on your mobile phone. In case a door opening was detected or the light theremin has measured light power which is bigger then the threshold the alarm is triggered. Blynk will send a notification to your phone and an e-mail to your account indicating that the alarm was triggered. The data measured in case the alarm was triggered (switch reed and light theremin) will be published to the adafruit website.
Step 3: Technical Construction
1. Open blynk account at https://www.blynk.cc/. Save your private access token.
2. Configure your blynk application on your mobile as follows in the picture.
3. Open your adafruit account and construct your dashboard as follows in the picture. Save your private access token.
4. open the config.h and fill in the configurations - WIFI, Adafruit and Blynk.
5. Construct the circuit as shown. Note: the reed switch is placed over the matrix just for example. However, you should remember to put it on your door.
6. Upload the sketch to your NodeMCU board and start using the alarm!
Step 4: Code
Here you can see the code for this alarm system.
Step 5: Limitations
The major limitation of this circuit is that it is dependent in 3rd party services such as blynk. In case that this service isn't working we might loss some of the functionality that we created in this project.
Step 6: Challenges
The biggest challenge in this project is to understand that we have 3 different protocols that work together. WiFi, Blynk, and MQTT and we need to setup them differently from the beginning in order to make this alarm work. After passing this configurations step and having your own account in Blynk and Adafruit we think you will find this project very simple to use.
We tried to make it easier for you to pass this challenge by taking all the configurations out of the sketch and putting it in conifg.h file. We think it will be much easier that way.
Step 7: Future Enhancments
1. It is very likely to add a touch ID sensor that can be turn on/off the alarm where ever it is installed. This will be added in addition to the functionality of remote turn on/off with blynk. Working time estimation - 1 day.
2. Add an OLED display to the circuit which will replace the serial prints to the computer. It is very likely that you would like to add this feature. The display can supply information about the status of the alarm even when it is not connected to the computer. Working time estimation - 1 day.
3. I would like also to add a camera to the circuit which will start to stream live anytime the alarm is triggered. So it will be possible to see remotely who is inside the room. Working time estimation - 2 days.