Baseball Arcade Game

by markgharby in Circuits > Arduino

1391 Views, 5 Favorites, 0 Comments

Baseball Arcade Game

1650654081.758237.jpg

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)

This instrutable will outline the various design and asssembly steps regarding the the baseball arcade game. This report will walkthrough the design and modeling phase, the assembly phase, and the arduino coding phase. All of which are needed to create the a full, functionable product. The timeline of this project was about 3 months from start to finish.

Supplies

Hardware and Materials:

  • Solidworks (for modeling and 3D printed parts)
  • Flipper/Bat
  • Bat Bottom
  • LED housing
  • LCD housing
  • LED breadboard housing
  • Corner Curve
  • Bearing Housing
  • Plunger Grip
  • Plunger Head
  • 2x4 Plywood
  • Jigsaw
  • Hole Saw
  • 2'' diameter
  • 1/2'' diameter
  • 0.5'' steel rod
  • Hacksaw
  • 0.5'' Inner Diameter Starlock Washer
  • Corner Brackets
  • 4x 100x100x3MM
  • 4x 20x20x2MM
  • 2 Compression Springs
  • 1 Extension Spring
  • 2x Adjustable Load Levelers
  • Screws:
  • #8 - 1/2''
  • #8 -1 1/4''
  • Cardboard
  • Green Spray Paint
  • White Paint
  • Paint Brushes
  • Wood Glue
  • Plastic Black Box
  • 12V Solenoid
  • Universal AC Adapter
  • IN4004 Diode
  • IRF510N MOSFET
  • 3x 12V LED, 0.5'' inner diameter push buttons
  • Push button wire adapters
  • 3x Quick-Connect Wire 0.187''
  • 3x Quick-Connect Wire 0.25''
  • 4-Digit-7Segment Display
  • LCD Display
  • Sealed Bearing 1/2 x 1 1/8 x 3/8 inch
  • White Nets
  • Push Pins
  • Male-to-Male breadboard wires
  • Female-to-Male breadboard wires
  • Female-to-Female breadboard wires
  • 2x Breadboard
  • 8x 220-ohm resistors
  • 3x IR Break-Beam Sensors
  • Arduino Mega 2560 REV3

Product Links:

  • Buttons:
  • https://www.amazon.com/dp/B01M0XPWGG?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Button Wire Adapters:
  • https://www.adafruit.com/product/3835
  • https://www.adafruit.com/product/3838
  • Solenoid:
  • https://www.amazon.com/dp/B07G4DDVL7?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • MOSFET:
  • https://www.amazon.com/dp/B08D3GPSVD?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Diode:
  • https://www.amazon.com/dp/B07CDCTZ8R?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Bearing:
  • https://www.bearingwholesalelots.com/product-p/mr6002-2rs.htm
  • Corner Brackets:
  • https://www.amazon.com/dp/B08R8D6D7C?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Extension Spring:
  • https://www.amazon.com/dp/B000K7M36W?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Load Levelers:
  • https://www.amazon.com/dp/B08CDZ9WH8?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Steel Rod:
  • https://www.amazon.com/dp/B002SEUZCE?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Starlock Washer:
  • https://www.grainger.com/product/41MJ25?RIID=62813941595&GID=&mid=ShipConfirmation&rfe=5a70f4c7fa05fad3e86b12cc140b16af8d845eff58b93c538dfcc45511c593f2&gcrfe=5a70f4c7fa05fad3e86b12cc140b16af8d845eff58b93c538dfcc45511c593f2&gucid=EMT:10376092:Item:CSM-329&emcid=NA:Item
  • Wires:
  • https://www.amazon.com/dp/B094G7VWCP?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Arduino Mega:
  • https://www.amazon.com/dp/B0046AMGW0?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Universal AC Adapter:
  • https://www.amazon.com/dp/B01N7RS0NG?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Break-Beam Sensors:
  • https://www.amazon.com/dp/B01BU6YBWU?psc=1&ref=ppx_yo2ov_dt_b_product_details
  • Hole Saw Kit:
  • https://www.amazon.com/dp/B099ZMF62Y?psc=1&ref=ppx_yo2ov_dt_b_product_details

3D Modeling and Printing

SS12.jpg
SS11.jpg

The goal of this step was to outline the entire project. Some challenges included picking the right size of the structure to leave enough room for the mechanical components to move. I would make some changes to the model if I were to restart the project; however, this step was crucial to achieving the proper dimensions to cut the wood. I used Solidworks to design each individual part, those made of wood and those meant to be 3D printed. All these parts were incorporated into a final assembly file to display the final model. In total, only 9 parts from the assembly file were sent to be 3D printed. These parts were the LCD House, LED Box, LED Housing, Rod End, Rod Hand, Bat Bottom, Bat, Bearing Housing, and the Corner Curve.

Wood Cutting and Painting

SS8.jpg

Once the model was complete, the dimensions of the main machine structure were drawn with a pencil and ruler on a 2x4 plywood. Then, a jigsaw was used in conjunction with some wood clamps to cut straight lines in the wood. The original plan was to use a laser cutter to cut the wood; however, the wood thickness of 0.5'' that I desired was too thick to use on the laser cutter available to me. When all the pieces were cut, a hole saw was used to cut necessary holes in the wood and black box. These holes are occupied by the push buttons, the flipper, the goal nets, and several passages for wiring.

All the pieces of wood were subsequently sanded and spray painted. Also, this is the step I decided to paint a design on the game to give it some life.

A hacksaw was used to trim down the length of the steel rod. This was necessary to achieve the proper center of mass for the rod. This roe will eventually be used as the plunger mechanism to launch the ball.

Assembly of the Main Structure

SS9.jpg
ss15.jpg

This was one of the most satisfying steps of the entire project because I could visibly see the progress of the project which provided motivation to keep going. In this step, a drill with screws was used to create the outer frame of the playing field. Then, wood glue was used to attach the backboard, as well as, the inner passageways of the ball. Finally, corner brackets were used to mount the black box below the field, as well as, the two wooden panels that house the push buttons.

In this step, I also mounted most of the 3D printed parts using glue: corner curve, LED housing, LCD housing, Plunger grip, and Plunger cap. The Flipper assembly was also mounted. This was done by placing a ball bearing in a 3D printed housing and using screws to attach the bearing to the bottom of the field. The Bat Bottom was then run through the bearing. The piece protruding to the top of the field was then glued to the actual flipper. A bearing assembly was used to minimize the energy lost to friction as the flipper is being actuated.

The Wiring

SS14.jpg
1650654146.506021.jpg
SS10.jpg

This project includes multiple electronic components which each required their own circuit.

Solenoid:

  • Tools: MOSFET, Diode, Solenoid, Universal AC Adapter with green terminals, Female-to-Male wires, Soldering Iron
  • I wanted this circuit to be independent of the breadboard setup due to the high current the solenoid required for powering. This required the use of a soldering iron to attach the MOSFET and Diode terminals to the wiring needed for the circuit. A flyback diode was used to avoid any damages that could be caused to the Arduino from an induced EMF from the solenoid when its current is interrupted. The MOSFET was used to ensure that the solenoid is only actuated when a digital pin (pin 53) from the Arduino is set to high.

IR Break-Beam Sensor:

  • Tools: 3x Sensors, breadboard, Female-to-Male wires
  • This circuit is pretty straightforward to wire. The emitter is connected to 5V and Ground power rails. The Reciever has three wires: Black goes to Ground, Red goes to 5V, and White goes to a digital pin on the Arduino. This pin is used to denote whether the beam is broken or unbroken. Pins 14, 15, and 16 were used for the three bases.

Push Buttons:

  • Tools: 3x Buttons, breadboard, 6x Quick-Connect Wires, Male-to-Male wires, Female-to-Male wires
  • Each arcade button has 4 terminals. 2 terminals are used to power the LED within the button. Those require the 0.25'' Quick-Connect Wires. Then, breadboard wires can be easily used to connect one side to Ground and the other side to 5V on the breadboard. The other two terminals are used for the actual switch in the circuit. These require the 0.187'' Quick-Connect Wires. Then, breadboard wires can be used to connect one end to Ground, and the other end to a digital pin on the Arduino. This digital pin will be used to determine the state of the push button. Pin 17 was used for the timer, Pin 18 was used to the Bat actuation, and Pin 19 was used for the Reset button.

LCD Display:

  • Tools: LCD display, Female-to-Male wires
  • The circuit for the LCD is quite simple because it only has 4 terminals. One goes to ground on the breadboard, and one goes to 5V on the breadboard. One terminal goes to the SDA pin on the Arduino. One goes to the SCL pin on the Arduino.

4-Digit-7-Segment Display:

  • Tools: separate breadboard, 8x 220-ohm resistors, Female-to-Male wires, Male-to-Male wires, Breadboard Jumper wires
  • This is by far the most complicated wiring of the project. Overcrowding in the Black Box led me to use a separate breadboard and housing for this circuit. This component has 12 terminals, each one representing one of 8 LEDs or one of four Common Cathodes. The Common Cathode terminals are responsible for powering each individual digit, while the LED terminals were responsible for powering each segment of the displayed number. Female to male wires were used to connect the display to the breadboard. Then, jumper wires were used to connect each rail to a 220-ohm resistor. At the other end of each resistor, wires were used to connect each display terminal to the Arduino in the black box. Pins 2 through 13 were all used to the display's connections.

The Coding

1650654103.928885.jpg
1650654140.177977.jpg

Outlined Goals of the Code:

  1. Have Break-Beam sensors connected to LCD display and programmed to count the "Score" up every two breaks to allow the user to reach in to grab the ball after scoring.
  2. BATBUTTON Push Button actuates Solenoid.
  3. TIMERBUTTON Push Button connected to LED Display that starts a countdown timer for 60 seconds to 0 seconds on the 4-Digit-7-Segment Display.
  4. RESETBUTTON Push Button is connected to both LED and LCD displays and returns both to initial conditions of 60 seconds for the LED Display, and a score of zero for the LCD Display.

The most challenging aspect of the code was related to the 60-second countdown timer. I wanted to figure out a way to have the countdown occurring in the background without using a delay function. A delay would've affected the gameplay of the machine. My solution was to use nested if statements and the millis() function to record how much time has passed between each countdown. This allowed other essential components like the Solenoid and IR Break-Beams sensors to function without being interrupted by a continuous one-second delay.

Enjoy the Game

Gameplay
Deliverable 7

Videos of Gameplay.