Introduction: Magi-tek Tank (RC Car)
"This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)"
Introduction to the Project
The Magi-Tek Tank is a small remote controlled car that works through the use of the Arduino UNO microcontroller, Adafruit's L293D motor shield V1.2, and a PS2 controller. In addition, it also uses 4 DC motors, 1 micro servo, two AA batteries, and several 3D printed pieces. Most of the pieces are also interchangeable. That means that necessary adjustments to the physical shell of the project could be implemented if needed.
Step 1: Electronic Components
Here is a complete list of all the parts required to complete the project. These can be obtained from several dealers, including Amazon and Ebay. (Images of each component are displayed above.)
- Arduino Uno
L293D Motor Shield V1.2
PS2 Reciever + Controller (Needs 2 AAA Batteries)
SG90 Micro Servo Motor
Four3V-6V DC Geared Motors
Small Jumper Wires
TwoLithiumAA 3.7V Rechargeable Batteries
Step 2: Circuit Schematic
Even though the circuit system and the way the cables are hooked up looks complicated at first glance, it really isn't. The whole wiring is outside the actual container of the Tank in order to guarantee a better view. Due to the original nature of some components, there are specific pieces that needed to be soldered. These are; the jumper wires attached to the wheels and the batteries, as well as the jumper wires connected to the analogue pins, GND, and 5V through the motor shield.
- The Arduino UNO is connected underneath the motor shield.
- The AA rechargeable batteries powering the entire system are connected to the Arduino UNO through its power jack. Its is important to note that while the Arduino UNO is capable of handling a voltage anywhere between 5V-12V it is recommended to keep this voltage as low as possible. By using two rechargeable 3.7V batteries at full charge, the Arduino is receiving an approximate voltage of 8.4V (When fully charged rechargeable lithium-ion batteries exert 4.2V) Also note that the Arduino can only handle a maximum of 1200mAh, the batteries used for this project exerted 880mAh.
- From this point onward everything else will be connected directly to the motor shield.
- Each motor will be connected to the motor shield through the M1, M2, M3, and M4 ports. The way the wires are connected to each individual motor doesn't really matter, because if they are changed to fit and opposite alignment, that will only change their overall direction (Forward goes backwards and vice versa). It is also imperative to mention that the voltage and amperage required to drive motors depends on their specific requirements. The ones used here required a max of 6V and 900mAh to work efficiently.
- The micro servo is connected to SER1 and the analogue pin 4 (A4) in the motor shield. The way this is connected, unlike the motors, does actually impact the servo and if not done properly could damage it. Due to the way the PS2 controller operates, the servo needs to be attached to the analogue pin 4.
- Finally, the PS2 controller receiver has its own set of wires that need to be connected in order for it to work properly. In order to make a complex process easier, attached above is a detailed picture showcasing where each wire connected to the analogue pins, 5V, and GND are connected to the controller.
- On a final note, in order for the controller to sync up properly to its receiver, make sure that the controller is always on first before the receiver. Otherwise, it might not sync with the entire system.
Step 3: Physical Pieces
All of the pieces utilized for this project were 3D printed, except for the small box that contained all of the electronics. Attached above is a clear image of all the pieces. The files used to print and design them are also attached to this section. Their individual functionalities are explained below.
- The actual black box is a 4.7x7.5x2.3" box provided by USF where all the electronic components are kept.
- The stamps are nail-like objects, with holes for the wires passing through them, used to join the wheel supports and the box.
- the wheel supports are what keep the wheels in place. With a hole crossing inside from one side to the other, the supports allow the wires to go through easily without the need to expose them.
- The laser is the piece attached to the servo. It works as the "gun" of the vehicle.
Step 4: The Code
This is the coding used for this project, the details will be explained inside. This code relies heavily on two libraries, the PS2 controller's library, and the motor shield library. These libraries are readily available across the internet, but they are also attached to this section! Remember to include them, otherwise, the code won't work as it should. (Where a new library begins the other one ends.)
Step 5: The Final Product
Finally, to finish off here is a video showcasing the system, the way in which it works, as well as the completed project. Thank you for reading and for your time!
We have a be nice policy.
Please be positive and constructive.
Awesome project! Do you think an Arduino Nano would work, and is it possible to control Left wheels forward/back with left joystick and right wheels with the right stick, so if you make one go forwards and one back, the tank will turn. Also, maybe turn the turret by turning the right stick side to side. :D