Introduction: Remote Controlled Arduino Tank
Hey there,
I wanted to build a nice tank controlled from a classic RC radio going through an arduino. It's actually quite easy these days with all the available electronics around.
You will need to procure a few elements in order to build that beast. We will go through the steps in this instructable.
Step 1: Assemble Material
You will need the following elements:
- One tank with two DC motors 12v already mounted like T'Rex Tank
- One Arduino compatible Motor Shield like Monster Shield
- One Arduino UNO R3 - please prefer official one
- One 2 channel RC Transmitter and one RC receiver - I used an old one which is on AM 27 MHZ but you can find modern ones like this hobbykingr-tmhk-gt2b-3ch-2-4ghz-transmitter-and-receiver
- One battery for UNO R3 - 9V battery for the moment - not ideal since it doesn't have much stamina
- One large battery for the motion - I used a NIMH 3300 mAH 10.5v so I guess 7 cells with 1.5v each
- some dean connectors to make everyone connect easily
- Soldering Iron
I used Arduino IDE to program the UNO and I added a little monitoring tool with Visual Studio 2017
Step 2: Arduino and Motor Shield
Since I selected a motor shield that was arduino ready, I just had to mount them together. Do note that the shield is taking already a few PINs and therefore shall not be reused for other purpose.
The Arduino UNO R3 will talk to the motor shield to indicate at what speed each of the motor needs to turn. Since we have two motors, this is quite straight forward.
Step 3: Link Motor Shield to DC Motors
Step 4: Link Motor Shield to NIMH Battery
Step 5: Link Radio Receiver to Arduino
Step 6: Prepare Power Source for Arduino for Stand-alone Mode
Step 7: Arduino Code
Arduino is so powerful. All the things I wanted to do when I was young, I can do it so easily now! No need to know so much about electronics anymore.
I wrote this Arduino code from two sources:
Mixing both together, I can get the readings from the RC receiver straight into my arduino, convert the values to the motors through the motor shield.
Regarding the mixing of the two channels from the radio into two separate speed indications for the motors, I went on the internet over Tank Drive Mixing with Joystick to get some ideas on how to write the corresponding part.
I also had to look over on PWM to understand a bit what this was all about. Some good articles on arduino are available, SecretsOfArduinoPWM and Tutorial PWM
Be careful that this code relies on EnableInterrupt.h that can be installed from the menu "Sketch" > "Include Library" > "Manage Libraries" then search for EnableInterrupt. This library allows to capture the values from the RC receiver at any time out of the standard setup and loop procedure. Quite convenient.