

In this lesson, we will use this IoT kit to remotely monitor the indoor temperature and humidity, and display the data in the OSOYOO IoT App.


First, plug the OSOYOO MEGA-IoT Extension Board into the MEGA2560 board:

Build the circuit as shown below. Connect the signal pin (S) to digital pin D5.


Prerequisite:
If you haven’t installed the following libraries from Lesson 1, download and install them using the links below:
Download and Edit the Lesson 2-3 Arduino CodeStep 3) Open Arduino IDE and choose the correct board type and port for your project.

Step 4) In Arduino IDE, click File → Open, select the code file in the unzipped folder, and upload the sketch to your Arduino.

In the sketch file, replace *** with your Wi-Fi SSID and 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:
Done uploading
Open the Serial Monitor and you will see the Arduino’s IP address:

The LCD board has a jumper. If you remove this jumper, the backlight will always be off. You can also adjust the LCD contrast using the on-board potentiometer.
App Installation and Setup:
Step 1) If you haven’t installed the OSOYOO IoT App yet, search for “OSOYOO IoT Robot Car” in Google Play or the Apple App Store.
For detailed installation instructions, see the following tutorial:
https://osoyoo.com/2022/02/06/smart-house-iot-learning-kit-v2-0-lesson-1-wireless-lighting-control/#installapp
Step 2) Make sure your phone is on the same local network as the Arduino. Open the App, tap Settings, and enter the Arduino IP address from the Serial Monitor and set the Port to 8888:



Code Explanation:
Line 40 defines the phone App’s IP address:
IPAddress phoneIP=IPAddress(192,168,1,255);
Since we don’t know the phone’s LAN IP in advance, we use the broadcast address 192.168.1.255. This causes the Arduino to send messages to all devices on the local network (192.168.1.xxx).
Once you tap any key in the App, the Arduino detects your phone’s actual IP address and uses it instead of the broadcast address. From that point on, the Arduino sends messages only to your phone’s App instead of broadcasting to every device on 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 | ![]() |
Temperature & Humidity 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 | ![]() |
Phillips Screwdriver | 1 | Click here to buy |
DownLoad Url osoyoo.com