Introduction: 3d Printed Arduino Tank
Purpose and Description:
The purpose was to familiarize ourselves with remote controlled things and working on something that we like. Richard is a big fan of trucks and tanks and that was pretty much our main source of inspiration. We wanted to make a tank that do not shoot anything in order to meet the requirement of school laws. The project consist of a tank with a 3D printed body and other parts such as supports and gears to give it a look that we like instead of buying an ordinary body and electronics (Arduino and dual gear motor) that are basically what makes the tank function all together with a 9v battery used to power it. Because of past experiences with programming remote controlled things, we decided to make the tank an object avoiding vehicle. Initially, we wanted to make a ramp that would be controlled by the arduino but the shipping of the parts necessary to make that possible were cancelled for some reason so we decided not to include it in our project.
How is it used and applications:
As mentioned before, there is no controllers to drive the tank around. There is a component called wifly which allows the arduino to connect to a mobile device via wifi and all you need to do is press the button on the screen and the tanks will start to move.The tank is a cool little electronic toy that moves around and turns by itself. Since it is an object avoiding tank, it can be used to play games such as placing it around obstacles to see where it will go or placing it on a table with things surrounding it making it unable to fall down.
Step 1: Tools, Material and Files
Tools ans material needed for the project:
- 3d printer (Capable of printing pieces of about 20 x 15 cm)
- Screw driver
- Short end screws
- Cables (preferably arduino cables)
- Mobile device (tablet, iphone even mac works) for wifly
- 9v Battery or better (might need a support mount for AA batteries)
- Arduino Uno (you will need a cable in order to plug it to your computer)
- Tamiya Dual Motor Gearbox
- Tamiya Tank Treads
- Universal Mounting Platform (Optional)
- 1A Arduino Motor Shield
- ProtoScrew Shield
- PING))) Ultrasonic Distance Sensor
- RN-XV WiFly Module
- Breakout Board for XBee Module
All of the files needed to download are located at their respected step: (3D body design in step 2,
References and Inspiration:
Step 2: The Mounting Plate
To start things off we are going to assemble the universal mounting plate which is the base of the tank. We made a sketch of this in order to print it with the 3d printer if you want you can buy one online with all the screws included here: https://www.pololu.com/product/79
The mounting plate is an 11 x 31 grid of 3 mm holes spaced 5 mm apart. It is 6 cm wide, 16 cm long and about half a cm thick. In the pictures you see one side is the top the other one is the bottom side of them board. If we start with the bottom one, what you will have to do is place the rectangle wheel base and place it somewhat in the middle of the board. Then tighten them down with some crew and washers to keep everything nice and solid. When we get to the top of the board, you are going to have to install the triangular wheel base in the front of the board for the front wheels. Same as before tighten everything down with some screws and washers.
Edit: The site was not able to embed the base into the page so i was able to give out the 3d sketch of it.
Step 3: Assembling the Wheels
For this part we decided that it would be better to buy rubber tank tires and gears because sketching those things would be complicated and not as efficient. For the wheels, first thing that you must do is to put the small metal tube through the mounting holes in order to connect the wheels. The length for this metal tube is about 10 centimeters.
When that is done assemble all the wheels in their specific spots as seen in the picture. the three small wheels will go in the middles where the mounting bracket is, the large spiked wheel will be connected to the motor and the large normal wheel is placed as shown in the picture with the two small brackets.
Step 4: The Body
First thing you need to do is to make a 3D model of a body for a tank. The dimensions for the tank is about (...) The program that we used to sketch our tank is 123 design. For the tank, you have to be sure that the model does not interfere with the tires of the tank because you will prevent the tank from moving. Make sure that you make holes at the bottom of the body in order to be able to attach it with the mounting plate and that you leave space for the metal tubes of the wheels. Also, you have to be sure the body is somewhat light or else to tank will be slower. you can either make the body very slim or you can set the 3d printer to a shallow print to reduce the weight of it.
Unfortunately, we were unable to print the body of the tank due to the lack of time that we had left for this project but you can always download our version of the tank yourself and print it with the link below.
Step 5: Placing the Engine on the Tank
The dual motor gearbox is the main mechanical power source of the tank. For this step, we placed the motor on the back of the mounting plate and tightened it down with some screws and washers. Assembling the motor is pretty complicated so here is a tutorial video made by sparkfun showing you all the steps of the assembly.
Step 6: Mounting the Shields to the Arduino
This step is just to be precise on the attachment of the 1A arduino motor shield and of the protoscrew shield on the arduino. The motor Shield goes right on top of the arduino using the pins of the shield to connect them together. The protoscrew shield goes on top of the motor shield. Look at the picture of the close-up picture of the protoscrew shield to see which holes to connect with the motor shield using the pins that were included with your protoscrew shield.
Step 7: Arduino Location
All that you have to do here is to find some double sided tape and place it on the top of the dual motor gearbox where it doesn't affect the gears that are in in the motor. After that just stick the arduino on the motor and on you are good to go for the next step.
Step 8: The Sensor
The ultrasonic distance sensor is what makes the tank able to avoid the objects standing right in front of it. There are a lot of ways to place the senor since it can be supported by the wires connecting it to the arduino but be sure to place in front of the tank. We decided to place the sensor on the front of the mounting plate using double sided tape to be sure it stays in place and to be sure that is captures anything that is in front of it.
Step 9: Wire Setup
This is were all the wiring is done. Everything you need to connect is shown in the picture. Almost everything is connected to the the protoscrew shield except the two motors of the dual motor gearbox. Both positive and negative wires are going to be connected to the ports on the motor shield where you have to unscrew the screws and place the wire in its respected slot and screw it back. Do not forget to do that before putting the protoscrew shield and all the wires or else it might be difficult.
Even though the sensor only has one wire that connects to the arduino, there is a total of three wires connecting it. The other two are the ground wire (the pin with the arrow icon) and a wire that connects to a 5v slot (the middle pin).
There are multiple wires that go to a ground slot and a 5v slot that is why we included a protoscrew shield to be able to have more than just one of those slots.
Step 10: Coding the Arduino
The coding is probably the most important step of the project. It with was allaws all the electronic to work the way you want. All you need to do in this step is plug in your arduino to your computer, install the arduino software and copy paste the code that is in the link below. If all the wires and everything are in the right place the tank should be able to move once you press the button on your tablet (do not worry it is the next step).
The first part of the code is to control all the mechanical stuff to make it able to move. The second part of the code is to control the sensor in order to make the tank able to avoid any object facing it. Finally, the third part of the code is to connect the your device to the tank to make it start driving via the wifly module.
Step 11: The Wifly Module
The Wifly module is what will connect the tank to your device using a wifi connection. The wifly module sits on top of the Breakout board connecting them (you can easilly tell where to place it). The way to make this work is to put the web interface controlling the tank on a server and give it access from the page to your device.
We made a very simple design for our page since we need only one button to make the tank work but you can always take the one in the link below which was made by someone with more knowledge on this. (Reference is the influence links in intro)
Step 12: Last Step
Now that everything is wired and ready to go, all you need to do is assemble everything together and place them of the plate and you are done!
Step 13: Conclusion
Problems we have faced:
Some of the problems we faced during the making of this project were mostly related to the problems we had with shipping and to the electronic section of our project. We initially wanted to make a ramp to our tank but it ended up now working due to the fact that the parts for it never came. For the electronic part, we had some problems with making a web interface to control our tank because of the simple reason that we are not very familiar with how it works. In order to figure out those problems we decided to unfortunately not include the ramp in to our project since we did not have the time to reorder the parts for it and for the wifly module we got inspired by a guy that used it (his instructable in in the introduction) and got a bit of help from youtube tutorials to figure out how to make a interface of our own.
The main difficulty of the project was trying to figure out the code for the entire system and, as mentioned before, how to link the tank to our device via wifi. With a little bit of experience in coding we decided to do something quite complex for for our skill level and we had a lot of problems but we were able to overcome them by using another person's code as a base (his instructable is also in the introduction) and we modified it a bit to require what we wanted to accomplish. Doing that made it a lot easier for us to code what we wanted.
Things that could be improved:
The two main things that we will work on in the future is to first off fix the problem we had and later on add more power to the tank. The first time we tested the tank, it actually worked quite well. The tank was moving and detected an object and was able to turn out of the way to avoid colliding with it. But, for some reason, the second time we tried to turn on the tank, nothing happened. We tried and tried again but it did not seem to work. So the first thing we will do in the future is look at what went wrong and fix the problem in order to make the tank functional again.
The other thing that we will improve is the speed of the tank. When we were able to make it work, we found out that the tank was moving pretty slowly. To fix that issue, we thought that it would be a better idea to buy a bigger and more powerful battery to power the motor of the tank itself and make a mount for it to stay in place. The 9v battery that we have does not seem to be enough to power the arduino and the motor so we will have the 9v battery for the arduino and a bigger battery capable of giving a lot of power to the motor allowing it to go faster.
Step 14: Video
Youtube link: https://www.youtube.com/watch?v=aNIaXeS-29E
We have a be nice policy.
Please be positive and constructive.