More information:

http://osoyoo.com/?p=30022

Mecanum wheels, also known as omni wheels or Ilon wheels, consist of a hub with rollers oriented 45°to theaxis of rotation.The mecanum wheels are wheel hubs fitted with integrated rollers that move passively andindependently.
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 to efficiently 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 and Obstacle Avoidance auto driving. With the help of powerful Mecanum wheels,the car can make much more complicated movement such as sideway shifting and digaonally movement
controlled by Cell phone APP.
The kit comes with OSOYOO MEGA2560 board(fully compatiable 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 make interesting DIY
project of your own.

Mecanum Wheel Robot Car Kit Metal Chassis (without 18650 batteries)
Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

Mecanum Wheel Robot Car Electronic Parts Kit (without 18650 batteries)
Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

Mecanum Wheel Robot Car Full Package (without 18650 batteries)
Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

CONTENT
Lesson 1 Basic Robot Car Assembling .......................... - 1 Lesson 2 Obstacle Avoidance Robot Car ..................... - 14 Lesson 3 Line Following Robot Car ............................ - 20 Lesson 4 Bluetooth Controlled Imitation Driving ....... - 25 Lesson 5 Wifi Controlled Robot Car ........................... - 30 -Lesson 1 Basic Robot Car Assembling
Mecanum Omni wheel is a very powerful wheel technology which allows robot car make omni-directional
movement ( 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.

OSOYOO Mecanum Wheels Robotic Car Chassis x 1 (2xleft-wheels/2xright-wheels and Motor x 4)
OSOYOO MEGA2560 board fully compatible with Arduino
OSOYOO Wifi Shield x 1
OSOYOO Model X motor driver x 2
OSOYOO HC02 Bluetooth Module
OSOYOO battery box x 1
18650 batteries(3.7V) x 2
Specifications:-1-First,please install the hardware as following pictures, then insert OSOYOO wifi shield into arduino Mega2560
board.

-2-

The Mecanum wheel has some sub-wheels on the main wheel. The four Mecanum wheels have two types
by the sub-wheel directions. Check the type A wheel and type Wheel by following picture left side. You must
100% sure that correct type of wheel is installed into correct position as per picture right side, the rolling
direction of each wheel will determine the whole car moving directions showed in the picture.
A correct configuration requires each of four wheels is set in the way as shown below, where the rotation axisof each wheel’s top roller points to the center of the platform. Please notice that all the dynamic analysis andprewritten codes are based on this configuration.
Two types of Mecanum wheel and their installation position in the car-3-

Different rotation combination of 4 wheels will result in different car movement directions. Following pictures
shows how they works.

-4-

-5-

Motor Driver to Arduino UNO connection.

-6-

-7-

Note: wire(purple wire) is connected to D22 which is located on the SECOND female holefrom right in following picture 10. Many people treat the first hole as D22. THIS IS
WRONG.
Front Model X board IN1,IN2,IN3,IN4 pin connect to D22,D24,D26,D28

-8-

-9-

Open-source
ArduinoSoftware(IDE)

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

7 zip is afree 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 from https://www.arduino.cc/en/Main/Software?setlang=en , then install thesoftware.
Step 2: Download http://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal-2560lesson1.zip, unzip the download zip file lesson1.zip, you will see a folder called lesson2 .
Step 3: Connect mega2560 board to PC with USB cable, Open Arduino IDE -> click file -> click Open ->choose code “lesson1.ino” in lesson1 folder, load the code into arduino.

- 10 -

- 11 -

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

After running Lesson 1 code, the car will move
Forward/Backward; Left turn,Right turn;Right Parallel Shift/Left Parallel Shift;
Down Left Diagonal / Up Right Diagonal;
Up Left Diagonal / Down Right Diagonal;
If the car does not move as per this sequence , you need check the wire connection.

Note: If you mecanum wheel car doesn't move as per the above sequence, rather than the following
sequence, you need to download the other series code again, in order to make sure that the car in next lesson
work normally.
Backward/Forward; Right turn/Left turn;Left Parallel Shift/Right Parallel Shift;
Up Right Diagonal/Down Left Diagonal;
Down Right Diagonal/Up Left Diagonal;- 12 -

You need to download the following file and unzip the download zip file lesson.zip.
https://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal-2560-lesson1-reverse.zip
https://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal-2560-lesson2-reverse.zip
https://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal-2560-lesson3-reverse.zip
https://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal-2560-lesson4-reverse.zip
https://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal-2560-lesson5-reverse.zip- 13 -

Lesson 2 Obstacle Avoidance Robot Car

In this lesson, you must complete lesson 1 before you continue on with this lesson. we use the ultrasonic module
to “see” obstacle and measure the distance. If the distance is less than predefined threshold value, the buzzer
will beep and the car will turn around from the obstacle automatically.

OSOYOO Mecanum Wheels Robotic Car Chassis x 1 (2xleft-wheels/2xright-wheels and Motor x 4)
OSOYOO Mega2560 board fully compatible with Arduino x 1
OSOYOO V1.0 Wifi shield x 1
OSOYOO Model X motor driver x 2
OSOYOO MG90 servo motor x 1
OSOYOO Ultrasonic sensor module x1
OSOYOO Mount holder
OSOYOO Battery box x 1
18650 Batteries(3.7V) x 2

You must complete lesson 1 (assembling the car) before you continue on with this lesson.In this lesson3, we will
add a mg90 servo motor and to the robotic car built in Lesson 1.
STEP1: Install Ultrasonic Module to mount holder with 4pcs M1.4*8 screw and M1.4 nut

Step 2: Install mount holder for Ultrasonic Module on servo motor with M2*4 Self Tapping screw (Please note:
please upload code to adjust servo motor direction before fixing this screw).In lesson 1, you have installed servo
motor at the front of upper car chassis with 2pcs M2.2*8 Self Tapping Screws.

- 14 -

If you just finishes Lesson 1, please keep all lesson 1 connections same as it is.
Step5: Connect Servo 3-pin head to any Model X board servo slot(yellow to S pin, red to 5v,brown to G pin),then connect another S pin to Wifi board D13.

- 15 -

- 16 -

Open-source
ArduinoSoftware(IDE)

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

7 zip is afree 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 from https://www.arduino.cc/en/Main/Software?setlang=en , then install the software.
Step 2: Download
http://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal-2560-lesson2.zip ,unzip the download zip file lesson2.zip, you will see a folder called lesson2 .
Step 3: Connect mega2560 board to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose
code “lesson2.ino” in lesson folder, load the code into arduino as following.

- 17 -

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

Step 5:Ultrasonic sensor servo initial direction alignment
After turning on the battery, the servo will make some movement and finally stops at a direction for 5 seconds.
During this first 5 seconds, you must make sure the Ultrasonic sensor(two eyes) is facing straight forward.
If it is not straight forward, you should turn off battery immediately and remove the sensor from servo, reinstallit and make it facing straight forward direction as following picture. Otherwise the obstacle avoidance program
will not work properly.
After adjusting sensor direction, turn on battery again. If its direction is not straight forward, turn off battery
and do direction alignment again.

If the ultrasonic module turn to front view position, that means you no need adjust sensor position anymore.
Just wait 5 seconds. If no obstacle is detected, the car will go forward. If any obstacles is detected, the car will
stop, the ultrasonic module will turn from right to left to detect surrounding obstacle. 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 position change, you must remember
to do sensor direction alignment again.
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
position change, you must remember to do sensor direction alignment again.

Important parameters in the sketch file- 18 -

Following parameters in Line 32 to 39 of mecanum-2560-lesson2.ino are very important to make performancetuning. See the comments in the #define statements:#define FAST_SPEED 110//The difference between FAST_SPEED and SPEED determines the slight turning
sharpness#define SPEED 80//forward moving speed#define TURN_SPEED 110//Turning Speed#define FORWARD_TIME 200//FORWARD_TIME determines Forward distance#define BACK_TIME 300 // determines BACK MOVEMENT distance#define TURN_TIME 250 //Determines turning sharpness#define OBSTACLE_LIMIT 30 //minimum distance in cm to obstacles at both sides- 19 -

Lesson 3 Line Following Robot Car
In this lesson3, we will add a 3-Point tracking sensor module to the robotic car built in Lesson 1.The softwarein this lesson will read data from the 3-Point Tracking sensor module and automatically guide the smart car tomove along the black track line in the white ground.

OSOYOO Mecanum wheels robotic car chassis x 1 (2xleft-wheels/2xright-wheels and Motor x 4)
OSOYOO Mega2560 board fully compatible with Arduino UNO/Mega2560 x 1
OSOYOO V1.0 Wifi shield x 1
OSOYOO Model X motor driver x 2
OSOYOO 3-Point Tracking sensor module
OSOYOO Battery box x 1
18650 Batteries(3.7V) x 2

You must complete lesson 1 (assembling the car), before you continue on with this lesson.
We will add a 3-Point tracking sensor module to the robotic car built in Lesson 3.

- 20 -Start the installation from previous status of Lesson 1 .
If you have installed Lesson 1, no need change anything, just keep the hardware wire connection as it is.
Connect VCC pin of tracking sensor module to 5V of wifi shield;
Connect GND pin of tracking sensor module to GND of wifi shield
Connect L, C, R pins to D2, D3, D4 with 5pin 20cm female to female cable as the following photo shows(Remember: DO NOT remove any existing wires installed in Lesson1.

- 21 -

Open-source
ArduinoSoftware(IDE)

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

7 zip is afree 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
http://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal-2560-lesson3.zip ,unzip the download zip file lesson3.zip, you will see a folder called lesson3 .
Step 3: Connect mega2560 board to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose
code “lesson3.ino” in lesson folder, load the code into arduino as following:.

- 22 -

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

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

Prepare a black track (the width of the black track must be between 20mm and 30mm) in white ground. Please- 23 -

be noted that the bend 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, and then the car will movealong the black track automatically.

Motor Speed Tuning for better tracking performance
To get better tracking performance result, motor power(speed) value should be adjusted
properly as per battery level. If motor power(speed) value is too high, your car might
run too fast and easy to get out of track. If motor power(speed) is too low, the car
might not even move.
To adjust the motor power value, you need change the 3 constants : MID_SPEED,HIGH_SPEED,LOW_SPEED in line 13,14,15 in mecanum-2560-lesson3.ino sketch file. Theirdefault values are 70,80,60 which are good when batteries are fully charged.
After batteries are running low, you might need to increase the value of these 3
constants. You can gradually add or reduce 10 each time on these values and compare which
values have best tracking performance.

- 24 -

Lesson 4 Bluetooth Controlled Imitation Driving

Mecanum Omni wheel is a very powerful wheel technology which allows robot car make omni-directional
movement( 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.

OSOYOO Mecanum Wheels Robotic Car Chassis x 1 (2x left-wheels/2x right-wheels and 4x motor)
OSOYOO Mega2560 board fully compatible with Arduino
OSOYOO V1.0 Wifi Shield x 1
OSOYOO Model X motor driver x 2
OSOYOO HC02 bluetooth module
OSOYOO Battery box x 1
18650 Batteries(3.7V) x 2

You must complete lesson 1 (assembling the car) before you continue on with this lesson.No need change
anything, just keep the hardware wire connection as it is.

STEP1: Connect B_TX and B_RX to D19 and D18.
(Note: You need split 2 pcs of male-to-female jumper wires from our 10-pc jumper wire bundle. Any color fromthe bundle will be ok. The rest of 8 pcs wires are as spare parts for potential broken or damaged wires.)- 25 -

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

Open-source
ArduinoSoftware(IDE)

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

7 zip is afree 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 http://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal2560-lesson4.zip , unzip the download zip file lesson4.zip, you will see a folder called
lesson4 .
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.

- 26 -

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

Mobile APP:

- 27 -

iPhone: Go to Apple APP store and search APP name “OSOYOO imitation driving”, Download the APP as following
and install it in your smart phone.
Android cell phone: please Download the APP from following link :https://osoyoo.com/driver/v1car.apk.

Power on the robot, and open APP.
(1) If you have not paired Bluetooth module with your cell phone, please pair the bluetooth module first before
open the APP. In your cell phone Setting->Bluetooth ,find a Bluetooth device called HC02, pair it withpassword 1234.
(2) After bluetooth HC02 device is paired, open the APP. If you are using Android APP, ClickBT Search Button toconnect APP to HC02 device, if it is iOS APP, just click connect.
(3) Click Engine Switch to start/stop the car.

- 28 -

(4) Click Speed +/- button to accelerate or reduce speed.
(5) Rotate the mobile phone to change direction(steering wheel will rotate while you are turning the phone).
(6) click Gear button to change gear to Forward or Backward direction.
(7)press F1 to Shift to left way, F5 to shift to right way, F3 to up left diagonal, F4 to up right diagonal.

Motor Speed Tuning for better performance
To get better running performance result, motor power (speed) value should be adjusted properly as per battery
level. If motor power (speed) value is too high, your car might run too fast and easy to out of control. If motor
power (speed) is too low, the car might not even move.
To adjust the motor power value, you need change the 3 constants line 27, 28, 29 in mecanum-2560-lesson4.ino
sketch file:#define MIN_SPEED 50#define TURN_SPEED 70#define SLOW_TURN_SPEED#define BACK_SPEED 60

50

MIN_SPEED is the minimum power required to start the car. If when APP engine toggle is switched to RED, but
your car does not move, you need increase this value , if the car runs too fast at engine start moment, you need
reduce this value.
TURN_SPEED AND, SLOW_TURN_SPEED value determines the turning speed of your car. If your car turning too
fast, you need reduce these two values, if turning too slow or not turning, increase these two values. Always
make SLOW_TURN_SPEED about 20 to 30 lower than TURN_SPEED value.
BACK_SPEED value determines the reverse back running speed.
After batteries are running low, you might need to increase the value of these 3 constants. You can gradually
add or reduce 10 each time on these values and compare which values have best tracking performance.

- 29 -

Lesson 5 Wifi Controlled Robot Car

In this project we will connect Robot Car to Wifi and Use an APP to control the car through Internet. This is atypical Internet of Things(IoT) Application.

OSOYOO Mecanum Wheels Robotic Car Chassis x 1 (2x left-wheels/2x right-wheels and 4x motor)
OSOYOO Mega2560 board fully compatible with Arduino
OSOYOO V1.0 Wifi Shield x 1
OSOYOO Model X motor driver x 2
OSOYOO Battery box x 1
18650 Batteries(3.7V) x 2

If you just finishes all lesson 1 (assembling the car) and lesson 4( bluetooth imitation driver), please keep all
lesson connections same as it is. Then plug out bluetooth from Wifi Shield.

Remove the connection B_TX to D18 and B_RX to D19.
Connect E_RX to D18(TX1) and E_TX to D19(RX1).
(Note: You need split 2 pcs of male-to-female jumper wires from our 10-pc jumper wire bundle. Any color fromthe bundle will be ok. The rest of 8 pcs wires are as spare parts for potential broken or damaged wires.)- 30 -

Open-source
ArduinoSoftware(IDE)

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

7 zip is afree 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 from https://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.

Step 3: APP installation-you need search “OSOYOO Wifi UDP Robot Car Controller ” in Google Play orApple Store, and then install this APP.

- 31 -

DOWNLOAD APP FROM https://osoyoo.com/driver/arduino-udp/udp-robot.apk

Step 4:Arduino Sketch code Installation:
Robot Car can work in two Wifi modes:AP mode and STA mode. The Arduino sketches for these two modes aredifferent. Let’s explain these two modes one by one as following:

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) Please download sketch from following link:
http://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal-2560-lesson5A.zip.
Unzip the file and you will see a folder named metal-2560-lesson5A, load the code into Arduino.

- 32 -

(2) (2) Open your Arduino Serial monitor and set 9600 baud, then 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. This means your Robot
car has a Wifi Hot Spot name “osoyoo_robot” , its IP address is 192.168.4.1, port No.8888(3) Now your Robot car become a Wifi Hot Spot and set IP address as “192.168.4.1” to your APP Setting section.
Port number keep default value 8888

- 33 -

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

(5)You can click the “< " ">” ” ^” ” v ” direction keys to make the car move. Use “||” pause key to stop thear
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.

In STA mode, robot car does not work as a wifi hotspot. Instead, it will become an internet node in your LAN.
You need tell Arduino sketch what is your local router’s Wifi SSID and password, then Arduino talks to routerand get its own LAN IP address from DHCP server. You can use Mobile APP to access the robot car’s IP addressand control its movement.
(1) Please download STA mode sketch code fromhttp://osoyoo.com/driver/mecanum_metal_chassis/for_mega2560/metal-2560-lesson5B.zip
Unzip the file and you will see a folder named metal-2560-lesson5B, then load the metal-2560-lesson5B.ino
code into Arduino- 34 -

(2) You need change the code Line 176 and Line 177 :char ssid[] = “YOUR_ROUTER_SSID”; // replace this with your router wifi SSID
char pass[] = “YOUR_ROUTER_WIFI_PASSWORD”; // replace with your wifi password- 35 -

(2)Upload the sketch to Arduino. Finally, click the Serial monitor window in upper right corner 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 my 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 (noneed change default port 80 in APP).

- 36 -

(5)Now your Robot car is connected to your LAN, you can use Mobile phone under same LAN to control therobot 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 “< " ">” ” ^” ” v ” direction keys to make the car move. Use “||” pause key to stop 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- 37 -