Introduction: Table-top Tank Game
"This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)" This inscrutable will walk through the steps of making a Table-top tank game. Starting with the code and finishing with the components in place.
This tank game functions by using a servo and a solenoid in coordination with a relay in order to aim the barrel of a "tank" towards holes in a box and shoot at them. It is all controlled by an IR-receiver and an remote control
Step 1: Gathering Your Materials
In order to build this project you will need,
*Push pull solenoid. - Size dependent on how for you plan to shoot the ball, or how big the ball is
*IR-Remote / Sensor
*Plywood for game table / Cardboard
*Box to house parts
*Access to a 3D-printer
*pvc pipe (optional)
*DC power source - voltage depends on the requirements of the solenoid
Step 2: Designing the Code
The code is developed using the Arduino IDE.
It consist of initiation for variables, as well as the library's for the parts in the circuit. It also includes a setup and loop.
Everything below is commented in the code above:
The Initiation initiates,
-The Ir -remote library
-The library for the sevo
-Variable to store the servo position
-Sets the receiver for the remote to a pin on the Arduino
-Defines the variables to control the trigger mechanism for the Game
-Initiates the Ir-remote, as well as setting variables for the buttons based on their hex values when pressed
-Attach the servo to pin 9
-Start the receiver
-Sets the pull, and pop pins as outputs
-pull is the trigger so its low, so when activated it will allow power through the relay therefore shooting the ball
-pop is a constant signal going to the servo, which it necessary for its operstion
-Receives the hex value from the remote
-Has a set of loop that tell the Aduino where to move the servo when buttons on the Remote are pressed
-Has a loop the activates pull(the trigger) when zero is pressed
Step 3: Designing Your Parts
The parts essential to make this work are the housing for the solenoid, as well as the barrel/base of the barrel.
In the pictures above you can see the base to the barrel in gray. It is designed to fit flush with the solenoid with a small opening big enough for the pin of the solenoid to fit flush in it. It is also designed to fit the curvature of the ball accurately so that when loaded it holds the ball to fit. This will vary depending on the solenoid./ball combo chosen.
In order to design the barrel base it is necessary to take measurements of the solenoid tip as well as the dimensions of the ball chosen. Then using them in an auto-cad to design it for 3d-printing. The barrel to the tank can also be printed to specific dimensions of the ball, however as this ball fit in 1/2 PVC it would have been a waste to 3d print it.
The next part is the housing for the solenoid, the housing will be specific to the dimensions of the solenoid chosen as well as the mounting points for the servo. For this design the box is designed to fit the solenoid snug on both sides with a groove on the bottom to account for the coils width and a cutout for the wiring so that it can go into the box. The bottom the housing is also designed thick enough so that their can be room cutout for the relays mount to sit inside of the base of the box flush. There is also a hole in the bottom designed above the mount for the relay so that it may be attached to relay.
The top of the solenoid is also covered partially by a 3d-housing this is not necessary, but aids in the overall aesthetic of the project. Having it cut off half way gives it a more raw finish witch contributes to the the games overall tank like appearance.
Step 4: Circuit
On the breadboard the positive rail is the 5v source from the Arduino, and the negative rail is connected to ground.
Connect the ground to the ground on the breadboard, the signal to pin 3 this will be pop or the trigger, the constant power to pin 4, and the ground to ground on the breadboard.
Connect the positive to the power out on the relay and the negative to the ground on the DC power source.
The DC Source,
Connect the positive to the power in on the relay, and the negative to the ground on the dc power source.
Connect the power to the positive rail on the Arduino, connect the ground to the ground, and connect the signal to pin 11 on the Arduino.
Connect the power to the positive rail on the Arduino, connect the ground to the ground, and connect the signal to pin 9 on the Arduino.
Step 5: Designing the Board and Putting It All Together
For the board you could simply use an old box, and cut holes in it, or you could use wood and a lazer cutter to make precise holes and build everything to exact measurements. Once the bard is done everything can be painted and assembled. For the most part everything will fit in the box, however the servo will need to have a mounting hole drilled on the top of the box for it to sit flush, there will also need to be a hole under the base if the solenoid for its wiring, and there will also need to be a hole for the wires to escape the box.
All the parts should easily mount to each other if designed well, and can be held together with an epoxy or strong glue.