Smart home is an intelligent place which can assist the residents to live independently and comfortably with the help of modern technology. In a smart home, all the mechanical and digital devices are connected with each other and can be controlled by computer through the internet.
In this capstone project, we will build a comprehensive smart home project using many parts inside OSOYOO Smart Home IoT kit.
First, please plug OSOYOO MEGA-IoT Extension Board into MEGA2560 board:
Build the circuit as below:
|Modules||Osoyoo Mega 2560|
|White LED Module||D2|
|Red Button Module||D3|
|PIR Motion Sensor||D6|
|Red LED Module||D8|
|Blue Button Module||D10|
|LED strip light||D11|
|I2C 1602 LCD||I2C_1 Port|
|RGB Module||RGB Port|
Download and Edit Lesson4 Arduino Code
Step 1 Download the code from following link, unzip it:
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 your 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:
In lines 15,16 and replace *** with your Wi-Fi ssid/password
char ssid = "***";//replace *** with your wifi ssid char pass = "***"; //replace *** with your wifi password
Upload the sketch to the board. Wait until you see something like this:
Now open Serial monitor in the upper right corner, you should see your Arduino IP address and Port number as following:
In above example,192.168.1.81 is the IP address of Arduino, please set it to APP in next step
APP Installation and Setting:
Step 1) If you haven’t installed OSOYOO IoT Robot APP, please search OSOYOO IoT Robot Car APP in Google Play or Apple Store to install this APP.
You read following tutorial link for more information about APP install :
Step 2):Make sure your Cell phone is in the same Local Network of Arduino. Open the APP, click Settings, enter your Arduino IP address from Step F and Port to 8888 in settings:
This function of this capstone projects:
1)After Starting the Arduino, you will see the Arduino IP address in LCD for two seconds, then LCD will display Temperature and Humidity data which are read from DHT11 sensor.
RGB module color at the beginning is GREEN, which means no alert.
When environment is darker than some pre-defined value(enable_led in line 39), Arduino will turn on light (WHITE LED in D2)
3)Flame detect and alert
If flame sensor data in A1 is lower than some pre-defined value (flame_alert in line 38), it means flame is detected, then Arduino will trig buzzer alert and send flame message to LCD and cell phone APP. Also, the RGB color will change to RED!
4)Intruder detect and alert
If PIR motion sensor data in D6 detects motion, then Arduino will trig buzzer alert and send Intruder message to LCD and cell phone APP. Also, the RGB color will change to Blue!
5)Manually stop intruder and flame alert
You can press Blue button in D10 or Press F1 key in APP to stop buzzer beep and remove alert message in LCD and APP.
6)Using APP to open the Door
You can press the F8 key to rotate the servo to D9 and open the door. The Red LED in D8 will turn on when the door is open. After 2 seconds, the door will automatically close and the red LED will turn off.
7)Toggle Strip LED and Fan by Red button in D3
Red button in D3 is attached to hardware interrupt in line 109. When you press Red button each time, the interrupt handler function changeflag() in line 115 to 117 with switch the strip LED and Fan ON/OFF status.
8)Control Strip LED and Fan by APP
In addition to red button, you can also to turn on the strip LED and Fan by press F2 key in APP,
You can turn off the strip LED and Fan by press F3 key in APP.
|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