Buy from US | Buy from UK | Buy from DE | Buy from IT | Buy from FR | Buy from ES |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Welcome to the first lesson of OSOYOO 2WD Robot Car Starter Kit!
In this “Hello World” version lesson, we will install the most important framework of the robot car and program the car to do some simple movements. If you have passed the test movement of this lesson, it means Arduino, motor control module, motors, batteries, chassis and wire connections between these parts are all functioning well.
As your experiments in future lessons are all based on frame work of Lesson 1, it is very important to
test the installation and sample code in this Lesson properly.
Install 2 motors on the chassis with the motor holders
Install the wheel on the chassis with M3*10 Double Pass Copper Pillars and M3*5 Screws(please install the Copper Pillar on the chassis first), then install the two wheels onto the motors.
Fixed the battery box on the surface of the chassis with the M3 screws and nuts , please note that battery is not include,
battery height should ≤ 67 mm.
Fixed the OSOYOO Model-X motor driver module on the surface of the chassis with the M3 screws and nuts
Fixed the OSOYOO UNO board on the surface of the chassis with the M3 screws and nuts
Plug the Sensor Shield V5.0 for Arduino UNO into OSOYOO UNO R3
The wire should in the up side of the DC power connector as picture show:
Sensor Shield V5.0 for Arduino UNO | OSOYOO Model-X |
S5 | ENA |
S6 | ENB |
S7 | IN1 |
S8 | IN2 |
S9 | IN3 |
S10 | IN4 |
OSOYOO UNO | OSOYOO Model-X |
D5 | ENA |
D6 | ENB |
D7 | IN1 |
D8 | IN2 |
D9 | IN3 |
D10 | IN4 |
The right motor connected to K1 or K2, the left motor connected to K3 or K4 as shown below:
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.
Download lesson-1.zip , unzip it, you will see a folder called lesson-1
Connect UNO R3 board to PC with USB cable, open Arduino IDE, choose corresponding board/port for your project
Click file -> click Open -> choose code “lesson-1.ino”, load the code into Arduino, and then upload the sketch to the board.
Notice: ENA and ENB should connect to PWM port, D3, D5, D6, D9, D10, D11 of Arduino have the PWM output function.
#define IN1 7 //K1、K2 motor direction #define IN2 8 //K1、K2 motor direction #define IN3 9 //K3、K4 motor direction #define IN4 10 //K3、K4 motor direction #define ENA 5 // Needs to be a PWM pin to be able to control motor speed ENA #define ENB 6 // Needs to be a PWM pin to be able to control motor speed ENA
void go_ahead() //motor rotate clockwise -->robot go ahead { digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); digitalWrite(IN3, LOW); digitalWrite(IN4,HIGH); } void go_back() //motor rotate counterclockwise -->robot go back { digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); digitalWrite(IN3, HIGH); digitalWrite(IN4,LOW); } void go_stop() //motor brake -->robot stop { digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4,LOW); } void turn_right(int t) //left motor rotate clockwise and right motor rotate counterclockwise -->robot turn right { digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH); delay(t); } void turn_left(int t) //left motor rotate counterclockwise and right motor rotate clockwise -->robot turn left { digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); delay(t); }
void set_motorspeed(int lspeed,int rspeed) //change motor speed { analogWrite(ENA,lspeed);//lspeed:0-255 analogWrite(ENB,rspeed);//rspeed:0-255 }
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).
DownLoad Url osoyoo.com