Introduction: Arduino Tank Car Lesson 2- Electronic Parts Installation and Simple Test

About: Osoyoo brand products are mainly focused on STEM education.User experience and customer feeling are always our first priority. Our goal is to create the best designed product to help students and hobbyist to e…

In this lesson, we will install the most important framework in the tank car and program the car to do some simple movements. If you have passed the test movement in this lesson, it means Arduino UNO board, voltage meter,motor control driver module, motors, batteries,chassis and wire connections between these parts are all functioning well.
As your experiments in future lessons are all based on frame work of Lesson 1 and lesson 2, it is very important to test the installation and sample code in this Lesson properly.

Detailed Tutorials:

Robot Car Platform Tank Chassis:

Complete Arduino Robot Car KitBuy it for USA :

Step 1: Hardware Installation

I. Adjust the sensitivity of tracking sensor and Install the tracking sensor.

Before assemble the control board, we need to adjust the sensitivity of tracking sensor. Connect expansion board to tracking sensor as the following graph. Put the expansion board on UNO R3 board and connect Arduino UNO to PC with USB cable.Then adjust the potentiometer on the tracking sensor with cross screwdriver until you get the best sensitivity status: the signal indicate LED light will turn on when sensor is above white ground, and the signal LED will turn off when the sensor is above black track.

II.Install electronic board on tank car chassis

(1)Install Arduino UNO,Expansion board,Driver board,Voltage meter and Buzzer Module on upper acrylic chassis with M3 x 10 philip’s head screws, Install IR receiver with M2.5*8 philip’s head screws.

Install the ultrasonic sensor on black acrylic board with M1.6*12 philips head screws, then install it on servo arm with philip’s head sharp screws.

(2) Assemble the Neccessary Components

Install the LED lights and tracking sensors on tank chassis;

Install the SG90 servo motor and ultrasonic sensor with M2.5*8 philip’s head screws.

Install the acrylic board on tank car chassis with PCB spacers.

Install the battery box on tank car chassis with M3*10 philip’s head screws.

(3)Connection Diagram

Connect Driver board K1 (or K2) and K3 (or K4) sockets to 2 motors as per the following graph.

Connect the 2 LED light to expansion board as per the following graph.

Connect the right and left tracking sensors as the following graph.

Tracking Modules-ESP8266

Connect the Uno board, battery box, Voltage Meter and driver board according below connection diagram.

Battery box-UNO

Connect Voltage Meter to driver board as below connection diagram.

L298N-voltage meter

Connect buzzer sensor, IR receiver,Ultrasonic Sensor and SG90 servo motor to driver board as below connection diagram.




SG90 Servo-L298N

Connect D5,D6,D8,D9,D10,D12 Pins to driver board 6 control pins as per following graph (these pins are defined in sample code configuration.h file)

L298N-esp8266 wifi

Now hardware installation is almost down, you need to put the 18650 batteries inside the holder.Both flat top and button top 18650 battery can be put inside the holder. The button top battery is recommend because it is easier to figure out positive pole of the battery.If you buy flat top battery, you must make sure the positive pole of the battery is put on the + side of the holder.if you make put battery on wrong direction, it will damage the car.Before we install 18650 batteries into the box, we need burn the sample code into Arduino First.

Step 2: Software Installation

Step 1: Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip this step)Download Arduino IDe from , then install the software.

Step2 :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. Find the file in Tutorial/Lesson2/Code or download the servo adjust program from link:

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.

Step 3: Download the libraries from open arduino IDE -> click sketch -> Include Libraries->Add .zip Libraries -> choose zip file “”-> Upload the .zip files

Step 4: Download Lesson One sample code from , unzip the download zip file, you will see a folder called tank_robot_lesson2 . Step 5: Connect Arduino UNO to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose code “tank_robot_lesson2.ino” in tank_robot_lesson2 folder, load the code into arduino.

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

Step 3: Testing

Connect Arduino from PC, put 2 fully-charged 18650 battery into battery pox(check the box instruction and make sure polar direction is correct). Open the power switch in the box and open arduino IDE, set the buat rate as 9600. You will find the information as follows:

welcome to use kookye tank robot car…send :line follow sensorsend :turn on LEDsend :

turn off LEDsend : test servo

send : test HC-SR04

send : test buzzersend : test robot go ahead

send : test robot go back

send : test robot stop

When you put the car on the ground and send “line follow sensor”, the signal indicate LED light will turn on

when sensor is above white ground, and the signal LED will turn off

when the sensor is above black track.

When you send “turn on LED”, the LED light on car should turn on. “turn off LED”, the LED light should turn off.

When you send servo, the SG90 servo motor should move.

When you send buzzer, the buzzer should beep.

When you send go ahead, it should go forward;send go back,it should go backward;send stop,it should stop.

If the car does not move as per above mentioned result, you should check your wire connection, battery voltage(must over 7.2v).