In this tutorial, we will learn how to use OSOYOO IoT kit and Blynk APP to build an Outdoor security alarm device. An outdoor security alarm is a powerful deterrent to mischief makers, at the same time, you can also know the safety situation outside the door in time when you leave home.
After leaving home, we can turn on the warning device through Blynk. We can set the warning range through the software. If someone or something enters the monitoring area, the local device will sound an alarm, the red light will turn on, and our mobile phone will Receive push notification. Similarly, we can turn off this device with our mobile phone before going home.
First, please plug OSOYOO MEGA-IoT Extension Board into MEGA2560 board:
Build the circuit as below:
ultrasonic sensor—–Ultrasonic port
red LED——-D2
buzzer——D7
I2C 1602 LCD Display—-I2C
Prerequisite:
You need to install Local Blynk Server, Blynk APP, Arduino IDE, Blynk Libraries before running the code of this lesson. If you haven’t done these installations, please read following contents in lesson2-1 link:
https://osoyoo.com/2021/04/29/osoyoo-smart-home-iot-blynk-lesson-2-1-simple-control/#prerequisite
If you have installed above libraries, please go to next stage:
Download and Edit Lesson3-3 Arduino Code
Step 1 Download the code from following link, unzip it:
https://osoyoo.com/driver/Smart_House_IoT_Learning_Kit_V2.0_code/Lesson3-6.zip
Step 2 After above operations are completed, connect OSOYOO MEGA2560 Board to PC with USB cable.
Step 3 Open Arduino IDE: Choose corresponding board type and port type for you project .
Step 4 Arduino IDE: Click file – Open, then choose code in the folder, load up the sketch onto your Arduino.
You need to edit the code as following:
**********************************************************
Note: In the sketch, find these code in line 13,14 as following:
char auth[] =”0ByWpc50cmOJ5O6OyHMaK4OSHkDvUeI-”;
char server_ip[]=”192.168.1.81″; // replace this line with your Blynk Server IP addres;
Replace 0ByWpc50cmOJ5O6OyHMaK4OSHkDvUeI- with your local Blynk Token.
Replace 192.168.1.81 with your local Blynk Server LAN IP address.
If you don’t know how to get token and Server IP address, read this article.
In lines 17,18 and replace *** with your wifi ssid/password
char ssid[] = "***";//replace this line with your wifi ssid char pass[] = "***"; //replace this line with your wifi password
please replace the *** with your correct wifi SSID and password, otherwise your project can not connect to Internet.
Upload the sketch to the board. Wait until you see something like this:
Done uploading
Now open your Serial Monitor, you will see Arduino is trying to talk to Blynk server. After 20 to 30 seconds, your Serial monitor will finally shows Arduino’s IP address and a “Ready (ping: 25ms)” ending message.
Congratulations! You are all ready! Your hardware is now connected to the Blynk server.
Finally upload the sketch to the board. Wait until you see something like this:
Here we need to add the Notification, and email widgets, and config it as below:
Notification widget:
Then set the Blynk notification to the highest authority in the phone settings.
Then back to the project page. and press the “▷” button to start your project.
First, you will see a prompt on the LCD screen to press the button to start the alarm. When your project is successfully connected to the network, press the button, and the LCD screen will display “Alarm Working!” and “Press to stop!”. Or when an object passes in front of the ultrasonic distance sensor, both the mobile phone and the email will receive a prompt: “Sth at the door!”, then the alarm will sound and the red light will be lit.
If you want to turn off the alarm system, please press the button again and you will see “Alarm Stop! Press to start!” on the LCD screen.
If you find the device is offline, please check your code, wiring and app settings, and try again.
No. | Picture | Device | Qty. | Link |
1 | OSOYOO MEGA2560 Board | 1 | Click here to buy | |
2 | OSOYOO MEGA-IoT Extension Board | 1 | Click here to buy | |
3 | Photosensitive Sensor | 1 | Click here to buy | |
4 | Temp & Hum Sensor | 1 | Click here to buy | |
5 | OSOYOO Active Buzzer Module | 1 | Click here to buy | |
6 | Flame Detection Sensor | 1 | Click here to buy | |
7 | Fan Motor Module | 1 | Click here to buy | |
8 | Micro Servo Motor | 1 | Click here to buy | |
9 | RGB Module | 1 | Click here to buy | |
10 | Ultrasonic Sensor | 1 | Click here to buy | |
11 | PIR Motion Sensor | 1 | Click here to buy | |
12 | Microphone Module | 1 | Click here to buy | |
13 | 1602 I2C LCD Screen | 1 | Click here to buy | |
14 | RFID Module | 1 | Click here to buy | |
15 | White LED Module | 1 | Click here to buy | |
16 | Red LED Module | 1 | Click here to buy | |
17 | Colorful Light | 1 | Click here to buy | |
18 | Red Button Module | 1 | Click here to buy | |
19 | Blue Button Module | 1 | Click here to buy | |
20 | Philips Screwdriver | 1 | Click here to buy |
DownLoad Url osoyoo.com