Hi. My name is Emmanouel and today I am going to share with you, instructions on how to build an Arduino based car using either an available toy car with two main motors (one for steering) and one for the forward/backward motion.
The other classical project is the RC tank. In this case the tank uses both left or right motors for moving and steering. If both right motors move forward and both left motors stay still or move with lower speed then the tank turns right.
In this tutorial we are going to build both a car and a tank.
List of contents
1.Build an Advanced Arduino Tank Car
1.1 Functions
1.2 Components and Parts
1.3 Schematics
1.4 Code
1.5 Android App
2. Step by Step Build Up
2.1 Step 1 Lights Lights and More Lights
2.2 Step 2
3. More functions (ADVANCED CAR)
Special function: Collision avoidance System
Special Function. Bluetooth dead or alive!!
Code for the advanced car version
Arduino nano
KY-008 3Pin 650nm Red Laser Transmitter
As much as the stairs
Laser Sensor Module non-modulator Tube Laser Receiver
As much as the receivers
USB LED
As much as the stairs
You can use any other source of light
Photoresistor Sensor Module
As much as the stairs
You can use any other source of light
Breadboard
5v Relay Module for Arduino
2x16 LCD with I2C Module
Tactile Push Button Switch Momentary
10K ohm Carbon Film Resistor
Lots of wires
3d printed LCD case
Link to 3d files https://www.thingiverse.com/thing:4693741
Adding Front Lights, Back Lights and Stop Lights
Arduino nano
KY-008 3Pin 650nm Red Laser Transmitter
As much as the stairs
3d printed LCD case
Link to 3d files https://www.thingiverse.com/thing:4693741
Concerning cable management I designed in fusion 360 the above channels used for hiding the cables used for lighting and sensors.
More functions
Special function: Collision avoidance System
You can install in front of the car an HC-SR04 ultrasonic sensor. In this way the sensor measures obstacles that are in the way. When the distance measured, is below 10 cm (you can adjust it) and the special key D is sent from the app (Menu -> Collision button is enabled) the car is going backwards for half a second and then it stops
SR04 pins
Echo Pin to Arduino Pin 9
Trig Pin to Arduino Pin 8The Schematics and the code for the Arduino in this case is
Troubleshooting
1. If the car is not going on the right direction.
If this happens and your car is not going in the right direction then you don’t have to modify any code. You have to just change the motor driver wires in pairs.
For instance swap in1 with in2 or in3 with in4 pins
2. Cannot upload the code to the Arduino
You must know that when you are uploading the code to the Arduino. You must unplug the RX and TX pin of the Bluetooth module. Otherwise, you will not be able to upload the code to the Arduino.
3. The car in not responding the right way or often Bluetooth disconnections.
There is not enough power supply. Please make sure that both 18650 batteries are full charged