Wireless Arduino Controlled Tank (nRF24L01)

20,678

196

80

Published

Introduction: Wireless Arduino Controlled Tank (nRF24L01)

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.

Step 1: Gathering Materials and Tools

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

Step 2: Put Together the Tank

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).

Step 3: 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.

Step 4: Wiring the Tank

(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.

Step 5: ​Wiring the Controller

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

Step 6: Test the Tank!

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.

If you have any problems or suggestions please comment and I will try to response in a timely fashion.

~Ryan

6 People Made This Project!

Recommendations

  • Oil Contest

    Oil Contest
  • Water Contest

    Water Contest
  • Clocks Contest

    Clocks Contest

80 Discussions

How to add a turret ?

1
user
anv3D

Question 3 months ago

Hi, would it be possible to add a turret?

Thanks a lot for this instructable! I've been struggling with this exact thing for days (joystick & nRF24L01 module for controlling a robot). I followed your wiring scheme (plus a 100 uF cap for each 2.4 GHz module on the power rails), uploaded your sketches and it worked like a charm. Thanks a lot!

0
user
tulpek

1 year ago

Hi
Sorry to bother you with another stupid question but I have small issue that hopefully you'll be able to help me with, the issue is that after connecting everything up like in your instructable and loading the sketches to Uno and Nano, after powering up my motors keep running forward with the joistick in the center, when I pull the joistick back it changes to reverse same for left or right so that's all good, but forward or center position of the joistick keeps the motors running forward so I can't stop the tank. Thank You

6 replies

Hi,

If you plug the controller into the the computer and open a serial monitor at baud rate 115200, what are the values of x and y when the joystick is not touched?

Hi,

I've got the same problem , value of X = 1023, Y = 490 ~ 493.

Thank You

For the Y-axis all you have to do is change all the

Y > 500 and Y < 500 to Y > 480 and Y < 480 and

Y > 524 and Y < 524 to Y > 502 and Y < 502 and also 'map(Y,524,1024,0,255);' to 'map(Y,504,1024,0,255);' and

'map(Y,500,0,0,255);' to 'map(Y,480,0,0,255);' in the tank code

but it seems that the potentiometer of the x-axis is either broken or not correctly connected.

Hi the X reads 514 and Y reads 483-484

Hey,
If you do the same thing as described in the other comment I posted it should work, but instead of 480 and 502 you might want to do 470 and 492

looks like anything I do doesnt work. do you have a link to test the tank side?

What are the little metal pins that go in the tank?

are there only 2 double a batteries powering the whole tank? The diagram shows 9v batterie

Can it works with more than 12 servo motors ?

0
user
NimaR2

11 months ago

i made it, it's works correctly.. tanks..

I'm having trouble making a code that uses two joysticks that control there own separate motor. Can you help please? :)

These are the connection diagrams .i just need help with the codes

images.jpg
1 reply

ookay, ill have a look and get back to you asap