http://osoyoo.com/?p=9847
|
Objective
|
|
Device Name
|
picture
|
qty
|
Screw Number |
|
Arduino UNO
|
1
|
M3 x 10 Screws and nuts, washer | |
|
Motor with wires
|
4
|
M3 x 30 Screws and nuts | |
|
L298N MOTOR driver module
|
1
|
M3 x 10 Screws and nuts, washers | |
|
Box for 18650 3.7V battery+
|
1
|
M3 x 10 Screws and nuts | |
|
DC power connector
|
1
|
||
|
voltage meter
|
1
|
M3 x 10 Screws and nuts, washers | |
|
SG90 Servo Motor
|
1
|
M3 x 10 Screws and nuts, washers | |
|
Ultrasonic module
|
1 | M1.5 x 12 Screws and nuts | |
|
Buzzer Module
|
1
|
M3 x 10 Screws and nuts, washers | |
|
Mount holder for Servo motor
|
1
|
M2 x 10 Screws, screws for sg90 | |
|
Jumper wires(male-female,female-female)
|
some
|
||
|
upper chassis
|
1
|
Copper pillar | |
|
lower chassis
|
1
|
Copper pillar |
1) Regarding how to install chassis, arduino and motors, please refer to Lesson 1:
http://osoyoo.com/2017/04/23/arduinosmartcarlesson1/
1) Connect the SG90 servo motor to the holder with screw M2 x 10
2) Connect the servo motor arm to brakect with 2 x screws which comes with the servo motor, Connect the Ultrasonic Module to bracket with M1.5 x 12 screws and nuts
3)Fix the mount holder for servo motor on upper chassis with M3 x 10 Screws and nuts.
4) Put the arm with ultrasonic module on SG90 servo motor
5) Fix the Buzzer module with M3 X 10 screw and nut on upper chassis.
6)Wiring
Connect the buzzer module, ultrasonic module and servo motor as per below connection diagram:
| Uno R3 Board | Buzzer Module |
| GND | GND |
| 3.3v | VCC |
| I/O | D13 |
| Ultrasonic Module | Uno R3 Board |
| GND | GND |
| Echo | D11 |
| Tr1g | D12 |
| VCC | 5V |
| Uno R3 Board | L298NPro |
| D2 | IN1 |
| D4 | IN2 |
| D5 | ENA |
| D6 | ENB |
| D7 | IN3 |
| D8 | IN4 |
| D9 | S |
| SG90 Servo Motor | L298NPro |
| Brown | GND |
| Red | 5v |
| Yellow | S |
4) Software
The SG90 Servo can rotate approximately 180 degrees. Firstly we make the servo motor go to 90 degree position(middle position), then manually adjust the ultasonic sensor to straight forward direction. Thus to make sure the ultrasonic module can rotate to the left 90 degrees and also can rotate to the right 90 degrees. Download the servo adjust program from link:servo_adjust code(Or you can find the code directly from our CD user manual: OSOYOO Robot Car Starter Kit >> Code)
Download and unzip, then upload the code to Uno board using Arduino IDE, turn on the power switch on the battery box. the servo motor will go to 90 degree position(middle position), At this time, if the ultrasonic sensor is not facing front direction of the car, you need manually adjust the sensor to straight forward direction. Then fix the ultrasonic module on sg90 servo motor with M2 x 10 screw
Software Installation:
Step 1:Download Lesson One sample code fromLesson 3 sample code (or you can find the code directly from our CD user manual: OSOYOO Robot Car Starter Kit >> Code) , unzip the download zip file smartcar-lesson3.zip, you will see a folder called smartcar-lesson3 .
Step 2: Connect Arduino UNO to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose code “smartcar-lesson3.ino” in smartcar-lesson3 folder, load the code into arduino.
Step 3: Choose corresponding board/port for your project,upload the sketch to the board.
Final Testing :
Turn on the power switch on the battery box, the ultrasonic module turn to front view position. If no obstacle is detected, the car will go forward. If any obstacles is detected, the car will go backward first, then the ultrasonic module will turn from right to left to detect surrounding obstacle. If obstacle is found on the left, the car will turn right and vice versa. If both right and left side have obstacles, the car will go backward.