Autonomous tank on Arduino. How to make a radio-controlled tank: a spy with a remote control and a camera Do-it-yourself tank battle from arduino

The robot consists of a chassis from a radio-controlled tank and several other components, a list of which is given below. This is my first project on , and I love the Arduino platform. When creating this robot, I used materials from books and the Internet.

Necessary materials
1. Chassis from a radio-controlled tank.
2. Arduino Uno.
3. Breadboard and jumpers.
4. Integrated motor driver SN754410NE.
5. Standard servo.
6. Ultrasonic rangefinder.
7. 9V battery and connector for it.
8. 4 D batteries and a connector for them.
9. USB A-B cable.
10. Base 6" x 6".

Tools
1. A set of screwdrivers.
2. Hot glue gun.
3. Solder and soldering iron.

Chassis

I took the chassis from a tank bought for $10. The base can be attached to it anywhere, but I attached it in the middle.

Motor Driver SN754410NE

I used the SN754410NE driver to control the motors. I used it because I had it, but you can use another one like L293.

Now about connecting the driver to the Arduino Uno. Connect all GND pins (4,5,12,13) ​​to the breadboard GND. Connect driver pins 1 and 16 to Arduino pins 9 and 10. Connect driver pins 2 and 7 to Arduino pins 3 and 4, these are the control pins of the left motor. Connect driver pins 10 and 15 to Arduino pins 5 and 6, these are the right motor control pins. Connect pins 3 and 6 to the left motor, and pins 14 and 11 to the right. Pins 8 and 16 must be connected to power on the breadboard. Power supply: 9V battery.

The ultrasonic rangefinder helps the robot avoid obstacles while moving. It is located on a standard servo, which is located on the front of the robot. When the robot spots an object at a distance of 10 cm, the servo starts spinning, looking for a passage, and then the Arduino decides which side is the most pleasant to move.
Attach a connector to it. Limit the servo so that it cannot turn more than 90 degrees to each side.

The sensor has three pins GND, 5V and a signal. GND connect to GND, 5V to Arduino 5V and signal connect to Arduino pin 7.

Food

The Arduino is powered by a 9V battery through the appropriate connector. To power the motors, I used 4 D size batteries and the appropriate connector. To power the motors, connect the wires from the holder to the board with SN754410NE.

Assembly

When all the parts are ready, it's time to assemble them. First we need to attach the Arduino to the base. Then, with the help of hot glue, we will attach the rangefinder with a servo to the front of the robot. Then you need to attach the batteries. You can place them anywhere you like, but I placed them next to the Arduino. When everything is ready, you can turn on the robot to make sure the Arduino is working.

Program

So, after assembling the robot, it is time to write a program for it. After spending a few days, I wrote it.
The robot will move in a straight line as long as the object is more than 10 cm away. When it notices an object, it starts to rotate the sensor, looking for a path. When the scan is completed, the program selects the optimal side for movement. If the robot is at an impasse, it turns 180 degrees.
The program can be downloaded below. You can modify and supplement it.

The main part of the robot is the chassis from the radio-controlled tank and other components, their list will be written below. This tank is the author's first project on the Arduino platform, and he was pleased that he used it. The author used materials and books from the Internet.

Materials and tools:
- Tank chassis
- Arduino Uno
- Jumpers and breadboard
- Integrated motor driver SN754410NE
- Conventional servo
- Ultrasonic range finder
- 9V battery with connector for it
- D type batteries
- USB cable for Arduino
- Chassis base
- Screwdrivers
- Thermal gun and glue for it
- Soldering iron and solder

Step one. Tank chassis.
The author took the chassis from an old Abrams tank bought at a flea market. The resulting tank was dismantled so that the chassis could be removed from it. It is not necessary to use the same tank, any radio-controlled one will do. Moreover, the original motor left much to be desired, so I had to assemble my own, its assembly will be in the next step. Having prepared the chassis, the author attached the base to them with hot glue. It does not matter where it will be fixed, but it was decided to stick it in the center.

Step two. Engine driver.
The SN754410NE driver is used to control the engine, the author used it, since it was available, you can take any similar one.
Connecting the driver to the Arduino is as follows:

All GND pins are connected to the breadboard GND pins.
- Driver pins 1 and 16 to Arduino 9 and 10.
- Pins 2 and 7 of the driver are connected to pins 3 and 4 of the Arduino (they are responsible for controlling the left motor).
- Arduino pins 5 and 6 are connected to driver pins 10 and 15 (they are responsible for controlling the right motor).
- Pins 3 and 6 are connected to the left motor, and 14 and 11 to the right motor.
- Pins 8 and 16 must be connected to power on the Bredboard, powered by a 9V battery.

Step three. Rangefinder installation.
The ultrasonic sensor allows the robot to avoid obstacles in its path while moving. The sensor is located on a standard servo and will be mounted on the front of the robot. At the moment when the robot notices an obstacle within 10 cm, the servo will start turning in both directions, thereby looking for a passage. Arduino reads information from the sensor and decides which side is more favorable for further movement.
First of all, a servo is attached to the sensor. The author fixes the servo so that it can turn only 90 degrees in each direction, in other words, a full turn of the servo will be 180 degrees.

The sensor has three pins GND, signal and 5V. The 5V supply is connected to the Arduino 5V supply, GND to GND, and the signal to Arduino pin 7.

Step four. Food.
Arduino receives power through a 9V battery, it is connected to the appropriate connector. The motors are powered by four D type batteries installed in the battery holder. To power the motors, the holder wires are connected to the board on which the SN754410NE motor driver is already installed.

Step five. Robot assembly.
After completing all the previous steps, it's time to put all the details together. First of all, the Arduino is attached to the base of the tank. After that, an ultrasonic rangefinder is attached to the front of the robot using hot glue. Then, the author fixes the batteries next to the Arduino. Batteries can be installed on any part of the tank. After installing all the components, all the wires were lifted up and power was applied to the board to make sure that the assembly was correct.

Step six. Program code.
After the assembly of the tank is completed, it's time to write a program for it. The program should show the robot when to move, and when to stop moving, to avoid collision with an obstacle. When writing code from the author

Let's build a first-person RC tank that can be controlled from up to 2 kilometers away! My project was based on a remote control rover, easy to assemble, easy to program and a great project for hobbyists!




The bot is very fast and agile, not to mention that it carries two powerful engines! It will certainly outrun a human, no matter what surface the races are on!

The bot is still a prototype even after months of development.

So what is FPV?
FPV, or First Person View, is a First Person View. Usually we see FPV while playing on consoles and computers, for example in racing games. FPV is also used by the military for surveillance, protection, or to control protected areas. Hobbyists use FPV in quadcopters for aerial filming and just for fun. This all sounds about as cool as it costs to build a quadcopter, so we decided to build something smaller that rides on the ground.

How to manage it?
The bot is based on the Arduino board. Since Arduino supports a wide variety of add-ons and modules (RC / WiFi / Bluetooth), you can choose any of the communication types. For this assembly, we will use special components that will allow control over long distances using a 2.4Ghz transmitter and receiver that controls the bot.

There is a demo video in the last step.

Step 1: Tools and Materials






I buy most of the parts from my local hobby shops, the rest I find online - just look for the best deals. I use many solutions from Tamiya and my instructions are written with this feature in mind.

I bought spare parts and materials in Gearbest - at that time they had a sale.

We will need:

  • Clone of Arduino UNO R3
  • Pololu Dual VNH5019 Motor Shield (2x30A)
  • Pin dads
  • 4 spacers
  • Screws and nuts
  • Signal transmission module (transmitter) 2.4 Ghz - read more in step 13
  • Receiver 2.4 Ghz for at least two channels
  • 2 motors Tamiya Plasma Dash / Hyper dash 3
  • Tamiya Twin Motor Gearbox Kit (stock motors included)
  • 2 universal Tamiya boards
  • Tamiya tracks and wheels set
  • 3 Li-polymer batteries 1500mAh
  • POV camera with support for remote control of direction and zoom
  • transmitter and receiver for FPV 5.8Ghz 200mW
  • bottle of superglue
  • Hot glue

Tool:

  • Multitool
  • Screwdriver Set
  • Dremel

Step 2: Assembly of a paired gearbox


Time to unpack the gearbox. Just follow the instructions and you'll be fine.

Important note: Use a gear ratio of 58:1!!!

  • lubricate the gears before assembling the box, and not after
  • do not forget about metal spacers, otherwise the box will creak
  • use 58:1 gear format, it's faster than 204:1

Step 3: Improve the Motors

The gearbox comes with motors, but they are very slow in my opinion. Therefore, I decided to use Hyper dash motors in the project, instead of Plasma Dash motors, which consume more energy.

However, Plasma Dash motors are the fastest in Tamiya's 4WD motor series. Motors are expensive, but you get a better product for the money. These carbon coated motors spin at 29,000 rpm at 3V and 36,000 rpm at 7V.

Motors are designed to work with 3V power supplies and increasing voltage, although it increases performance, but reduces their service life. With the Pololu 2x30 Motor Driver and two Lithium Polymer batteries, the Arduino software should be set to the maximum speed of 320/400, you will find out what this means shortly in the code step.

Step 4: Motor Drivers


I have been fond of robotics for a very long time and I can say. that the best motor driver is Pololu Dual VNH5019. When it comes to power and efficiency, this is the best option, but when we talk about price, he is clearly not our friend.

Another option would be to build the L298 driver. 1 L298 is designed for one motor, which is the best solution for high current motors. I'll show you how to build your own version of such a driver.

Step 5: Track Assembly




Use your imagination and configure the tracks to your liking.

Step 6: Screw the Spacers and Attach the FPV



Again, use your imagination and figure out how to position the struts and camera for a first person view. Secure everything with hot glue. Attach the top deck and drill holes for mounting the FPV antenna and under the installed spacers, then screw everything in place.

Step 7: Top Deck


The purpose of creating the top deck was to increase the free space, since the FPV components take up a lot of space in the bottom of the drone, leaving no room for the Arduino and the motor driver.

Step 8: Install Arduino and Motor Driver

Simply screw or glue the Arduino into place on the top deck and then dock the motor driver on top of it.

Step 9: Installing the Receiver Module



It's time to connect the Rx module to the Arduino. Using channels 1 and 2, connect channel 1 to A0 and channel 2 to A1. Connect the receiver to the 5V and GND pins on the Arduino.

Step 10: Connect Motors and Batteries



Solder the wires to the motor and connect them to the driver according to the channels. For the battery, you will need to create your own connector using JST male and Dyna male plugs. Look at the photos to better understand what is required of you.

Step 11: Battery

Take the battery and determine the place where you will install it.

Once you find a place for it, create a male adapter to connect to the battery. The 3S 12V Li-po battery will power the FPV camera, motor and Arduino, so you will need to create a connector for the motor power line and the FPV line.

Step 12: Arduino Code (C++)

The code is very simple, just upload it and it should work with the VNH motor driver (make sure to download the driver library and put it in the Arduino libraries folder).

The code is similar to the Zumobot RC, I just changed the motor driver library and tweaked a few things.

For the L298 driver, use the standard Zumobot program, just connect everything according to the way it is written in the library.

#define PWM_L 10 ///left motor
#define PWM_R 9
#define DIR_L 8 ///left motor
#define DIR_R 7

Just upload the code and move on to the next step.

Files

Step 13: Controller


There are different types of controllers for radio-controlled toys on the market: for water, earth, air. They also operate on different frequencies: AM, FM, 2.4GHz, but in the end they all remain ordinary controllers. I don't know the exact name of the controller, but I do know that it is used for aerial drones and has more channels than ground or water ones.

I am currently using a Turnigy 9XR Transmitter Mode 2 (No Module) . As you can see, the name says that it is moduleless, which means that you choose which 2.4GHz communication module to build into it. There are dozens of brands on the market that have their own features of use, control, distance and other miscellaneous features. Right now I'm using the FrSky DJT 2.4Ghz Combo Pack for JR w/ Telemetry Module & V8FR-II RX which is a bit pricey, but just look at the specs and the goodies, the price doesn't seem like much for all that goodness. Plus, the module comes immediately with the receiver!

And remember that even if you have a controller and modules, you will not be able to turn it on until you get batteries that match the controller. In any case, find the controller that suits you and then you will decide on the right batteries.

Tip: if you are a beginner, then seek help from local hobby shops or find groups of amateur radio enthusiasts, because this step is not just a joke and you will need to shell out a significant amount of money.

Step 14: Check




First turn on the bot, then turn on the transmitter module, after that the receiver module should indicate successful binding by flashing the LED.

Beginner's Guide to FPV

The part that is installed on the bot is called the FPV transmitter and camera, and the one in your hands is called the FPV receiver. The receiver connects to any screen - be it LCD, TV, TFT, etc. All you need to do is insert batteries into it or connect it to a power source. Turn it on, then change the channel on the receiver if necessary. After that, you should see what your bot sees on the screen.

FPV signal range

The project used an inexpensive module that can operate at a distance of up to 1.5 - 2 km, but this applies to using the device in open space, if you want to get a stronger signal, then buy a higher power transmitter, for example 1000mW. Please note that my transmitter is only 200mW and was the cheapest I could find.

The last step is to have fun driving your new spy tank with a camera!

Have questions?

Report a typo

Text to be sent to our editors: