Wireless Arduino Controlled Tank (nRF24L01)

by RyanKolk in Circuits > Arduino

41893 Views, 235 Favorites, 0 Comments

Wireless Arduino Controlled Tank (nRF24L01)

IMG_20160509_155802.jpg
IMG_20160509_155752.jpg
IMG_20160508_183952.jpg
IMG_20160508_184008.jpg

Hi!

Today I'll be showing you how to build an Arduino controlled tank and remote. The 3d printed parts of the tank (with the exception of the controller, track guide and tank cover) were designed by timmiclark and can be found here.

Gathering Materials and Tools

IMG_20160508_185909.jpg

You will need the following materials to get started:

  • 1x Arduino UNO(here)
  • 1x Arduino Nano(here)
  • 2x nRF24L01 2.4GHz wireless modules(here)
  • 1x L298N Motor driver(here)
  • 2x Gear motor (the yellow piece of plastic)(here)
  • 1x Joystick(here)
  • 1x 9v battery clip(here)
  • 2x Power switch(here)
  • 2x TR 18650 batteries (and a charger)(here)
  • 1x TR 18650 battery holder for 2 batteries(here)
  • 1x Male to female jumper set(here)

The 3D printed parts consist of (can be found on the bottom of this step):

  • 2x Body
  • 2x TrackMidFrame
  • 52x Track
  • 4x Cog
  • 4x CogBracketInner
  • 4x CogBracketOuter
  • 1x TankCover
  • 1x Controller

You'll also need the following tools:

  • Soldering iron
  • Various drill sizes
  • Super glue
  • Pliers
  • Knife

Put Together the Tank

IMG_20160429_232354.jpg
IMG_20160501_102109.jpg
IMG_20160501_102407.jpg
IMG_20160501_102605.jpg
IMG_20160501_103316.jpg
IMG_20160501_103401.jpg
IMG_20160502_143640.jpg
IMG_20160502_143715.jpg
IMG_20160502_143905.jpg
IMG_20160502_143922.jpg
572f775d15be4d71dd000479.jpeg
IMG_20160508_192026.jpg
IMG_20160507_191719.jpg
IMG_20160507_191803.jpg
IMG_20160507_200709.jpg

After printing I assembled the tank. All the pieces except for the tracks, cogs and cover were glued together with super glue. The tracks ended up to be too tight around the cogs, it might be an issue with my printer, but I decided to add two extra tracks on each side and design a guide for the tracks. It's not the most convenient solution, but it works.

After I assembled the tank, I drilled holes to fit the wireless module and the power switch. I probably should have drilled the holes before I glued it all together, but it didn't make that much of a difference. I drilled holes and attached motor driver to the bottom of the tank with two M3 bolts.

Optional (if you have the same problem as me):

Print two tank guides from the 'optional' folder and some tracks (I suggest adding one or two on each side).

Programming the Tank and Controller

To program the arduino you will need the RF24 library installed. So download the files below and open arduino IDE. Go to Sketch -> Include Library -> Add .ZIP Library and import 'RF24.zip' into there.

Next you'll have to connect the arduino UNO and upload 'tank.ino' to the arduino. we'll conect the wires in the next step.

Now unplug the Arduino UNO and connect the Arduino Nano and upload 'controller.ino' to the Arduino.

Remember to change the 'board' and 'port' settings under tools to the correct board type and port.

Wiring the Tank

5730d1b915be4d573100018e.jpeg
IMG_20160509_162426.jpg
IMG_20160509_162447.jpg
NRF24L012_BottomView.jpg
(the image of the nRF24L01 module is a bottom view)

Wiring the tank:

Connect the following pins.

nRF24L01 pins ---- Arduino pins



• GND 1 ---- GND
• VCC 2 ---- 3.3V
• CE 3 ---- 7
• CSN 4 ---- 8
• SCK 5 ---- 13
• MOSI 6 ---- 11
• MISO 7 ---- 12
• IRQ 8 ---- not connected


L298N ---- Arduino pins



• IN1 ---- 5
• IN2 ---- 6
• IN3 ---- 9
• IN4 ---- 10


As far as the battery pack of the tank is concerned, the ground wire goes to the GND pin of the arduino and the GND pin of the motor driver. the power wire goes to Vin pin of the arduino and to the +12V pin of the motor driver via the power switch. Oh, and the +5V pin of the motor driver is attached to the 5V pin of the arduino.

​Wiring the Controller

5730d1fb15be4d9624000123.jpeg
IMG_20160509_160118.jpg
IMG_20160509_155947.jpg
57309a2050e1b66486000027.jpeg
NRF24L012_BottomView.jpg
Wiring the Controller

nRF24L01 pins ---- Arduino pins



• GND 1 ---- GND
• VCC 2 ---- 3.3V
• CE 3 ---- 7
• CSN 4 ---- 8
• SCK 5 ---- 13
• MOSI 6 ---- 11
• MISO 7 ---- 12
• IRQ 8 ---- not connected


Joystick ---- Arduino pins



• GND ---- GND
• +5V ---- 5V
• VRx ---- A0
• VRy ---- A1


It's a bit of a puzzle, fitting all the components into the controller, but with some patience I'm sure you'll manage

Test the Tank!

MVI_4980.gif

Now, if all goes well, you should be able to control the tank with the controller. if the tracks move in the wrong direction you can either change the code(which is a pain) or you can flip the wires running to the motor driver.

If the tank doesn't work at all you should check the connections of the nRF24L01. you can also connect both Arduino's to the computer, open two different arduino instances, open serial monitor on both and check if the signals are sent and/or received. Please note that if the controller prints the reading of the X and Y values it doesn't mean those signals reach the module.

~Ryan