In this project, we will use obstacle sensor(ultrasonic distance detector) to detect obstacles ,avoid collision and auto-drive.
Install the smart car basic frame work as per Lesson 21， If you have already completed installation in Lesson 21 , just keep it as is.
Step 1:Remove screws on copper pillars and install servo motor at the front of car chassis with 2pcs M2.2*8 Self Tapping Screws.
Step 2:Install bracket (from servo motor package) on mount holder for Ultrasonic Module with 2pcs M1.5*4 Self Tapping Screws
Step 3: Install Ultrasonic Module to mount holder with 4pcs M1.4*8 screw and M1.4 nuts.
Step 4: Install mount holder for Ultrasonic Module on servo motor with M2*4 Self Tapping screw.
Step 5:If you have already completed wire connection installation in Lesson 21 , just keep it as is.
Then Connect SG90 servo motor to OSOYOO to the D3 port of the Magic I/O shield as following graph.
Step 6:Then connect the Ultrasonic module sensor to the D7D8 port of the Magic I/O shield with a 4-pin PNP cable as below:
After above installations are completed, connect the アルドゥイーノboard to your computer using the USB cable. The green power LED (labelled PWR) should turn on.
You can download the code directly, then click “Open” in Mixly to choose the code you download：
Or you can do as following operations:
Open the Graphical Programming software Mixly and do following graphic operations. Finally, Save and upload program to アルドゥイーノboard.
Adjust the Ultrasonic Sensor direction:
After the code is loaded into robot car, unplug the USB cable from the UNO board and turn on the power switch on the Magic I/O board. Then the ultrasonic sensor will rotate to face the straight forward direction for 5 seconds. If the Ultrasonic sensor is not facing the front position, please turn off the power. Please use a screw driver to adjust the ultrasonic sensor direction and make it facing straight ahead , then turn on the power again and during the early 5 seconds, the sensor should be facing front direction.
After the 5 seconds , the robot car will start to drive and change direction to avoid obstacles automatically.
DownLoad Url osoyoo.com