In this tutorial, we will introduce how to use OSOYOO IoT Library to get UDP data from OSOYOO Iot UDP Robot APP and control a Servo motor.

Hardware Requirement:

1

OSOYOO UNO R3

(fully compatible with

Arduino UNO R3)

1 Click here to buy
2 OSOYOO ESP8266 WIFI Module 1 Click here to buy
3 OSOYOO Magic I/O Shield for Arduino(optional) 1 Click here to buy
4 OSOYOO Brick Style Servo (or any other 180 degree servo like SG90,MG90 etc) 1 Click here to buy

Circuit Connection:

PART I/O Shield
Servo D9
ESP8266 VCC 5V
ESP8266 GND GND
ESP8266 E_TX D2
ESP8266 E_RX D3

Software Installation

Before you running the code, please download following libraries:
WifiEsp-master library, download link:https://osoyoo.com/driver/WiFiEsp-master.zip
PWMServo library, Download link: https://osoyoo.com/driver/sg90car/PWMServo.zip
OsoyooIOT Library, Download link: https://osoyoo.com/driver/wifi-iot/OsoyooIOT.zip

Open  IDE ->click Sketch ->Include Library ->Add .ZIP library , then load above zip files into Arduino one by one.


Run the OSOYOOTest example code from Arduino IDE ->File ->Examples ->OsoyooIOT->OsoyooTest

you need to change the wifi ssid and password in line 25 , 26 to match your home wifi setting.

After that, upload the sketch code to Arduino, open the Serial monitor in your Arduino IDE and find the IP address of your Arduino:

You will use the IP address in your APP setting.

OSOYOO IoT UDP Robot APP download and Setting

Download OSOYOO Wifi UDP Robot Car control APP
In Google Play or Apple Store, please search key words “OSOYOO IOT UDP Robot APP”, you will find an orange icon APP as following:

Open that APP and set your Arduino IP address to the APP:

Click Save button to save your Arduino IP into APP, then go back the the Home UI of your APP

You can click any button in the APP or move the slider in the APP. Your Arduino Serial monitor will print out which Command your key typed, and what is the value

For example, when you press F1 key, Serial monitor will show “Data Command:F Data Value=0”, When you press F2 key , Serial monitor will show “Data Command:G Data Value=0”

When you move the bottom slider to 0 to 100, Serial monitor will show:
Data Command:SB Data Value=0
Data Command:SB Data Value=1

Data Command:SB Data Value=99
Data Command:SB Data Value=99
Data Command:SB Data Value=100

Especially when you move top slider, the Servo will rotate as per your slider moving from left to right.