Marble Pinball Game
A simple pinwheel sort of game made by using a servo motor to control the marble, a potentiometer to control the servo, and a built-in score multiplier.
The idea is simple. Press the button to get your 'score multiplier,' and once you're ready, place your marble in the cup, and spin it to try and get it into the holes.
Each hole has a number of points written on it. The score multiplier is how much you can multiply your score by (ex. if you press the button and get 2, and your marble goes in a hole with 15 points, you'll get 30 points, though you can make your own rules if you wish.)
Supplies
> 1x 7 Segment Display (Common Anode)
https://www.digikey.ca/en/products/detail/kingbright/SA56-11SURKWA/4098451
> 1x Push Button
https://www.digikey.ca/en/products/detail/omron-electronics-inc-emc-div/B3F-1020/44059?gclsrc=aw.ds&&utm_adgroup=General&utm_source=google&utm_medium=cpc&utm_campaign=PMax%20Shopping_Supplier_Omron%20EMC_0039_Co-op&utm_term=&utm_content=General&utm_id=go_cmp-20786490134_adg-_ad-__dev-c_ext-_prd-44059_sig-Cj0KCQiAqL28BhCrARIsACYJvkcsjehuDicjmlGXRXCETEs7h9M6xtsV1E8WfcNuKHVzT1zlSkScwakaAkOSEALw_wcB&gad_source=4&gclid=Cj0KCQiAqL28BhCrARIsACYJvkcsjehuDicjmlGXRXCETEs7h9M6xtsV1E8WfcNuKHVzT1zlSkScwakaAkOSEALw_wcB&gclsrc=aw.ds
> 1x Potentiometer
https://www.digikey.ca/en/products/detail/bourns-inc/3310P-125-103L/2537834
> 3x LED [1 red, 1 yellow, 1 green]
red https://www.digikey.ca/en/products/detail/w-rth-elektronik/151051SS04000/7315767?gclsrc=aw.ds&&utm_adgroup=&utm_source=google&utm_medium=cpc&utm_campaign=PMax%20Product_Medium%20ROAS%20Categories&utm_term=&productid=7315767&utm_content=&utm_id=go_cmp-20291741266_adg-_ad-__dev-c_ext-_prd-7315767_sig-Cj0KCQiAqL28BhCrARIsACYJvkcYTBlRQsnPFMSee2g_CtLvv8O5Mxrjabj3g86BS3BNuanpUMl7-jcaAm07EALw_wcB&gad_source=4&gclid=Cj0KCQiAqL28BhCrARIsACYJvkcYTBlRQsnPFMSee2g_CtLvv8O5Mxrjabj3g86BS3BNuanpUMl7-jcaAm07EALw_wcB&gclsrc=aw.ds
yellow https://www.digikey.ca/en/products/detail/kingbright/WP7113YD/1747683?gclsrc=aw.ds&&utm_adgroup=&utm_source=google&utm_medium=cpc&utm_campaign=PMax%20Product_Medium%20ROAS%20Categories&utm_term=&productid=1747683&utm_content=&utm_id=go_cmp-20291741266_adg-_ad-__dev-c_ext-_prd-1747683_sig-Cj0KCQiAqL28BhCrARIsACYJvkfkqINEMGNu0nbPOBgRQ1f9EUrcrr77dSXOUC7jny5KwHI2W_PbE9saAuxUEALw_wcB&gad_source=4&gclid=Cj0KCQiAqL28BhCrARIsACYJvkfkqINEMGNu0nbPOBgRQ1f9EUrcrr77dSXOUC7jny5KwHI2W_PbE9saAuxUEALw_wcB&gclsrc=aw.ds
green https://www.digikey.ca/en/products/detail/w-rth-elektronik/151051VS04000/4490015?gclsrc=aw.ds&&utm_adgroup=&utm_source=google&utm_medium=cpc&utm_campaign=PMax%20Product_Medium%20ROAS%20Categories&utm_term=&productid=4490015&utm_content=&utm_id=go_cmp-20291741266_adg-_ad-__dev-c_ext-_prd-4490015_sig-Cj0KCQiAqL28BhCrARIsACYJvkfTHNfp-dLaHhIAbV8-4gGZFvmZlWRCYI_BaalfviFLnKKJ7R2fJ7AaAjZ-EALw_wcB&gad_source=4&gclid=Cj0KCQiAqL28BhCrARIsACYJvkfTHNfp-dLaHhIAbV8-4gGZFvmZlWRCYI_BaalfviFLnKKJ7R2fJ7AaAjZ-EALw_wcB&gclsrc=aw.ds
> 5x 330 Ohm Resistor
https://www.digikey.ca/en/products/detail/koa-speer-electronics-inc/CF1-4CT52R330J/13538206
> 1x 10k Ohm Resistor
https://www.digikey.ca/en/products/detail/yageo/MFR-25FBF52-10K/13219
> 1x Servo Motor
https://www.digikey.ca/en/products/detail/adafruit-industries-llc/2442/5774227
> 1x Breadboard (Half Size)
https://www.digikey.ca/en/products/detail/adafruit-industries-llc/4539/12082396
> 1x Arduino Uno
https://www.digikey.ca/en/products/detail/arduino/A000066/2784006
> Necessary amount of wires
https://www.amazon.ca/Elegoo-120pcs-Multicolored-Breadboard-arduino/dp/B01EV70C78/ref=asc_df_B01EV70C78/?tag=googleshopc0c-20&linkCode=df0&hvadid=706827341408&hvpos=&hvnetw=g&hvrand=1319419377116833961&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9000838&hvtargid=pla-362913641420&psc=1&mcid=3b22e48e874231f9af684caea861f94f&gad_source=4
> Necessary amount of cardboard [~20x15 inches] + tape
https://www.deserres.ca/products/brown-corrugated-fiberboard-40x60-inches?variant=39426649784453
> A marble or small ball
Place in Your Main Components
These are the main components that will make your game work. Remember, arrange them so you have space to spin the potentiometer and press the button with a comfortable amount of space.
Add Your Power and Ground Connections
Connect your components to the power and ground rails (red representing power, black representing ground.) Resistors go to ground, aside from the ones attached to the 7 segment display, which go to power instead, since it is a common anode component.
Add Wires for Easier Connections to Your Arduino
These wires will help you when you're connecting your components to your arduino, preventing your wiring from getting messy.
Wire Your Components to Your Arduino
These wires will go to your arduino. Remember to give your circuit power and ground through the 5V and GND pins, and to attach your potentiometer to the pin called A0, it is an input pin by default.
Also remember to attach your servo to a PWM (pulse width modulation) pin, they are represented with a ~ before the number. (3, 5, 6, 9, 10, 11)
Add Your Code
This is the code to let your game work. Remember to code your 7 segment display so the numbers match the letters in the diagram.
This tinkercad link has the circuit and working code inside it.
https://www.tinkercad.com/things/d8LrF54Skbp-brave-gaaris/editel?returnTo=https%3A%2F%2Fwww.tinkercad.com%2Fdashboard%2Fdesigns%2Fcircuits&sharecode=WrL7DpA9R75b_NHVrTSvmHoPWouPkj5O35xAvIQgA8A
Make a Stand for Your Servo
Cut out 3 pieces of cardboard with the dimensions shown.
Dotted lines are folds. It can help to make a shallow cut with a box cutter (NOT ALL THE WAY THROUGH) to make it easier to fold, though be careful.
Fold the Cardboard
Fold the cardboard and secure with tape as shown. Attach the second and third piece together as shown to create the "ramp."
Attach the Servo
Slide the servo into the long piece of cardboard, and secure it with tape. Then, rotate the servo left until you cant anymore, and tape the arms of the servo to the bottom if the ramp. You may have to cut a hole into the side of the long piece in order to slide the wires of the servo through.
Make the Pinball Board
You can customize your board however you'd like, as long as you have a square slot at the bottom about 2.2cm x 1x2cm to slide your servo stand into. The board as shown in this picture is about 10in x 13in.
Play
Insert the servo into the cardboard slot, plug it into the breadboard, place your marble, and play. If the marble doesn't roll off as it should, spin the servo all the way left/right using the potentiometer, and lean it forward so the ball rolls off once it's spun around.