OSOYOO Mecanum Wheel
Robotic Car Kit V2.1 for Arduino

Mecanum wheels, also known as omni wheels or Ilon wheels, consist of a hub with rollers oriented 45°to
the axis of rotation. The mecanum wheels are wheel hubs fitted with integrated rollers that move passively
and independently.
Depending on which wheels rotate in which direction, the platform will move forward, backward,
sideways, diagonally, or spin in place. This range of maneuverability enables the omni platform toefficiently navigate any space, particularly around tight corners, narrow lanes, and complex pathways.
This Arduino omini direction robot car learning kit is developed our Japan and Canada engineer team. It
has all features a traditional Arduino Robot car should have, including remote control by bluetooth, IoT
through wifi, line tracking, obstacle avoidance auto driving and object follow. With the help of powerfulmecanum wheels, the car can make much more complicated movement such as sideway shifting anddiagonally movement controlled by cell phone APP.
The kit comes with OSOYOO Mega2560 board (fully compatible with Arduino Mega2560) andOSOYOO ESP8266 WiFi shield. Besides, we have designed five step by step lessons which help students tolearn Arduino robot programming from scratch. If you are an experience DIY player or Arduino
programmer, you can also get a lot of knowledge from this kit’s open source code and hardware to makeinteresting DIY project of your own.

Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

2

CONTENTS
Lesson 1 Basic Robot Car Assembly ·······································································4Lesson 2 Obstacle Avoidance Robot Car ································································24
Lesson 3 Tracking Line Robot Car ········································································31
Lesson 4 Object Follow Robot Car ········································································35
Lesson 5-Imitation Driving With Bluetooth ···························································40
Lesson 6 Wifi Iot Controlled Robot Car ································································453Lesson 1 Basic Robot Car Assembly

Mecanum omni direction wheel is a very interesting wheel which allows robot car makeomni-directional movement ( e.g. parallel shift to left and right).
In this project, we will show how to use Arduino to control an osoyoo brand mecanum
wheel robot car to make some basic movement including go forward, backward, left turn,right turn, parallel left shift, parallel right shift etc.
This lesson also shows you how to install the chassis of this car and connect Arduino
control signal wires to model Y board. This installation will be the start point of our otherlessons.

OSOYOO Mecanum wheels robotic car chassis x1
OSOYOO Wheels and motors x4 (left-wheels x2/right-wheels x2)
OSOYOO Mega2560 board fully compatible with Arduino UNO/Mega2560 x1
OSOYOO Uart Wifi shield x1
OSOYOO Model Y Motor driver board（it is integrated with two pcs of TB6612 H-Bridge Driver which can control 4 separate channel and 8 PWM
output ports.）
OSOYOO Voltage meter x1
OSOYOO Battery box x1
OSOYOO 6pin male to female jumper wire x2
OSOYOO 3pin female to female jumper wire x1
OSOYOO 2 pin PnP female to female x1
18650 Batteries(3.7V) x2
Battery charger x1

1) Fix 4 motors with metal motor holders as follows. (Please check the motor direction
before installing metal motor holders.)42) Fix 4 motors on lower car chassis with M3*10 hex screws via hex screwdriver. (screws forthis step are in metal motor holder package.)3）Insert TB6612 module onto OSOYOO model Y driver board.
If you receive the model Y driver board V2.0 as follows, please skip over the step 3).

5

Note: The white button has two status, PUSH-DOWN and POP-UP and make sure thebutton is in PUSH-DOWN position.

4) Install OSOYOO model Y driver board to lower car chassis with 4pcs M3 plastic screws,
plastic pillars and plastic nuts. And connect 4 motors to Model Y motor board K1 and K3
sockets as per following graph.
(Please make sure you install the OSOYOO model Y driver board in correct direction.)6

If you receive the updated model Y driver board V2.0, please install it
as follows.

75) Install tracking sensor modules on lower car chassis with 2 pcs M3 plastic screws, M3
plastic pillars and M3 plastic nuts.

6) Fix copper pillars with 6pcs M3*10 screws and 6pcs washers on lower chassis.

87) Fix this battery box on upper chassis with 4pcs M3 x 10 screws and M3 nuts.

8) Install voltage meter on low car chassis with 2pcs M3 plastic screws, plastic pillars andplastic nuts.

99) Fix OSOYOO Mega2560 board on upper car chassis with 6pcs M3 plastic screws, 6pcs
plastic pillars and 2pcs plastic nuts. (Please install mega2560 board at the side withprinting.)

Insert OSOYOO uart WiFi shield onto your mega2560 board.

1010) Install servo motor at the front of upper car chassis with 2pcs M2.2*8 Self Tapping
Screws.

11) Install 2pcs IR distance sensors with 2pcs M3 plastic screws, M3 plastic pillars and M3
plastic nuts at the front of upper car chassis. You can install M3 plastic screws under upper
chassis in order to tighten IR distance sensors enough.

1112) Install 2pcs LED light on the front barrier plate as follows.

13) Before combine upper and lower chassis into one, it need the circuit connection.

1214）Connect OSOYOO model Y board to OSOYOO Uart WiFi shield with 2pcs 6pin male tofemale jumper wires as follows. The 6-pin wires in Area M_B need to go through the holenear SG90 servo, the other 6-pin wires in Area M_A need to go through the hole nearvoltage meter.

If you receive the updated model Y driver board V2.0, please install it asfollows.

13

14

Caution:
When insert/remove this 6-pin plug into Model Y 6-pin male socket, please hold the plastic
pin-holder to do operation. Never drag the wires to pull the plug out of the socket,
otherwise it will damage the wires.

15) Connect voltage meter to OSOYOO model Y board with 3pin female to female jumper
wire as below connection diagram.
Connect OSOYOO model Y board 12V-GND socket to VIN-GND socket with OSOYOO 2pin
PnP cable 20cm as per following graph.
Connect battery box to VIN-GND socket of OSOYOO Uart WiFi shield according below
connection diagram.

1516) Install 2pcs LED Lights on the front transverse diaphragm as follows.

16

Connect the LED light to OSOYOO Uart WiFi shield as follows.

17) Connect SG90 servo motor, OSOYOO model Y board and OSOYOO Uart WiFi shield as
following diagram.

1718）Connect GND-VCC pin of tracking sensor module to GND-5V of OSOYOO Uart WiFi
shield V1.3; connect IR1, IR2, IR3, IR4, IR5 pins to A4, A3, A2, A3, A1 with 7pin 25cm female18

to female cable as the following photo shows.

19) Fix upper chassis to lower chassis with 6pcs M3*10 hex screws.

1920) Install 4 wheels onto the motors with 4pcs M2.2×22 screws.
Now hardware installation is almost down. Before we install 18650 batteries into the box,
we need burn the sample code into Arduino First.

Note: There are two types and to arrange them so the rollers point toward center of car
when viewed from above.

20

Open-source Arduino
Software(IDE)

Download Arduino IDE here:
https://www.arduino.cc/en/Main/Software?setlan
g=en

7 zip is a free zip
utility that un-zips zip files

Download 7zip here for freehttps://www.7-zip.org/

Step 1: Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip
this step). Download Arduino IDE fromhttps://www.arduino.cc/en/Main/Software?setlang=en , then install the software.
Step 2: Download https://osoyoo.com/driver/mecanum_acrylic_chassis_v2/mc-lesson1.zip,
unzip the download zip file mc-lesson1.zip, you will see a folder called mc-lesson1.zip.
Step 3: Connect mega2560 board to PC with USB cable, Open Arduino IDE -> click file ->click Open -> choose code “mc-lesson1.ino” in lesson1 folder, load the code into arduino.

Step 4: Choose corresponding board/port for your project, upload the sketch to the board.

21

Note: If the car runs from USB (ie wheels turn when off ground) but it does not workwhen the USB is disconnected and the batteries correctly inserted, check the double
driver Y board switch - it was probably knocked and is up. It can be pushed down with a22screwdriver without taking top and bottom apart.

Disconnect Arduino from PC, put battery into battery box. When you put the car on the
ground and turn on the switch on OSOYOO Uart WIFI shield V1.3 and the switch on battery
box if you install battery box for 18650.
The car should Forward→Backward→Left turn→Right turn→Right Parallel Shift→Left Parallel Shift→
Down Left Diagonal→ Up Right Diagonal→
Up Left Diagonal → Down Right Diagonal, then stop.

23

Lesson 2 Obstacle Avoidance Robot Car

In this lesson, we will do an obstacle avoidance auto-driving project. We use an ultrasonicmodule to “see” obstacle, and the car will turn around from the obstacle automatically.
You must complete lesson 1 before you continue on with this lesson.

OSOYOO Mecanum wheels robotic car chassis x1
OSOYOO Wheels and motors x4 (left-wheels x2/right-wheels x2)
OSOYOO Mega2560 board fully compatible with Arduino UNO/Mega2560 x1
OSOYOO Uart Wifi shield x1
OSOYOO Model Y driver board x1
OSOYOO Voltage meter x1
OSOYOO MG90 servo motor x 1
OSOYOO Ultrasonic sensor module x1
OSOYOO Mount holder x1
OSOYOO Battery box x1
OSOYOO 3pin female to female jumper wire x1
OSOYOO 6pin male to female jumper wire x2
OSOYOO 10pin male to female jumper wire x1
OSOYOO 2 pin XH.25 female to female x1
18650 Batteries(3.7V) x2
Battery charger x1

1) Install Ultrasonic Module to mount holder with 4pcs M1.4*8 screw and M1.4 nuts.

242) Install mount holder for Ultrasonic Module on servo motor with M2*4 Self Tapping
screw.

3)Please keep all lesson 1 connections same as it is.Before connecting wires, make sure thatyou have connect SG90 servo motor to model Y board and OSOYOO uart wifi shield as
follows.
(Note: You need split 1 pcs of male-to-female jumper wires from our 10-pc jumper wirebundle. Any color from the bundle will be ok. The rest of wires are as spare parts for25

potential broken or damaged wires.)4）Connect ultrasonic module with OSOYOO Uart WiFi shield as follows.

26

Open-source Arduino
Software(IDE)

Download Arduino IDE here:
https://www.arduino.cc/en/Main/Software?setlan
g=en

7 zip is a free zip
utility that un-zips zip files

Download 7zip here for freehttps://www.7-zip.org/

Step 1: Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip
this step). Download Arduino IDE fromhttps://www.arduino.cc/en/Main/Software?setlang=en , then install the software.
Step 2: Download https://osoyoo.com/driver/mecanum_acrylic_chassis_v2/mc-lesson2.zip,
unzip the download zip file mc-lesson2.zip, you will see a folder called mc-lesson2.zip.
Step 3: Connect mega2560 board to PC with USB cable, Open Arduino IDE -> click file ->click Open -> choose code “lesson2.ino” in lesson2 folder, load the code into arduino.

27

Step 4: Choose MEGA2560 board as the board type and correct port for your project asfollowing picture, upload the sketch to the board.

28

Ultrasonic sensor servo initial direction alignment
After turning on the battery, the servo will make some movement and finally stops at
front direction for 3 seconds.

If the ultrasonic sensor does not face the front during this first 3 seconds, you should turn29

off battery immediately and remove the sensor from servo, reinstall it and make it facingstraight forward direction as following picture. Otherwise the obstacle avoidance program
will not work properly.
After adjusting sensor direction, turn on battery again, the sensor should face front same
as following picture. If its direction is not straight forward, turn off battery and do directionalignment again.

Final Testing :After Turning on the battery switch on the battery box, if the ultrasonic module turn tofront view position, that means you no need adjust sensor position anymore. Just wait 3
seconds. If no obstacle is detected, the car will go forward. If any obstacles is detected, thecar will stop, the ultrasonic module will turn from right to left to detect surrounding
obstacles. The robot car will decide to make left turn, right turn or backward according to
obstacle sensor data and our obstacle avoidance algorithm.
Sometimes your car might have collision and make your Ultrasonic sensor positionchange, you must remember to do sensor direction alignment again as per link Ultrasonicsensor servo initial direction alignment.

30

Lesson 3 Tracking Line Robot Car

In this lesson, we will do a line-tracking auto-driving project. We will add a 5-Point
tracking sensor module to the robotic car built in Lesson 1. The software in this lesson will
read data from the 5-Point Tracking sensor module and automatically guide the smart car tomove along the black track line in the white ground.
Lesson 1 must be completed before doing this line-tracking project.

OSOYOO Mecanum wheels robotic car chassis x1
OSOYOO Wheels and motors x4 (left-wheels x2/right-wheels x2)
OSOYOO Mega2560 board fully compatible with Arduino UNO/Mega2560 x1
OSOYOO Uart Wifi shield x1
OSOYOO Model Y driver board x1
OSOYOO Voltage meter x1
OSOYOO 5-point tracking sensor module x1
OSOYOO Battery box x1
OSOYOO 3pin female to female jumper wire x1
OSOYOO 6pin male to female jumper wire x2
OSOYOO 7pin female to female jumper wire x1
OSOYOO 2 pin XH.25 female to female x1
18650 Batteries(3.7V) x2
Battery charger x11) Please keep all lesson 1 connections same as it is.(Remember : DO NOT remove any
existing wires installed in Lesson 1 ).
2) Connect GND-VCC pin of tracking sensor module to GND-5V of OSOYOO Uart WiFi shield
V1.3; connect IR1, IR2, IR3, IR4, IR5 pins to A4, A3, A2, A2, A1 with 7pin 25cm female tofemale cable as the following photo shows.

Open-source Arduino
Software(IDE)

Download Arduino IDE here:
https://www.arduino.cc/en/Main/Software?setlan
g=en

31

7 zip is a free zip
utility that un-zips zip files

Download 7zip here for freehttps://www.7-zip.org/

Step 1: Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip
this step). Download Arduino IDE fromhttps://www.arduino.cc/en/Main/Software?setlang=en , then install the software.
Step 2: Download https://osoyoo.com/driver/mecanum_acrylic_chassis_V2/mc-lesson3.zip,
unzip the download zip file mc-lesson3.zip, you will see a folder called mc-lesson3.zip.
Step 3: Connect mega2560 board to PC with USB cable, Open Arduino IDE -> click file ->click Open -> choose code “lesson3.ino” in lesson3 folder, load the code into arduino.

Step 4: Choose corresponding board/port for your project, upload the sketch to the board.

32Adjust the sensitivity of tracking sensor modules. Turn on and hold the car and adjust thepotentiometer on the tracking sensor with Philips screwdriver until you get the best
sensitivity status: the signal indicate LED light will turn on when sensor is above black track,and the signal LED will turn off when the sensor is above white ground.

33

Final Testing:
Prepare a black track (the width of the black track is more than 20mm and less than30mm) in white ground. Please note, the turning angle of track can’t be too sharp,
otherwise the car will move out of the track.
Turn on the car and put the middle of tracking sensor module facing over black track, andthen the car will move along the black track.

34

Lesson 4 Object follow Robot car

In this lesson, we will install 2pcs IR distance sensors on robot car and program the car tofollow object movements. The car receives the signal from the IR distance sensors, and thenthe program will drive the car to take actions.
You must complete lesson 1 (assembling the car) before you start
this lesson.

OSOYOO Mecanum wheels robotic car chassis x1
OSOYOO Wheels and motors x4 (left-wheels x2/right-wheels x2)
OSOYOO Mega2560 board fully compatible with Arduino UNO/Mega2560 x1
OSOYOO Uart Wifi shield x1
OSOYOO Model Y driver board x1
OSOYOO Voltage meter x1
OSOYOO IR distance sensors x2
OSOYOO Battery box x1
OSOYOO 3pin female to female jumper wire x1
OSOYOO 6pin male to female jumper wire x2
OSOYOO 10pin male to female jumper wire x1
OSOYOO 2 pin XH.25 female to female x1
18650 Batteries(3.7V) x2
Battery charger x1

Step 1: Install the smart car basic frame work as per Smart Car Lesson 1 . If you have alreadycompleted installation in Lesson 1 , just keep it as is.

35

Step 2: Connect 2pcs IR distance sensors modules as below connection diagram.
(Remember : DO NOT remove any existing wires installed in Lesson 1 ).

Open-source Arduino
Software(IDE)

Download Arduino IDE here:
https://www.arduino.cc/en/Main/Software?setlan
g=en

7 zip is a free zip
utility that un-zips zip files

Download 7zip here for freehttps://www.7-zip.org/

Step 1: Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip
this step). Download Arduino IDE fromhttps://www.arduino.cc/en/Main/Software?setlang=en , then install the software.
Step 2: Download https://osoyoo.com/driver/mecanum_acrylic_chassis_v2/mc-lesson4.zip,
unzip the download zip file mc-lesson4.zip, you will see a folder called mc-lesson4.zip.
Step 3: Connect mega2560 board to PC with USB cable, Open Arduino IDE -> click file ->click Open -> choose code “lesson4.ino” in lesson4 folder, load the code into arduino.

36

Step 4: Choose corresponding board/port for your project,upload the sketch to the board.

37

Step 5: Turn on the car, put object about 10cm ahead of each IR distance sensors and adjust
potentiometer on IR distance sensors to detect object or your hand.
Note: When these IR modules detect objects, both the power indicator and signal
indictor are on. When No object is detected, only power indicator is on, signal indicator isoff. If the signal indictor is always on even though there is no obstacle in front of the sensor,
you need to adjust the potentiometer.

38

Turn on the car, place your hand ahead of the car, then the car will move towards yourhand as if you pull it. It goes forward when both IR Obstacle Avoidance modules detect
your hand; it turns right if only the right IR Obstacle Avoidance module detects object; itturns left if only the left IR distance sensor detects object.
when your hand is over 10cm ahead, it will stop.

39

Lesson 5-Imitation Driving with BluetoothIn this lesson, we will use a mobile APP to control our robot car and make an imitation
driving. Since it is a mock driving, we will use a virtual steering wheel and gear in our APP toimitate their counterparts in real car.

OSOYOO Mecanum wheels robotic car chassis x1
OSOYOO Wheels and motors x4 (left-wheels x2/right-wheels x2)
OSOYOO Mega2560 board fully compatible with Arduino UNO/Mega2560 x1
OSOYOO Uart Wifi shield x1
OSOYOO Model Y driver board x1
OSOYOO Voltage meter x1
OSOYOO Bluetooth modules x1
OSOYOO Battery box x1
OSOYOO 3pin female to female jumper wire x1
OSOYOO 6pin male to female jumper wire x2
OSOYOO 10pin male to female jumper wire x1
OSOYOO 2 pin XH.25 female to female x1
18650 Batteries(3.7V) x2
Battery charger x1

Step 1: You must complete lesson 1 (assembling the car) before you continue on with thislesson.
Step 2: Connect Bluetooth TX/RX ports to D19,D18 with jumper wires.
(Note: You need split 2 pcs of male-to-female jumper wires from our 10-pc jumper wirebundle. Any color from the bundle will be ok. The rest of 8 pcs wires are as spare parts forpotential broken or damaged wires.)40

Step 3: Bluetooth Module should be inserted into bluetooth 6-pin slot in OSOYOO Wifi
Board.

Step 4: Mobile APP:
Go to your Google Play or Apple APP store and search APP name “OSOYOO imitation
driving”, Download the APP as following and install it in your smart phone.

41

Display interface

Open-source Arduino
Software(IDE)

Download Arduino IDE here:
https://www.arduino.cc/en/Main/Software?setlan
g=en

7 zip is a free zip
utility that un-zips zip files

Download 7zip here for freehttps://www.7-zip.org/

Step 1: Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip

42

this step). Download Arduino IDE fromhttps://www.arduino.cc/en/Main/Software?setlang=en , then install the software.
Step 2: Download https://osoyoo.com/driver/mecanum_acrylic_chassis_v2/mc-lesson5.zip,
unzip the download zip file mc-lesson5.zip, you will see a folder called mc-lesson5.zip.
Step 3: Connect mega2560 board to PC with USB cable, Open Arduino IDE -> click file ->click Open -> choose code “lesson5.ino” in lesson5 folder, load the code into arduino.

Step 4: Choose corresponding board/port for your project,upload the sketch to the board.

43

Notice: Power on the robot, and open APP.
1) Connect APP to HC-02 Bluetooth Module2) Click Engine Switch to start/stop the car3) Click Speed +/- button to accelerate or reduce speed4) Rotate the mobile phone to change direction(steering wheel will rotate while you are
turning the phone).
5) click Gear button to change gear to Forward or Backward direction.
6) press F1 to Shift to left way, F5 to shift to right way, F3 to up left diagonal, F4 to up rightdiagonal.

44

Lesson 6 WiFi IoT Controlled Robot Car

In this project we will connect Robot Car to Wifi and Use an APP to control the car
through Wifi. This is a typical Internet of Things(IoT) Application.
Lesson 1 , Lesson 2, Lesson 3 must be completed before doing this lesson.

OSOYOO Mecanum wheels robotic car chassis x1
OSOYOO Wheels and motors x4 (left-wheels x2/right-wheels x2)
OSOYOO Mega2560 board fully compatible with Arduino UNO/Mega2560 x1
OSOYOO Uart Wifi shield x1
OSOYOO Model Y driver board x1
OSOYOO Voltage meter x1
OSOYOO Battery box x1
OSOYOO 3pin female to female jumper wire x1
OSOYOO 6pin male to female jumper wire x2
OSOYOO 10pin male to female jumper wire x1
OSOYOO 2 pin XH.25 female to female x1
18650 Batteries(3.7V) x2
Battery charger x1

If you just finishes all lesson 1-3 and lesson 5( bluetooth imitation driver), please keep all
lesson connections same as is. Then unplug bluetooth from Wifi Shield.
Step 1. Remove the connection B_TX to D18 and B_RX to D19.
Step 2. Connect E_RX to D18(TX1) and E_TX to D19(RX1).

45

Open-source Arduino
Software(IDE)

Download Arduino IDE here:
https://www.arduino.cc/en/Main/Software?setlan
g=en

7 zip is a free zip
utility that un-zips zip files

Download 7zip here for freehttps://www.7-zip.org/

Step 1: Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip
this step). Download Arduino IDE fromhttps://www.arduino.cc/en/Main/Software?setlang=en , then install the software.
Step 2: Please download the library zip file from WiFiEsp-master.zip .Open Arduino IDE->click Sketch ->Include Library ->Add .ZIP library , then load above zip file into Arduino.

46

Step 3: Download https://osoyoo.com/driver/mecanum_acrylic_chassis_v2/mc-lesson6.zip,
unzip the download zip file mc-lesson6.zip, you will see a folder called mc-lesson6.
Step 4: APP installation-you need search “OSOYOO Wifi UDP Robot Car Controller ” inGoogle Play or Apple Store, and then install this APP.

47

Step 5: Arduino Sketch code Installation:
Unzip the downloaded file, enter the mc-lesson6 folder, you will see two sub-folder :mclesson6A and mc-lesson6B.
These two folders have program for two Wifi modes: AP mode and STA mode. The
Arduino sketches for these two modes are different. Let’s explain these two modes one byone.

When working in AP mode, our robot car itself will become a Wifi Hot Spot. Our cell
phone can connect to Robot Car as its wifi client. The IP address of Robot is fixed as
192.168.4.1 and It is not connected to WAN.
(1) Unzip the mc-lesson6.zip file and you will see a folder named mc-lesson6A, upload thecode into Arduino.
(2) Open your Arduino Serial monitor, and you will see a similar result as AP mode. A new
Wifi SSID “osoyoo robot” with IP address 192.168.4.1 will show up in the window. Thismeans your Robot car has a Wifi Hot Spot name “osoyoo_robot” , its IP address is
192.168.4.1(3)Now your Robot car become a Wifi Hot Spot and set IP address as “192.168.4.1” to yourAPP Setting section.

48

(4) Connect your cell phone to “osoyoo_robot” wifi hot_spot, and you can use Mobile
phone control the robot car.

(5) You can click the ◄ ► ▲ ▼ direction keys to make the car move. Use “||” pause key tostop the car movement.
Click Obstacle to shift left side, Click Tracking to shift right side.
Click F1 to make upper-left diagonal movement, Click F3 to make upper-right diagonal
movement49

Click F4 to make back-left diagonal movement, Click F6 to make back-right diagonal
movement.

In STA mode, robot car does not work as a wifi hotspot. Instead, it will become aninternet node in your LAN. You need tell Arduino sketch what is your local router’s Wifi SSID
and password, then Arduino talks to router and get its own LAN IP address from DHCP
server. You can use Mobile APP to access the robot car’s IP address and control its
movement.
(1) Unzip the mc-lesson6 file and you will see a folder named mc-lesson6b, then load the
mc-lesson6b.ino code into Arduino.
(2) You need change the code Line 180 and Line 181 :char ssid[] = “YOUR_ROUTER_SSID”; // replace this with your router wifi SSID
char pass[] = “YOUR_ROUTER_WIFI_PASSWORD”; // replace with your wifi password

50

(3) Upload the sketch to Arduino. Finally, click the Serial monitor window in upper rightcorner of Arduino IDE, you will see following result:(4) In this mode, your will see an IP address which is our LAN IP address assigned by myrouter. Please write down this IP address 192.168.50.44 and click Setting to set up robot IP
address and set this IP address 192.168.50.44 to your APP Setting section (no need change
default port 8888 in APP).

51

(5) Now your Robot car is connected to your LAN, you can use Mobile phone under same
LAN to control the robot car. If your APP is in WAN, you need to go to your Router Control
Panel, forward Port 80 to Robot car LAN IP address, then you can use Router IP to control
the car. This feature makes our robot car A REAL INTERNET OF THING device(6) You can click the ◄ ► ▲ ▼ direction keys to make the car move. Use “||” pause key tostop the car movement.
Click Obstacle to shift left side, Click Tracking to shift right side.
Click F1 to make upper-left diagonal movement, Click F3 to make upper-right diagonal
movement.
Click F4 to make back-left diagonal movement, Click F6 to make back-right diagonal
movement.

FAQ about the Wifi UDP APP and sketch Code:
Q1)How to tune the robot car speed?
A: If you want change the speed performance of the robot car, please following parametersin line 11 to 13:#define SPEED 85#define TURN_SPEED 90#define SHIFT_SPEED 130
SPEED value determines forward moving speed

52

TURN_SPEED value determines turning speed
SHIFT_SPEED value determines parallel shifting speed
Q 2) What happened when you press buttons in OSOYOO WiFi UDP Robot Car APP ?
A: When you press a button of the APP, APP will send a single-letter message through UDP
protocol to target device (in this example, our Arduino Wifi Shield)
Q3)How does Arduino handle the UDP command?
Line 230 to line 245 in mecanum-2560-lesson5A.ino file are the codes which react to Cell
phone command. For example, when ▲ is pressed, according to Q1 table, a letter “A”
command was sent from Cell phone to Arduino. Line 233 case ‘A’ …. statement will makethe car make car moving forward.
char c=packetBuffer[0];switch (c) //serial control instructions{
case ‘A’:go_advance(SPEED);;break;case ‘L’:left_turn(TURN_SPEED);break;case ‘R’:right_turn(TURN_SPEED);break;case ‘B’:go_back(SPEED);break;case ‘E’:stop_Stop();break;case ‘F’:left_shift(0,150,0,150);break; //left aheadcase ‘H’:right_shift(180,0,150,0);break; //right aheadcase ‘I’:left_shift(150,0,150,0); break;//left backcase ‘K’:right_shift(0,130,0,130); break;//right backcase ‘O’:left_shift(200,150,150,200); break;//left shiftcase ‘T’:right_shift(200,200,200,200); break;//left shiftdefault:break;}53