# Arduino Servo Foosball

280

2

1

by David Joy and Andrew Gothard

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Introduction

Our objective: To create a Foosball like game using Arduinos, servos and its arms, and wooden pieces.

Why: We decided that this project would give us the chance create something interesting and usable while allowing us to work with a broad range of topics, such as, wood working, coding the Arduinos, 3-D printing, and wiring.

## Step 2: Materials Needed

• Arduino (including redboard and breadboard)
• Laptop (if Arduino must be connected to run)
• 4 servos and disks
• 8 3D printed servo arms
• 8 buttons
• 8 10k ohm resistors
• Sufficient wiring
• Glue
• Wood (see specific sizes in building the board section)
• Ball (a table tennis ball works well)
• Super Glue
• Screws and drill

## Step 3: Creating the Servo Arms

1. Use Onshape to design servo arms to use in order to hit the ping pong balls in the game.
2. Make each arm 6 cm long with a part that extrudes down 2.5 cm. (Be sure that the extrusion extends so it can rotate around the servo itself.)
3. Use the a circular servo piece to attach the arms onto and place the center line of the first one, that points to the center of the board, parallel to the goal sides of the game board.
4. Place the center line dividing the second arm at an angle of elevation of 129 degrees to the first servo arm.
5. Next place 4 servo's 5 cm above each of the diagonal guide boards and 9.75 cm from each of the side walls closest to the servo. (There should be two on each side.)
6. Then we drilled a hole for the servo wires to fit through and glued down the servo with super glue.

Example of our servo arm: https://cad.onshape.com/documents/5f6eb41ccc33b434...

## Step 4: Creating the Board

1. Make a 54x36 cm wooden base. (This accounts for the thickness of the walls.)
2. Then cut a four 14 cm diagonals and two 30 cm sides. (These walls should be 2 cm thick and 4 cm or greater.)
3. Next draw lines that are parallel to each side two centimeters away from the wall to create a new rectangular box.
4. Then at each of the four corners of the rectangle measure 10 cm along each side of the rectangle and draw a line between those two point. This line is the line for the diagonal wall pieces.
5. Once complete measure 5 cm above each diagonal and draw a line that is 9.75 cm long and is perpendicular to the side board.
6. Draw or trace a rectangle that is centered at the end of the line that matches the servos base.
7. Then draw a line between each pair of diagonals that is parallel to the goal sides.
8. Cut a sloping surface that slants toward each of the goals between the two diagonals and the line drawn across them in the previous step.
9. Drill a hole for each servo close to the servos base and in between the servo and the side wall.
10. Screw each of the wall pieces down and use super glue to hold down the servo.
11. Super glue the servo arms to the servo by placing the servo arm on the inside of the board parallel to the goal sides.
12. Next connect the wires for the servo underneath the board.

## Step 5: Electronics and Programming

1. "The electronics for each player consist of 2 servos, 4 buttons, 4 10k ohm resistors, an arduino, and sufficient wiring.
2. On each arduino, connect the positive (black plus) column to 5V and the negative (red minus) to ground.
3. Place four buttons on the breadboard where you want them.
4. Test to make sure you can push the buttons comfortably before continuing.
5. For the one on each button (that a contact is in) connect a 10k ohm resistor between that row and the positive column.
6. On each of the same rows, connect a wire to the appropriate pin.
7. Pins 2 and 3 control the servo in pin 9 and pins 4 and 5 control the one in pin 10.
8. To wire the servos (you will need to have them glued on for this step), connect the white wire (signal) to pin 9 or 10 (depending on which buttons should control it). Connect the black wire (power) to the positive column and the red wire (ground) to the negative column."

"Download the program attached and upload it to both arduinos. The program initializes all servos and inputs, then checks for buttons pressed every 20 milliseconds (50 times per second) and adjusts the servos accordingly. After the program is uploaded, each servo will turn for 1.5 seconds to confirm that they are wired correctly, and will end at 90 degrees."

## Recommendations

• ### Internet of Things Class

22,773 Enrolled

## Discussions

That's fun, I would love to have a foosball game in our house for game nights :)