Shopify Amazon
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 the framework of Lesson 1, it is very essential to test the installation and sample code in this Lesson properly.
Install 2 motors on the chassis with the motor holders
Notice
Please install it on the side of the motor wires
Keep the end with the screw holes facing up
Install the wheel on the chassis with M3*10 Double Pass Copper Pillars and M3*5 Hex Screws, then install the two wheels onto the motors.
Fixed the OSOYOO UNO board on the surface of the chassis with the M3 screws and nuts
Fixed the OSOYOO Model-X motor driver module on the surface of the chassis with the M3 screws and nuts
Fixed the battery box on the surface of the chassis with the M3 screws and nuts.
:
2. Connect the OSOYOO Model-X and WiFi Shield for Arduino UNO as shown below:
3. Connect OSOYOO Model-X Motor Driver Module with 2 motors
The right motor connected to K1 or K2, the left motor connected to K3 or K4 as shown below:
4. Connect OSOYOO UART Wi-Fi Shield with IR Receiver:
5. Connect OSOYOO UART Wi-Fi Shield with the tracking sensor:
The Lest Tracking Sensor | |
Tracking Sensor | Sensor Shield V5.0 for Arduino UNO |
VCC | 5V |
GND | GND |
DO | S2 |
AO | Not Connected |
The Right Tracking Sensor | |
Tracking Sensor | Sensor Shield V5.0 for Arduino UNO |
VCC | 5V |
GND | GND |
DO | S3 |
AO | Not Connected |
Install latest Arduino IDE (If you have Arduino IDE version 1.18.19, please skip this step).
Download Arduino IDE from https://www.arduino.cc/en/Main/Software?setlang=en, then install the software.
Download https://osoyoo.com/driver/2wd/lesson1.zip , unzip it, you will see a folder called lesson1
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 “lesson1.ino”, load the code into Arduino, and then upload the sketch to the board.
Notice: ENA and ENB should connect to PWM port, IN1/IN2 control Right Motor rotating direction,
IN3/IN4 control Left Motor rotating direction
#define speedPinR 9 // RIGHT PWM pin connect MODEL-X ENA #define RightMotorDirPin1 12 //Right Motor direction pin 1 to MODEL-X IN1 #define RightMotorDirPin2 11 //Right Motor direction pin 2 to MODEL-X IN2 #define speedPinL 6 // Left PWM pin connect MODEL-X ENB #define LeftMotorDirPin1 7 //Left Motor direction pin 1 to MODEL-X IN3 #define LeftMotorDirPin2 8 //Left Motor direction pin 1 to MODEL-X IN4 #define SPEED 140 #define RIGHT_SPEED 140
void go_Advance(void) //Forward { digitalWrite(RightMotorDirPin1, HIGH); digitalWrite(RightMotorDirPin2,LOW); digitalWrite(LeftMotorDirPin1,HIGH); digitalWrite(LeftMotorDirPin2,LOW); analogWrite(speedPinL,SPEED); analogWrite(speedPinR,SPEED); } void go_Left(int t=0) //Turn left { digitalWrite(RightMotorDirPin1, HIGH); digitalWrite(RightMotorDirPin2,LOW); digitalWrite(LeftMotorDirPin1,LOW); digitalWrite(LeftMotorDirPin2,HIGH); analogWrite(speedPinL,SPEED); analogWrite(speedPinR,SPEED); delay(t); } void go_Right(int t=0) //Turn right { digitalWrite(RightMotorDirPin1, LOW); digitalWrite(RightMotorDirPin2,HIGH); digitalWrite(LeftMotorDirPin1,HIGH); digitalWrite(LeftMotorDirPin2,LOW); analogWrite(speedPinL,SPEED); analogWrite(speedPinR,SPEED); delay(t); } void go_Back(int t=0) //Reverse { digitalWrite(RightMotorDirPin1, LOW); digitalWrite(RightMotorDirPin2,HIGH); digitalWrite(LeftMotorDirPin1,LOW); digitalWrite(LeftMotorDirPin2,HIGH); analogWrite(speedPinL,SPEED); analogWrite(speedPinR,SPEED); delay(t); } void stop_Stop() //Stop { digitalWrite(RightMotorDirPin1, LOW); digitalWrite(RightMotorDirPin2,LOW); digitalWrite(LeftMotorDirPin1,LOW); digitalWrite(LeftMotorDirPin2,LOW); }
void set_Motorspeed(int speed_L,int speed_R) { analogWrite(speedPinL,speed_L); analogWrite(speedPinR,speed_R); }
Disconnect Arduino from PC, put 2 fully-charged 18650 battery into battery box (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:
Put the car on the ground, open the power switch on the battery box, open the power switch on the Wi-Fi Shield.
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.
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 |
DownLoad Url osoyoo.com