|Buy from US||Buy from UK||Buy from DE||Buy from IT||Buy from FR||Buy from ES||Buy from JP|
In this lesson, you must complete lesson 1 before you continue on with this lesson. we use the ultrasonic module to “see” obstacle and measure the distance. If the distance is less than pre-defined threshold value, the car will turn around from the obstacle automatically.
OSOYOO Mecanum Wheels Robotic Car Chassis x 1 (2xleft-wheels/2xright-wheels and Motor x 4)
OSOYOO Mega2560 board fully compatible with Arduino x 1
OSOYOO V1.0 Wifi shield x 1
OSOYOO Model X motor driver x 2
OSOYOO MG90 servo motor x 1
OSOYOO Ultrasonic sensor module x1
OSOYOO Mount holder
OSOYOO Battery box x 1
18650 Batteries(3.7V) x 2
You must complete lesson 1 (assembling the car) before you continue on with this lesson.In this lesson3, we will add a servo motor and to the robotic car built in Lesson 1.
STEP1: Install bracket (from servo motor package) on mount holder for Ultrasonic Module with 2pcs M1.5*6 Self Tapping Screws.
STEP2: Install Ultrasonic Module to mount holder with 4pcs M1.4*8 screw and M1.4 nuts
STEP3: Remove screws on copper pillars and install servo motor at the front of upper car chassis with 2pcs M2.2*8 Self Tapping Screws.
Step 4: Install mount holder for Ultrasonic Module on servo motor with M2*4 Self Tapping screw. (Please note: please upload code to adjust servo motor direction before fixing this screw)
If you just finishes Lesson 1, please keep all lesson 1 connections same as it is.
STEP5:Connect Servo 3-pin head to any Model X board servo slot(yellow to S pin, red to 5v,brown to G pin), then connect another S pin to Wifi board D13.
STEP6:Connect Ultrasonic sensor module to wifi board as following graph.
|Download Arduino IDE here:
|7 zip is a free zip
utility that un-zips zip files
|Download 7zip here for free
Step 1: 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.
Step 2: Download https://osoyoo.com/driver/mecanum/mecanum-2560-lesson2.zip , unzip the download zip file lesson2.zip, you will see a folder called lesson2 .
Step 3: Connect mega2560 board to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose code “lesson2.ino” in lesson folder, load the code into arduino as following:
Step 4: Choose corresponding board/port for your project,upload the sketch to the board.
Step 5:Ultrasonic sensor servo initial direction alignment
After turning on the battery, the servo will make some movement and finally stops at a direction for 5 seconds. During this first 5 seconds, you must make sure the Ultrasonic sensor(two eyes) is facing straight forward.
If it is not straight forward, you should turn off battery immediately and remove the sensor from servo, reinstall it and make it facing straight forward direction as following picture.
Otherwise the obstacle avoidance program will not work properly. After adjusting sensor direction, turn on battery again. If its direction is not straight forward, turn off battery and do direction alignment again.
If the ultrasonic module turn to front view position, that means you no need adjust sensor position anymore. Just wait 5 seconds. If no obstacle is detected, the car will go forward. If any obstacles is detected, the car will stop, the ultrasonic module will turn from right to left to detect surrounding obstacle.
The robot car will decide to make left turn, right turn or backward according to obstacle sensor data and our obstacle avoidance algorithm. Sometimes your car might have collision and make your Ultrasonic sensor position change, you must remember to do sensor direction alignment again.
DownLoad Url osoyoo.com