In this lesson, we’ll introduce the installation of the basic framework of the new 2WD robot car. The basic framework includes chassis, motors, Arduino UNO board, motor control module and power supply.  After assembly of the basic framework, we will load some sample code  into UNO board and make the car to do some simple movements.

Parts and Devices




Car Chassis
Motors with wires

Universal Wheel

1 M3*12 Double Pass Copper Pillar x 4

M3*5 Screw x 8

Box for 18650 3.7V battery+
                  1 M3*10 Screw  x 4

M3*10 Nut  x 4

Arduino UNO R3
   1 M3*6 Plastic Screw  x 3

M3 Plastic Nut  x 4

M3*5+6 Plastic Pillar x 4

OSOYOO Model-X Motor Driver Module
   1 M3*6 Plastic Screw  x 4

M3 Plastic Nut  x 4

M3*5+6 Plastic Pillar x 4

Arduino UNO Sensor Expansion Board  V5.0
DC Power Connector
Cross screwdriver
Straight screwdriver
 Jumper wires(male-male,male-female)   some

Hardware Installation

Remove the protective film from the chassis.

Please pay attention: 

The chassis has front side and back side, please pay attention to the front side as the picture shows:

1 Motors


  • M3*30 Screw x4
  • M3 Nut x4

Connect 2 motors on the chassis with screw M3*30 screws and nuts

2 Universal Wheel and Wheels


  • M3*12 Double Pass Copper Pillar x 4
  • M3*5 Screw x 8

Install the wheel on the chassis with M3*12 Double Pass Copper Pillars and M3*5 Screws(please install the Copper Pillar on the chassis first), then install the two wheels into the motors.

3 Battery Box


  • M3*10 Screw  x 4
  • M3*10 Nut  x 4

Fixed the battery box on the surface of the chassis with the M3 screws and nuts


4 OSOYOO Model-X Motor Driver Module


  • M3*6 Plastic Screw  x 4
  • M3 Plastic Nut  x 4
  • M3*5+6 Plastic Pillar x 4

Fixed the OSOYOO Model-X motor driver module on the surface of the chassis with the M3 screws and nuts


5 Arduino UNO


  • M3*6 Plastic Screw  x 3
  • M3 Plastic Nut  x 4
  • M3*5+6 Plastic Pillar x 4

Fixed the Arduino UNO board on the surface of the chassis with the M3 screws and nuts


6 Arduino UNO Sensor Expansion Board  V5.0

Plug the Arduino UNO Sensor Expansion Board  V5.0 into Arduino UNO R3

7 Wire Connection

1)Connect the UNO board, battery box and OSOYOO Model-X according to the following connection diagram:

The wire should in the up side of the DC power connector as picture show:

More detail about OSOYOO Model-X please refer to this link:

L298NPro motor driver module

2) Connect the OSOYOO Model-X and Arduino UNO Sensor Expansion Board  V5.0

as shown below:

Arduino Sensor Shield v5.0 OSOYOO Model-X
S7 IN1
S8 IN2
S9 IN3
S10 IN4

If  you want to connect only with the Arduino UNO, you can follow this diagram:

Arduino UNO OSOYOO Model-X
D7 IN1
D8 IN2
D9 IN3
D10 IN4

3)Connect OSOYOO Model-X Motor Driver Module K1 to N4 sockets to 4 motors

The right motor connected to K1 or K2, the left motor connected to K3 or K4 as shown below:

Now hardware installation is almost done. Before we install 18650 batteries into the box, we need burn the sample code into Arduino first.

Software Installation

Step 1:

Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip this step).

Download Arduino IDE from, then install the software.

Step 2:

Download , unzip it, you will see a folder called lesson-1

Step 3:

Connect UNO R3 board to PC with USB cable, open Arduino IDE, choose corresponding board/port for your project

Step 4:

Click file -> click Open -> choose code “lesson-1.ino”, load the code into Arduino, and then upload the sketch to the board.

Code Explanation:

Below is the interface definition between OSOYOO Model-X and arduino

Notice: ENA and ENB should connect to PWM port,  D3, D5, D6, D9, D10, D11 of   Arduino have the PWM output function.

  1. #define IN1 7 //K1、K2 motor direction
  2. #define IN2 8 //K1、K2 motor direction
  3. #define IN3 9 //K3、K4 motor direction
  4. #define IN4 10 //K3、K4 motor direction
  5. #define ENA 5 // Needs to be a PWM pin to be able to control motor speed ENA
  6. #define ENB 6 // Needs to be a PWM pin to be able to control motor speed ENA

The below functions can control the car forward, backward, stop, turn right and turn left:

  1. void go_ahead() //motor rotate clockwise -->robot go ahead
  2. {
  3. digitalWrite(IN1, LOW);
  4. digitalWrite(IN2, HIGH);
  5. digitalWrite(IN3, LOW);
  6. digitalWrite(IN4,HIGH);
  7. }
  8. void go_back() //motor rotate counterclockwise -->robot go back
  9. {
  10. digitalWrite(IN1, HIGH);
  11. digitalWrite(IN2, LOW);
  12. digitalWrite(IN3, HIGH);
  13. digitalWrite(IN4,LOW);
  14. }
  15. void go_stop() //motor brake -->robot stop
  16. {
  17. digitalWrite(IN1, LOW);
  18. digitalWrite(IN2, LOW);
  19. digitalWrite(IN3, LOW);
  20. digitalWrite(IN4,LOW);
  21. }
  22. void turn_right(int t) //left motor rotate clockwise and right motor rotate counterclockwise -->robot turn right
  23. {
  24. digitalWrite(IN1, HIGH);
  25. digitalWrite(IN2, LOW);
  26. digitalWrite(IN3, LOW);
  27. digitalWrite(IN4, HIGH);
  28. delay(t);
  29. }
  30. void turn_left(int t) //left motor rotate counterclockwise and right motor rotate clockwise -->robot turn left
  31. {
  32. digitalWrite(IN1, LOW);
  33. digitalWrite(IN2, HIGH);
  34. digitalWrite(IN3, HIGH);
  35. digitalWrite(IN4, LOW);
  36. delay(t);
  37. }

The below functions can change motor speed, viriable lspeed can change the left motor speed, variable rspeed can control the right motor speed.

The valid range for this function parameter is 0-255

  1. void set_motorspeed(int lspeed,int rspeed) //change motor speed
  2. {
  3. analogWrite(ENA,lspeed);//lspeed:0-255
  4. analogWrite(ENB,rspeed);//rspeed:0-255
  5. }


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 following instruction:

Put the car on the ground, open the power switch in the battery box, the car should go forward 2 seconds, then go backward 2  seconds, then left turn for 2 seconds, then right turn for 2 seconds, then stop.

If the car does not move as per above mentioned result, you should check your wire connection, battery voltage(must over 7.2v).

Leave a Reply

WordPress spam blocked by CleanTalk.
Bombax Theme designed by itx