Introduction: 4WD All Terrain Arduino Robot for Everyone
I've always liked robots that can move in rough terrain. This time I decided that I will use ready-made chassis modifying it slightly and adding a few additional components. By using a ready chassis I could quickly build a working model and take care of its software. The robot can operate autonomously detecting obstacles in its close surrounding. It can also be controlled via bluetooth using a mobile phone or tablet. The whole electronic design was made based on the Arduino Mega 2560 that is quite powerful. I hope that everyone will find something interesting in this instruction.
Happy coding :)
Step 1: The List of Parts
If you don't have too much time to building your own mobile robot platform you can buy "Robot Smart Car Kit" that includes a chassis, wheels, motors and other mechanical components. To build the robot we will need additional electronics to control the motors and sensors to detect obstacles. At the end we will add LiPo batteries to power the robot and the project will be ready for testing.
Parts needed in this project:
Step 2: Assembly of Parts of a Mobile Robot
- Screw the bottom and sides of the metal chassis.
- Put the Arduino Mega and Motor Drivers in the chassis and mark the mounting holes (M3). To do this you must first unscrew the black radiator from the Motor Driver. Instead of the black radiator that is too large, you can use a piece of aluminium sheet having a thickness from 1 to 3 mm.
- After drilling the holes screw the Arduino and Motor Drivers to the chassis.
- Put two LiPo batteries in the chassis and stick them from the bottom side with double-sided adhesive tape.
- Mount 2 power switches to the top cover of the metal chassis.
- Perform the necessary wiring connections (see the next step).
Step 3: Making a Rotary Sensor for Obstacle Detection
To rotate the sensor you can use a micro servo. Servo can be attached to the robot chassis using piece of aluminium in the shape of U or L. Originally I've made housing for the ultrasonic sensor SRF05 from a piece of red plastic but finally I changed it to the aluminium that is much more durable.
Step 4: Connection of Electronic Parts
The main controller in this electronic system is Arduino Mega 2560. To be able to control four motors I used two BTS7960B Motor Drivers (H-Bridges). Each of the Motor Driver can be loaded by the current up to 43A that gives a large margin of power even for the mobile robot moving over rough terrain. For remote control of the robot I used a popular bluetooth module HC-05. The electronic system is equipped with two power sources. One for supplying the DC motors (LiPo battery 11.1V, 1300 mAh) and the other to supply Arduino, bluetooth module and sensors (LiPo battery 7.4V, 800 mAh).
All connections of electronic modules are the following:
- BTS7960 -> Arduino Mega 2560
- MotorRight_R_EN - 4
- MotorRight_L_EN - 5
- MotorLeft_R_EN - 8
- MotorLeft_L_EN - 9
- Rpwm1 - 6
- Lpwm1 - 7
- Rpwm2 - 2
- Lpwm2 - 3
- SRF05 Ultrasonic Sensor -> Arduino Mega 2560
- Vcc - 5V
- GND - GND
- TRIG - 11
- ECHO - 12
- IR GP2Y0A02YK0F Analog Sensor -> Arduino Mega 2560
- VIN - 5V
- GND - GND
- VOUT - A7
- Servo -> Arduino Mega 2560
- RED - 5V
- BROWN - GND
- ORANGE - 10
- Bluetooth HC-05 -> Arduino Mega 2560
- TXD - RX1 (19)
- RXD - TX1 (18)
- VCC - 5V
- GND - GND
Step 5: Arduino Mega Code
I've prepared a few examples of Arduino programs for you (all available at GitHub):
- SRF05_servo_nearest_obstacle - Find the nearest obstacle and turn the sensor in its direction.
- RobotKit_4WD_IR_GP2Y0A02YK0F_FollowMe - Follow the moving object (based on proximity IR sensor GP2Y0A02YK0F 20-150 cm).
- RobotKit_4WD_BTS7960_IR_SRF05_FollowMe - Follow the moving object (based on proximity IR sensor GP2Y0A02YK0F and ultrasonic sensor SRF05).
RobotKit_BTS7960_4WD_Bluetooth_Controlled - Control mobile robot via Bluetooth using Android app
The first two simple programs allow you to test the sensors and actuators. In the third program the robot operates autonomously following the closest object. However, if you prefer to control the robot by yourself just upload a fourth program to your robot and control it via Android app.
Step 6: Testing of Mobile Robot
And finally, it's time for my favorite part of the project that is testing. These videos show tests of mobile robot based on programs from the previous section (Arduino Mega Code).
You can download my Android app that allows you to control 4WD all terrain robot from Google Play: link
How to use the Android app:
- tap menu button or 3 vertical dots (depending on the version of your Android)
- select the tab "Connect a device"
- tap on the "HC-05" tab and after a while you should see the message "Connected to HC-05"
- after connecting, you can control your robot
- if you don't see your bluetooth device HC-05 tap "Scan for devices" button
- on the first use pair your bluetooth devices by entering the default code "1234"
If you would like to see my other projects related to robotics please visit:
We have a be nice policy.
Please be positive and constructive.