In this lesson, we will use this IoT kit to remotely monitor the home environmental temperature and humidity, and display the data to the OSOYOO IoT APP.
First, please plug OSOYOO MEGA-IoT Extension Board into MEGA2560 board:
Build the circuit as below:
Here we connect the signal pin (S) to digital pin D5.
Prerequisite:
If you haven’t installed following libraries which are used in Lesson 1, please download and install them from following links:
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.
In sketch file, replace *** with your Wi-Fi ssid/password
char ssid[] = "***";//replace this line with your wifi ssid
char pass[] = "***"; //replace this line with your wifi password
Upload the sketch to the board. Wait until you see something like this:
Done uploading
Open your serial monitor, you will see Arduino’s IP address as following:
There is a jumper on the LCD board, if you take away this jumper, the backlight will always be off, and you can also control the LCD contrast by adjust the on-board potentiometer.
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 :
https://osoyoo.com/2022/02/06/smart-house-iot-learning-kit-v2-0-lesson-1-wireless-lighting-control/#installapp
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:
Code Explanation:
Line 40 defines the Cell phone APP’s IP address,
IPAddress phoneIP=IPAddress(192,168,1,255);
since we don’t know this LAN IP, so we use a default broadcasting IP, 192.168.1.255. In this case, Arduino will send a message to all devices in the Local network (192.168.1.xxx).
If we touch any key in the APP, Arduino will detect the IP address of your cell phone and use this IP to replace the broadcasting IP address 192.168.1.255. Since then, Arduino will only send the message to your cell phone APP instead of broadcasting the message to all the devices in the LAN.
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