Location: Home » Internet of Things » Smart Home V2.0 UDP APP control » Smart House IoT Lesson 2-2: Get Remote LED Status via UDP Wi-Fi App

Smart House IoT Lesson 2-2: Get Remote LED Status via UDP Wi-Fi App

Post Time: 2022-02-22 18:02:50 Category: Smart Home V2.0 UDP APP control

Buy from US Buy from UK Buy from DE Buy from FR Buy from IT Buy from ES ここでご購入を!

In this project, we will use a push button to control an LED with an OSOYOO Mega2560 board. We will also use the OSOYOO IoT app to read the LED on/off status and control the LED over UDP.

HARDWARE

SOFTWARE

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

Build the circuit as shown below:

LED Module – D2

Button Module – D3

Prerequisite:

Download and run the Lesson 2-2 Arduino code
Step 1) Download the code from the link below, then unzip it:
https://osoyoo.com/driver/smart-home-v2-udp/lesson2/smart-home-lesson2.zip

Step 2) Connect the OSOYOO Mega2560 board to your PC with a USB cable.

Notice: Shut off your battery or unplug your power adapter before uploading sketch code to the Arduino.

Step 3) Open Arduino IDE: choose the correct board type and port for your project.

Step 4) In Arduino IDE, click FileOpen, then select the code file from the unzipped folder and upload the sketch to your board.

Note: In the sketch, find line 26:

Find the following lines and replace the Wi-Fi SSID and password with your own:

char ssid[] = "***";//replace this line with your wifi ssid
char pass[] = "***"; //replace this line with your wifi password

Upload the sketch to the board. When you see:

Done uploading
Now open Serial monitor in the upper right corner, you should see your Arduino IP address and Port number as following:

APP Installation and Setup:
Step 1) If you haven’t installed the OSOYOO IoT Robot app, search for OSOYOO IoT Robot Car App in Google Play or the App Store.
Read the following tutorial for more information about app installation:
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 your Arduino. Open the app, tap Settings, then enter the Arduino IP address from Step 3 and set the Port to 8888:

The button on pin D3 works as a toggle: press it once, and the LED on pin D2 turns on; press it again, and the LED turns off.
You can also press F1 in the app to turn the LED on, or press F2 to turn it off.

Press any key in the app, and the current LED status will appear as shown below:

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

Leave a Reply

Your email address will not be published. Required fields are marked *


Address:
E-mail:
Tel: