Buy from US | Buy from UK | Buy from DE | Buy from IT | Buy from FR | Buy from ES | Buy from JP |
In this lesson, we’ll learn how use Cell Phone APP to control a relay switch to turn on/off an LED.
Relay is switch which is turn on/off a high voltage circuit with low voltage signal. We often use relay to control 110V or 220 V devices in home and office.
First, please insert the ESP8266 wifi Shield into your UNO board,
UNO Board | Relay |
D9 | S |
GND | GND |
5V | VCC |
Software Installation
Step A) Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip this step).Download Arduino IDE from https://www.arduino.cc/en/Main/Software?setlang=en, then install the software.
Step B) Connect the Arduino UNO board to computer via USB cable,
Step C) Open the Arduino IDE and choose corresponding board type and port type for you project.
Step D) Download the sketch file from : https://osoyoo.com/driver/wifi-iot/lesson11/esp8266-lesson11B.zip
unzip the file and double click the esp8266-lesson11B.ino file, load the sketch into Arduino IDE, find following lines:
char ssid[] = "******"; // your network SSID (name) char pass[] = "******"; // your network password
please replace the ****** with your correct wifi SSID and password, otherwise your project can not connect to Internet.
Step E) After change above lines, load the sketch into Arduino IDE.
Open your Serial Monitor, you can see your router will assign an IP address to your Arduino as following:
please set your UDP APP target IP to: 192.168.50.47 target port 8888
In above example, 192.168.50.47 is the IP address of my Arduino and 8888 is the UDP port number which will be set into our cell phone APP in next step.
Step G) Install UDP send Mobile APP, If you have already installed OSOYOO WiFi UDP Robot Car APP, please skip this step.
You can use any UDP send APP to run this lesson. In this lesson, we use OSOYOO WIFI UDP Robot Car APP to make test.
In Google Play or Apple Store, please search key words “OSOYOO WIFI UDP Robot Car”, you will find an orange icon APP as following:
Notes:When the phone is operating the APP,Please keep the phone on the same LAN with UNO board .
Press F1 , Your Relay will open and LED will on. Press F2, Your relay and LED will turn off
DownLoad Url osoyoo.com