Previous                                 Introduction

NOTE: ALL OSOYOO PRODUCTS FOR ARDUINO ARE THIRD PARTY BOARD WHICH IS FULLY COMPATIBLE WITH ARDUINO

Contents

Authorized Online Retailers

Objective

In this lesson, we will use a Mobile APP to control the 2WD robot car through ESP8266 Wi-Fi Chip. You will learn how to install ESPWebmaster library, how to get Wifi Network IP address of your Arduino board and how to communicate between Arduino board and Wi-Fi net through Serial port.

top

Hardware Installation

Hardware installation and motor connection are  exactly the same as Lesson 1, you must make sure the lesson 1 project works well. Otherwise, this project can’t get through.

You also need to connect the two ESP_TX to D4 and ESP_RX to D5 through the jumper caps showed in the red jumper cap icon in following picture:

(Note: Our OSOYOO Uart WiFi shield V1.3 are connected BLE URAT TX/RX ports to D4,D5 with jumper caps by default. If you find the BLE URAT TX/RX ports are connected, you need remove these jumper caps and change to connect ESP URAT E-TX to D4 and E-RX to D5)

ESP URAT:

D4 – E-TX

D5 – E-RX

top

Software Installation

Step 1) 

Download OSOYOO Wi-Fi UDP Robot Car control APP
In Google Play or Apple Store, please search keywords “OSOYOO IoT UDP Robot Car”, you will find a red icon APP as following (Note: If you can not find this APP in Google Play, you can directly download the APP from following link: https://osoyoo.com/driver/udp-app.apk ):

Step 2)  Please download the WifiESP-Master library zip file from https://osoyoo.com/driver/WiFiEsp-master.zip

Open Arduino IDE →click Sketch →Include Library →Add .ZIP library, then load above two zip files into OSOYOO Basic Board for Arduino.

Step 3) Please download STA mode sketch code from https://osoyoo.com/driver/2wd/lesson5.zip. Unzip the file, you will see a folder “lesson5”. Open Arduino IDE → click file → click Open → choose code “lesson5.ino” in above folder, load the code into OSOYOO Basic Board for Arduino.

Note: You need to change the code in line 71,72

char ssid[] = “***”; // replace *** with your router wifi SSID

char pass[] = “***”; // replace *** your wifi password

Now upload the lesson5.ino sketch to OSOYOO Basic Board for Arduino. Finally, click the Serial monitor window in upper right corner of Arduino IDE, you will see following result:

In the above example, I can see an IP address 192.168.0.117, which is the Arduino board   IP address assigned by our router. Please write down this IP address and click Setting to set up robot IP address and set this IP address to your APP Setting section and Port to 8888 in settings.

For example, if your Serial monitor shows your Arduino IP address is 192.168.1.81 , you can set it to APP as per the following pictures:

Testing

You can click the  button to make left turn (rotate steering wheel counterclockwise), click ► button to make right turn (rotate steering wheel   clockwise), if you keep press these two buttons, it will turn at sharper angle.
 button will make car move forward and  key will make car move backward. Press the [] button in the middle can stop the car,

Notice: Shut off your battery or unplug your power adapter when upload sketch code to Arduino. 

Disconnect Arduino from PC, put 2 fully-charged 18650 battery into battery pox (check the box instruction and make sure polar direction is correct, otherwise it can destroy your device and cause fire hazard). Please install your battery as per the following instruction:

 

top

Parts and Devices:

No. Picture Device Qty. Data sheet Buy in Link
1 OSOYOO basic board 1 click here Click here to buy
2 OSOYOO UART Wi-Fi shield V1.3 1 click here Click here to buy
3 OSOYOO model X motor driver module 1 click here Click here to buy
4 IR receiver 1 click here Click here to buy
5 IR remote controller 1 click here Click here to buy
6 Tracking sensor module 2 click here Click here to buy
7 HC module 1 click here Click here to buy
8 Gear motor 2 Click here to buy
9 Metal Motor Holders with screws 2 Click here to buy
10 Wheel 2 Click here to buy
11 Universal Wheel 1
12 6pin male to 6pin female jumper wire 1 Click here to buy
13 OSOYOO 2pin PnP cable 20 cm 1 Click here to buy
14 20Pin jumper wire Male to female 15 cm 1 Click here to buy
15 Philips screwdriver 1 Click here to buy
16 Hex Screwdriver 1 Click here to buy
17 18650 battery box 1 Click here to buy
18 Battery charger for 18650 battery 1 Click here to buy
19 1Pair 18650 batteries 1 Click here to buy
20 M3*5 Hex Screws 10
21 M3*10 screw 4
22 M3 nut 4
23 Copper pillar 4
24 Screw for wheel 2
25 M3 plastic screw 15
26 M3 plastic pillar 15
27 M3 plastic nut 15

top

Previous                                 Introduction