Lesson 1 Make The Car Move
Lesson 1 Make The Car Move
com
Preparations:
One car (with a battery)
Tips: If you have any questions or run into any problems during assembling and testing Smart Robot Car please feel free to contact us at
[email protected] or [email protected] (Europe customers).
Http://www.elegoo.com
This kit is an extremely flexible vehicular kit particularly designed for education,
competition and entertainment purposes. The upper panel of the kit is directly
compatible with 9-gram steering engine. It also carries supersonic sensor, battery
and other fixed holes to facilitate installation of various sensors. This is a very
funny and versatile robot that meets learning and production purposes. With it,
you can implement diverse interesting ideas, such as Bluetooth and infrared
Let’s describe the small vehicle that will accompany us for a long time in the
future.
Tips: If you have any questions or run into any problems during assembling and testing Smart Robot Car please feel free to contact us at
[email protected] or [email protected] (Europe customers).
Http://www.elegoo.com
1. Battery holder with a switch: provide power supply for the vehicle
2. Electric motor + wheel: drive the vehicle to move
3. acrylic plate: the frame of the car
4. L298N motor driving board: drive the motor to rotate
5. UNO controller board: the brain of the car, controls all the parts
6. V5 sensor expansion board: combined with the UNO, make connection become more easier
7. Servo and cloud platform: enable the GP2Y0A21 distance sensor to rotate 180 degrees
8. Ultrasonic sensor module: distance measurement and obstacle avoidance
9. Line tracking module: black and white sensor for recognition of the white and black lanes
10. Infrared receiver and remote control: provide the infrared remote control function
11. Bluetooth module: provide the Bluetooth control function
Tips: If you have any questions or run into any problems during assembling and testing Smart Robot Car please feel free to contact us at
[email protected] or [email protected] (Europe customers).
Http://www.elegoo.com
Ⅱ. Upload program
Because we have uploaded the program to the car in Lesson 0 ,now,you can turn on the power
switch and put the car on the ground. Then you will see the car moving.
Tips: Before turning on the power switch, check whether the battery is fully charged. If the battery
is low, charge it in time. In the charging process, the charger shows a red LED indicates that the
battery is not fully charged, the charger shows a blue LED indicates that it is fully charged.
Ⅲ. Description of Principles
0 X X STOP
1 0 0 BRAKING
1 1 0 FORWARD
1 0 1 BACKWARD
1 1 1 BARKING
TIPS:
When uploading codes, please remove the Bluetooth module from the IO expansion board
(because the serial port for uploading codes and Bluetooth communication is
the same one and there will be conflicts).
You can mount the Bluetooth module after the upload.
before you upload program you should make sure your com is right and click on upload.
Tips: If you have any questions or run into any problems during assembling and testing Smart Robot Car please feel free to contact us at
[email protected] or [email protected] (Europe customers).
Http://www.elegoo.com
We will try to move the motor without speed controlling. Because it is easy to write program without
speed controlling.
First of all, let's see the connection of the motor the L298N board, we will use Arduino 5, 6, 7, 8, 9, 11
pins to control the car. 9 and 11 pins control the right wheel. 7 and 8 pins control the left wheel. 5 and
6 pins control ENA and ENB.
Based on the sheet given above, we first design a simple program to make the right wheel turn 0.5s in
positive direction, stop 0.5s, turn 0.5s in negative direction and stop 0.5s. And the wheel will repeat
the reaction.
Connect the UNO controller board to the computer, open the code file in the path “\Lesson 1 Make
The Car Move\right_wheel_rotation\ right_wheel_rotation.ino”. Upload the program to the UNO
board.
Disconnect it from the computer, and then switch on the car’s power supply. You will see that the right
wheel moves as you expected.
If the car is not moving, press the reset button on the UNO board.
If the moving direction of the motor is different from the direction you set, you can change the
connection of black and red lines from the motor to L298N board.
Tips: If you have any questions or run into any problems during assembling and testing Smart Robot Car please feel free to contact us at
[email protected] or [email protected] (Europe customers).
Http://www.elegoo.com
Disconnect it from the computer, and then switch on the car’s power supply. You will see that the right
wheel moves as you expected.
After finishing debugging the car, you can write programs to make the car move.
Below is the way how car moves:
CAR forward back stop
Left wheel Forward back stop
Right wheel Forward back stop
Connect the UNO controller board to the computer, open the code file in the path “Lesson 1 Make
The Car Move\forward_back\forward_back.ino”. Upload the program to the UNO board.
Upload the program to the UNO board, disconnect it from the computer, and then switch on the car’s
power supply. You will see that the right wheel moves as you expected.
Tips: If you have any questions or run into any problems during assembling and testing Smart Robot Car please feel free to contact us at
[email protected] or [email protected] (Europe customers).
Http://www.elegoo.com
It may be a difficult for you to write the whole program to make the car move automatically. So we
separate the movements into different function, for example moving forward and turning left. And
when we write the program in the final step, we can call the function.
Next, we begin to write programs for each movement:
We start to write program to make the car move automatically: go forward 0.4s - back up 0.4s - turn
left 0.4s - turn right 0.4s.
Connect the UNO controller board to the computer, open the code file in the directory “Lesson 1
Make The Car Move\AUTO_GO_\ AUTO_GO_.ino”. Upload the program to the UNO board.
Disconnect it from the computer, and then switch on the car’s power supply. You will see that the
wheel moves as you expected.
The code to achieve the function is to control the speed of the car: go forward and reduce the speed
stop 1s running back and accelerate stop 2s.
Connect the UNO controller board to the computer, open the code file in the directory “Lesson 1
Make The Car Move\speed_control\ speed_control.ino”. Upload the program to the UNO board.
Tips: If you have any questions or run into any problems during assembling and testing Smart Robot Car please feel free to contact us at
[email protected] or [email protected] (Europe customers).
Http://www.elegoo.com
The code to achieve the function is to control the speed of the car and you can set the speed you like
to change the value of CAR_SPEED
Connect the UNO controller board to the computer, open the code file in the directory “Lesson 1
Make The Car Move\speed_control\ car_control.ino”. Upload the program to the UNO board.
http://www.elegoo.com
2019.7.15
Tips: If you have any questions or run into any problems during assembling and testing Smart Robot Car please feel free to contact us at
[email protected] or [email protected] (Europe customers).