AMAZON
AMAZON-jp
amzuk

Objective:

In this lesson, we will show how two Osoyoo Robot Car fight against each other. In order to play the game, you need buy at least two sets of Osoyoo Robot Cars.
Parts and Devices:
Mount holder for Servo motor

Device Name
picture
qty
Screw Number
ESP8266 expansion board
1
Bluetooth module
1
Lower chassis
1
M3*5 screw x5
Copper pillar x5
Upper chassis
1
M3*5 screw x5
Gear Motor with wires
(Acrylic fastener for Gear Motor x8
Velocity encoder x4)
4
M3*30 screw x8
M3 nuts x8
Wheel
4
UNO R3 board for Arduino with USB cable
1
M3*10 screw x4
M3 nuts x4
Transparent Washer x4
OSOYOO MODEL X motor driver module
1
M3*10 screw x4
M3 nuts x4
Transparent Washer x4
Box for 18650 3.7V battery
1
M3*10 screw x4
M3 nuts x4
DC power connector with wires
1
voltage meter
1
M3*10 screw x2
M3 nuts x2
Transparent Washer x2
IR receiver(VS1838)
1
M2.5*10 screw x2
M2.5 nuts x2
Transparent Washer x2
SG90 servo Motor with blade and screw

1
Fighting GUN(IR LED)
1
M3*10 screw x 1
M3 nut x 1
Buzzer sensor module

1
M3*10 screw x1
M3 nuts x1
Jumper wires(female to female)
some
Jumper wires(male to female)
some
Cross screwdriver
1

Hardware Installation:

If you have completed Lesson 5 installation in https://osoyoo.com/2017/05/14/wifi-control-smart-car/ , please remove the 5 black/white tracking sensors, ultrasonic sensor and the servo platform. You also need add the IR receiver and the fighting gun(IR sender) onto the car. Check following connection graph:

Step 1) Install ESP8266 Expansion Board on UNO R3 board(if you installed lesson 5, skip this step and go to step 2):

Step 2) Connect IR receiver, IR LED(the fighting gun)

Note: If you want control the car through bluetooth, please install bluetooth module on ESP8266

Step 3) Turn the switch of esp8266 to “1.2” position, as following photo shows:

Step 4) Load Sample code in Robot Car DIY Lesson 1 into Arduino Uno

Note: Bluetooth module and Arduino board communicate with each other through UART serial port. Please remove bluetooth module before uploading sketch in Arduino board, otherwise the sketch will be uploaded unsuccessfully.

Step 5) If you want use wifi to control the car, turn the switch of esp8266 to “on” position(as the following picture). If you want use Bluetooth control car, put switch in “1,2” position.

Step 6) Turn on switch in the battery box. If there car can make movement as described in Lesson 1 (go forward 5 seconds, then go backward 5  seconds, then left turn for 5 seconds, then right turn for 5 seconds, then stop), it means wire connection with ESP8266 Expansion Board and R3 UNO board are all correct. Otherwise please check the each Digital Pin connection in ESP8266 Expansion Board and UNO R3.


Software Installation:

Step 1: Before upload code in esp8266, please turn the switch of esp8266 to “1.2” position, as following photo shows:

Step 2: Download Lesson 6 sample code from https://osoyoo.com/driver/fight-robot.zip , unzip the download zip file fight-robot.zip, you will see TWO folders called fight-robot-A and fight-robot-B.

If you have two cars(A and B), car A install the fighter-robot-A.ino code and car B install  the fighter-robot-B.ino file

Step 3: Connect Arduino UNO in car A to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose code “fighter-robot-A.ino” in fighter-robot-A folder,, load the code into arduino.

Step 5: Connect Arduino UNO in car A to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose code “fighter-robot-A.ino” in fighter-robot-A folder,, load the code into arduino.

Step 4: Choose corresponding board/port for your project,upload the sketch to the board.

Note: Bluetooth module and Arduino board communicate with each other through UART serial port. Please remove bluetooth module before uploading sketch in Arduino board, or the sketch will be uploaded unsuccessfully.

Step 5: If you want use wifi to control the car, turn the switch of esp8266 to “on” position(as the following picture) and make sure Bluetooth module is NOT insert into wifi shield.

If you want use Bluetooth control car, put switch in “1,2” position.

Step 6: if you use iphone, please visit :   https://osoyoo.com/2018/08/17/how-to-use-ios-phone-control-the-robort-car/

If  you use Android phone , please download app. in Android phone from the link: https://github.com/osoyoo/driver/master/BTcar_20180607.apk.

Or scan the following QR code with Android phone to download the app.:



Note: Android APP Source codehttps://github.com/osoyoo/driver/master/BTcar_20180607.apk 

Step 7: install App. in your Android phone

Testing:

Step 1:Turn on switch in the battery box

Step 2:If you want to control the robot car through WIFI, please scan WiFi hotspot with your Android  phone which you have installed APP and search for wifi named” DoitWIFI_Config”, Click connect(no password needed).

Step 3: Open app>> select WiFi mode>> then you can controller the robot car through wifi

Step 4: If you want to control the robot car through Bluetooth, please turn on bluetooth of your Android phone which you have installed APP and scan bluetooth(different bluetooth module will scan different bluetooth name), Click connect and enter password “1234” or “0000” if no change (You can change wifi or bluetooth settings in Android phone to switch to control car through wifi or bluetooth):

Step 5) Open app>> select bluetooth mode>> then you can controller the robot car through bluetooth:

There are three working mode: manual control, obstacle avoidance and tracking. Users can switch freely among three working mode.
1) you can click buttons (^) (V) (<) (>) to control the Robot car to move forward and backward, turn right and left. Meanwhile, the APP can observe the car real time movement.

2) To fight against enemy Robot Car, make your car facing to enemy car, Click “| |” button in middle of (<)and (>) buttons, this will shoot IR bullet to enemy. If Enemy’s car is shot by your electronic bullet(IR signal), it will lose control and stop movement. At the same time, the buzzer will alarm.