Autodesk Tanks (inspired From the Video Game Wii Tanks)
by Eric Ling in Workshop > 3D Printing
757 Views, 2 Favorites, 0 Comments
Autodesk Tanks (inspired From the Video Game Wii Tanks)
Hello and welcome to the Autodesk Tanks team! We are a team of four San Jose State University students, Eric Ling, Ernie Rosendo, Benjamin Lam, and Aaron Brink, and for this 3D printing challenge we wanted to utilize our skills in 3D printing, Fusion 360, mechatronics, and MicroPython to re-create the Wii Tanks mini-game from Wii Play (but with a multiplayer focus!). In our version of the game, two or more players can each control a tank and duel each other in a play space of their choice with the objective being to score three hits on the other player to win, or to be the last surviving tank in the game. The basic objectives that we set out to achieve for this project were to have a tank with a basic range of motion (forwards, backwards, turning left, and turning right), ability to fire at other tanks, receive hits from other tanks, and have some indicator of gameplay state. By the end of this project however, we were able to also have a rotating turret as well as combine the hit detection and remote control functions using a single infrared receiver, which helped in simplifying our design.
Supplies
Supplies:
- Access to a 3D Printer (Creality Ender 3V2 and Creality Ender 3 printers were used during this project)
- Access to a Soldering Iron
- Access to Digital Calipers
- PLA 3D Printer FIlament x 2 (A single 1kg roll of filament should be enough for a single tank, but multiple rolls can be used for cosmetics)
- Raspberry Pi Pico & MakerPi Pico Base x 2
- USB Battery Pack x 2
- TT DC Metal Gear Motors & 1:90 Gearbox x 4
- TT Motor Wheels x 4
- L298N Motor Driver x 2
- Infrared LEDs
- Remote Control and IR Receiver x 2
- SM-S2309S Servo Motor x 2
- Color LEDs (2 x Red, 2 x Yellow, and 6 x Green required)
- Jumper Wires (typically come in bulk packages)
- Crazy Glue
- Double Sided Tape
- M3 Screws and Nuts
- Painter’s Tape
Note #1: Many of the above items are already sold in the required quantities for two tanks, but you will need to purchase two Raspberry Pi Pico & MakerPi Pico bases and two remote controllers/IR receivers.
Microcontroller and Electronic Component Selection
For this project, we chose to use the Raspberry Pi Pico on a MakerPi Pico base as we had the most familiarity in coding with MicroPython. Another factors to our use of the Raspberry Pi Pico was that it had 28 GPIO pins available to control other components with, and it could be connected to a MakerPi Pico base which gives the microcontroller a buzzer GPIO breakout ports, and pushbuttons, all of which we would use for this project. Next, we would choose the motors and required motor driver, which was the L298N motor driver and TT DC motors. We have had previous experience in using the L298N motor driver with TT DC motors, and we also knew that the TT DC motor came in a high-torque variant with a 1:90 gearbox which would allow the tank to move more consistently despite its weight. One additional benefit is that the combination of the L298N motor driver and TT DC motors is that both may be powered through the Raspberry Pi Pico's pins. The last actuator that we considered was the servo to rotate the turret of the tank, and this was the SM-S23090S, selected for its compact size. We also chose an infrared receiver to control the tank as this infrared receiver could be used for both commands and also to send "hit" signals using infrared LEDs.
Writing Code in MicroPython
To confirm the functions of each of the electronic components required for the tank, we wrote scripts that would make use of each actuator and sensor through the Raspberry Pi Pico. This includes wiring each motor to the motor driver, and then wiring the motor driver, IR receiver, and servo motor to the microcontroller. The functions that we would test are taking inputs from the remote control, moving forwards/backwards/left/right using the motor controllers and the two DC drive motors, turning the turret using the servo motors, firing using an IR LED, and then registering/receiving a hit using an IR receiver. We were also able to write a program to test the buzzer on the MakerPi Pico base, as for our project we used the buzzer to play the main theme of the Wii Tanks game. For our project, we used Thonny to program in MicroPython, but any other application compatible with MicroPython may be used. After testing each component, we then wrote the code that each tank would run during a game. Each tank would have three lives per game (signified by three green LEDs, delays in firing between each shot (signified by a yellow LED illuminating for a short duration), a reset period after being hit, and a game over state where the red led on the tank turns on (and the game itself requires a reset using a button on each tank's remote). The main code for the game is given below.
Downloads
Beginning Physical Design in Fusion 360
Once we had confirmed that the electronics and the code to control it were working, we could then begin considering the design of the tank chassis. To start, we found CAD models for each of the electronic components that we had purchased, such as the microcontroller, motor driver, DC motors, and servo motor. If we could not find part files online, we would create mock-ups of them ourselves using schematics online; which we would later use for component placement and design of the tank chassis. Some of the electronics schematics with part dimensions would be included on the component's product page, and from here we could verify their dimensions using digital calipers before using them as a guide. Fusion 360 allows you to upload a variety of part file formats, but the most common that we have seen during this project were SOLIDWORKS parts and STEP files, both of which Fusion 360 was able to accept. The sources for the CAD files we have used are listed below.
MakerPi Pico Base - https://cdn.cytron.io/MAKER-PI-PICO/MAKER-PI-PICO-3DCAD.zip
TT DC Motor & Wheel - https://grabcad.com/library/motor-tt-2
L298N Motor Driver - https://grabcad.com/library/l298n-h-bridge-motor-driver-1
SM-2309S Micro Servo - https://grabcad.com/library/micro-servo-sm-s2309s-1
Chassis Design
The design process for the chassis of the tank began with consideration of the electronic components necessary for the tank. Initially, we created a 150 mm x 200 mm rectangle nearing the maximum print volume of our 3d printer, the Creality Ender 3V2. This would give us the most space and placement options for all other components, and from here we began placing components in CAD. We set the Raspberry Pi Pico & MakerPi Pico base towards the front left of the tank so there is space to the front right for a USB battery pack. Towards the rear, we placed the motor controller and DC motors. To position each component, we would create a sketch with rectangles representing each joining face as well as their position, and then use the "split face" feature to create faces that we can static joint each part to. Using this method, we were able to accurately place components as we imagined they would when we assembled the tank in later steps, ensuring that the electronic and 3d printed part layout would be feasible.
Additionally, we would need to check the height of each electronic and 3d printed component to ensure that everything would fit within the RC tank. To do this, we would use the measure tool to measure the height of each component as it sits on the bottom base. Then, we could add about 5 mm or 0.5 cm of space to that highest point, and this would be the required length of the spacer pillars for the top and bottom halves of the chassis. We then made indentations in the bottom base to position the pillars, and also made a shallow hex-shaped cut and deeper circular shaped cut inside the hex-cut for a screw to extend into.
For the top plate, we would need to make an appropriately sized hole for the turret to attach to and for the servo to fit into as well. We also needed to consider making holes for each of the five indicator LEDs; all of which were approximately 5.5 millimeters in diameter.
The design of the servo mounting hardware was more complex, as we needed to position the shaft of the servo motor at the center of the cradle and also make the cradle as compact as possible to ensure that there are no clearance issues with the other electronics. To properly center the servo, we would use the inspect tool again within Fusion 360 to find the horizontal distance between the center of the servo's shaft and one of the sides of the servo body. With this, we could create a groove that the servo could fit into (with the wire and connector side facing our of this groove). A similar process would be required when creating a shaft to link the output side of the servo to the underside of the turret shell. For this shaft, we would need to take caliper measurements of the drive end of the servo and create an indentation of the same size on the servo motor shaft.
Finally, we would work on cosmetic components such as the side, front, and rear bumpers, as well as the top shell and turret. The design for these components were not as complex, but the barrel must fit into the top shell of the tank and extra care needs to be taken to ensure that there is a tight fit between these two parts. Additionally, the infrared LED and its wires must fit within the barrel as well, which is why we made the inner diameter of the barrel the same as the width of an LED. We wanted our design to resemble that of a Wii tank from the game Wii Play, so we set out in designing front, rear, and side bumpers to match the Wii Tanks tank as closely as possible. Some of the features that we wanted to accurately recreate were the wheels, treads, and the chamfers on various surfaces of the tank.
Preparing CAD Models for 3D Printing
We first would need to export all of our CAD files from Fusion 360 as STL files, as this is the file type supported by our slicer of choice, Ultimaker Cura. For efficiency, we would print each part in batches of other parts that would all fit on the print bed, and we would use 20% infill for all parts. Adhesion would not be necessary as we did not have adhesion issues on our glass build plate, and we only enabled support where necessary. The first and second prints only contained the top and bottom bases/plates respectively, but later prints would contain multiple parts. The third print contained the barrel, four top and bottom plate spacers, a servo output shaft attachment, two bottom support pegs, and the servo mounting cradle. Next, the bottom and top half of the rotary bearing would be printed, followed by the top turret shell, treads, and front and rear bumpers.
3D Printing
Before we began 3D printing, we ensured that the bed of the 3D printer was clean and level. Isopropyl alcohol poured on a paper towel worked best for keeping our print bed clean, and we manually leveled the print bed before auto-leveling with the auto-leveler installed on the Creality Ender 3V2. Then, we could insert the micro SD card containing the necessary Gcode for this project, load filament, and then preheat the hotend along with the print bed. The default preheating settings for the Ender 3V2 were 200 degrees C for the hotend and 60 degrees C on the print bed, but for other printer models these preheat settings may vary. After these preparation steps, we could begin 3d printing the first group of components for the tank. Repeat these steps for each of the other component groups until all components have been printed, and if necessary, print multiple batches of parts for each tank that you will be assembling.
Assembly
When all parts are 3D printed, we assembled them in the following order:
- Glue the M3 size nuts into the hexagonal holes of the chassis spacers. If the holes were too large, we applied tape to the outside face of the nuts to increase their width slightly and make a tighter fit. If too loose, we used a soldering iron to melt the nuts into the hexagonal holes.
- Glue the four spacers to each corner of the bottom base with the flat side down. The side with the hexagonal and circular cuts should be facing upwards. Wait until the glue has completely dried and there are solid joints between the spacers and the bottom base.
- Place the MakerPi Pico, DC motors, and motor driver as shown above and begin connecting them using jumper wires and following the given schematic. If necessary, solder wires onto the DC motors.
- Apply double-sided tape to the top half of the rotary bearing, and then place it on the upward facing side of the top plate (the side with no 1 mm positioning cuts). Take the lower half of the rotary bearing and stick it to the upper half of the rotary bearing, which should have double sided tape already on it.
- Apply small pieces of double-sided tape to the top four corners of the servo mounting cradle, and then stick the cradle to the top plate with the area that the servo mounts to at the center of the hole in the top plate.
- Use the super glue to stick the cosmetic treads onto the sides of the tank as well as the front and rear bumpers.
- Use super glue to stick the barrel of the tank to the top shell of the tank. If the barrel does not fit tightly into the hole in the top shell of the turret, tape can be wrapped around the back end of the barrel to allow for a tighter fit.
- Plug the battery pack into the micro USB port on the Raspberry Pi Pico.
Test & Play the Game!
Test each function of the tank again now that the electronics have been mounted in the 3D printed chassis. Once you confirm that everything works, assembly of the Autodesk Tank is complete! Repeat these steps to build the second tank or additional tanks. If you have already done so, play the game with one or more friends!