This year we are being challenged to make a pinball machine for our culminating project for our Engineering Pathway.
Above is the requirements list for our project!
This project will use all disciplines of STEAM!
To start we used the Raspberry Pico motherboard to make a working stoplight with Python.
We wired our leds through the breakout board which we put our pico into so that we could have more space for wires.
We used our prior knowledge from coding the stoplight to make a chaser pattern around the whole breakout board. And this is the code for it --->
The start button is used to start the machine and your turn and also turn some of the lights on while also giving you your first ball. It uses many mechanical components to work and start the machine such as switches that turn on to give certain parts power.
The launcher is a main component used to launch the first ball into play. In order to use it you have a spring on a rod that you pull back to compress the spring and once you release it the potential energy is released and launches the ball up the ramp and into the top of the field of play.
The target is a main componet that when hit by a ball it flips down by using a motor and it causes the score to go up and when you get all of them the score goes up. It moves with a motor that retracts it when a sensor on the target is hit and then it goes back up either when all of the targets have been hit or when the game is over.
The bumper is a common component in all pinball machines that moves when the ball hits the bottom and top of the bumper metal pieces it completes the circuit causing the solenoid to pull the top part down causing the ball to be pinched away extremely fast.
We were introduced to some best practices such as using certian colors for each function
We also learned that you should label where each wire is going and where it is coming from n case a connection comes lose
9/13/23 Onshape drawing in Engineering
Rectangles
We used corner rectangles, center point rectangles and dimension tools.
Rectangles and Circles
We used corner rectangles, center point circles and the dimension tools.
Robot sides
We used the linear pattern tool, corner rectangle an center point rectangle.
Stairs
We used the linear pattern tool, the corner rectangles and center point rectangles, and the extrude tool.
We used our prior knowledge from making one button work to program our lcd to react to the buttons changing the ball count and the score.
Pyramid
For this we used the linear pattern tool, the corner rectangles and center point rectangles, and the extrude tool.
Doughnut
We used the center point circle and the revolve tool.
Disc
We used the line tool to make a triangle and then revolved it to make a disc.
Target
We made a target by using the linear pattern tool, corner rectangle tool, and the extrude tool.
Thing with holes
For this I used the rectangle, line, filet, center point circle, and rim tools.
Horse shoe
For this I used the center point circle, trim, extrude, and corner rectangle tools.
What is the function of a flipper?
Describe in your own words, once your flipper is installed, how you will consider it to be successful.
I will consider my flipper to be successful if it is very durable and works exactly every single time the button is hit causing the flipper on the side to hit the ball also it will have to look good and fit well into the game board.
As of this year, one of the expectations of your engineering knowledge is that you can develop your own set of constraints. Use the target constraints as a guide. Develop a comprehensive list of project constraints for your flipper (10-20 requirements).
Able to withstand thousands of whacks
Ball does not go over or get stuck on flippers
Make connections with wood glue and joints when necessary
When the button is hit it will make the flipper move
All wires are either soldered or crimped
Wires are color coded
All parts should be made of wood
Do not install screws parallel to the plane
Flipper size is appropriate
All parts should be installed using a machine screw and a nut or appropriate length wood screw when attaching to the gameboard bottom.
What is the “switch” that controls the mechanism? Describe it. Add an image of one.
It is the button on the side of the machine that closes a circuit every time you hit it causing the selenoid to react.
What is the electromechanical component that creates the movement? Add an image of one.
The electromechanical component that creates the movement is the selenoid which uncompresses the spring hitting the flipper.
What is the mechanical component that hits the ball? Describe it in words, but also draw a 3D Sketch of the assembly (on paper). Add this sketch to the entry.
The mechanical component that hits the ball is the actual flipper which is a round triangle-shaped piece that is used to hit the ball.
The solenoid pulls back a spring and releases it when it is pressed.
You can put the solenoid up at the top or underneath depending on your game board
When you press the button it closes a switch causing the circuit to close causing the selanoid to snap.
# code-lcd-i2cimport board
import digitalio
import time
import busio
import pwmio
from adafruit_motor import servo
import board
# For more information on how to use digitalio on Circuit Python, see
# https://learn.adafruit.com/circuitpython-essentials/circuitpython-digital-in-out
# For more information on how to use the neopixel library on Circuit Python, see
# https://learn.adafruit.com/circuitpython-essentials/circuitpython-neopixel
import neopixel
# Here are some RGB values for some common colors.
# 0 == LED off and 255 == full brightness
PURPLE = (255, 0, 200)
GREEN = ( 0, 255, 0)
RED = (255, 0, 0) # 100% red, 0% green, 0% blue
BLACK = ( 0, 0, 0) # 0% of all colors (turns the LED off)
# LCD Source code is at https://github.com/dhalbert/CircuitPython_LCD
from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from digitalio import DigitalInOut, Direction, Pull
pwm = pwmio.PWMOut(board.GP19, duty_cycle=2 ** 15, frequency=50)
# Create a servo object, my_servo.
my_servo = servo.Servo(pwm)
score_button1 = digitalio.DigitalInOut(board.GP3)
score_button1.direction = digitalio.Direction.INPUT
score_button1.pull = digitalio.Pull.UP
score_button2 = digitalio.DigitalInOut(board.GP5)
score_button2.direction = digitalio.Direction.INPUT
score_button2.pull = digitalio.Pull.UP
score_button3 = digitalio.DigitalInOut(board.GP2)
score_button3.direction = digitalio.Direction.INPUT
score_button3.pull = digitalio.Pull.UP
ballcount_button = digitalio.DigitalInOut(board.GP20)
ballcount_button.direction = digitalio.Direction.INPUT
ballcount_button.pull = digitalio.Pull.UP
flipper1_solenoid = DigitalInOut(board.GP16)
flipper1_solenoid.direction = Direction.OUTPUT
flipper1_solenoid.value = False
flipper1_button = DigitalInOut(board.GP12)
flipper1_button.direction = Direction.INPUT
flipper1_button.pull = Pull.UP
flipper2_solenoid = DigitalInOut(board.GP14)
flipper2_solenoid.direction = Direction.OUTPUT
flipper2_solenoid.value = False
# Initialize the flipper button as an input
flipper2_button = DigitalInOut(board.GP6)
flipper2_button.direction = Direction.INPUT
flipper2_button.pull = Pull.UP
bumper1_solenoid = DigitalInOut(board.GP4)
bumper1_solenoid.direction = Direction.OUTPUT
bumper1_solenoid.value = False
# Initialize the flipper button as an input
bumper1_button = DigitalInOut(board.GP28)
bumper1_button.direction = Direction.INPUT
bumper1_button.pull = Pull.UP
#ballcount_button.value
#print(ballcount_button.value)
#time.sleep(0.5)
# Initialize the score variable
score = 0
old_score = score
ballcount = 3
old_ballcount = ballcount
# Initialize I2C bus.
# The Raspberry Pi pico has a number of pin pairs that can be used for I2C.
# One pin is SCL (clock) and the other is SDA (data). See
# a pin diagram at https://datasheets.raspberrypi.com/pico/Pico-R3-A4-Pinout.pdf
i2c = busio.I2C(board.GP1, board.GP0)
# Talk to the LCD at I2C address 0x27.
lcd = LCD(I2CPCF8574Interface(i2c, 0x27), num_rows=2, num_cols=20)
lcd.set_backlight(True)
led_strip1_pin = board.GP18
led_strip1_num_pixels = 18
led_strip1 = neopixel.NeoPixel(led_strip1_pin, led_strip1_num_pixels, brightness=0.3, auto_write=False)
led_strip2_pin = board.GP22
led_strip2_num_pixels = 10
led_strip2 = neopixel.NeoPixel(led_strip2_pin, led_strip2_num_pixels, brightness=0.3, auto_write=False)
led_strip3_pin = board.GP27
led_strip3_num_pixels = 12
led_strip3 = neopixel.NeoPixel(led_strip3_pin, led_strip3_num_pixels, brightness=0.3, auto_write=False)
led_strip4_pin = board.GP17
led_strip4_num_pixels = 12
led_strip4 = neopixel.NeoPixel(led_strip4_pin, led_strip4_num_pixels, brightness=0.3, auto_write=False)
led_strip5_pin = board.GP13
led_strip5_num_pixels = 12
led_strip5 = neopixel.NeoPixel(led_strip5_pin, led_strip5_num_pixels, brightness=0.3, auto_write=False)
def update_lcd():
if score != old_score or ballcount != old_ballcount:
lcd.clear()
lcd.set_cursor_pos(0, 1)
lcd.print("Your Score: "+ str(score))
lcd.print(str(score))
time.sleep(0.05)
lcd.set_cursor_pos(1, 2)
lcd.print("Ball Count: ")
lcd.print(str(ballcount))
time.sleep(0.05)
#if ballcount != old_ballcount:
#lcd.clear()
#lcd.set_cursor_pos(1, 2)
#lcd.print("Ball Count: ")
#lcd.print(str(ballcount))
#time.sleep(0.05)
#if ballcount == 0:
# lcd.set_cursor_pos(1, 2)
# lcd.print("Game Over")
# score == 0
# ballcount == 3
#lcd.print("Ball Count: ")
#lcd.print(str(ballcount))
#time.sleep(0.05)
lcd.set_cursor_pos(0, 0)
lcd.print("Starting Pinball")
time.sleep(1)
led_strip1.fill(BLACK)
led_strip1.show()
while True:
led_strip3_color = BLACK
#print(ballcount_button.value)
if score_button1.value == False:
score = score + 2
led_strip3_color = RED
if score_button2.value == False:
score = score + 3
#time.sleep(0.5)
led_strip3_color = PURPLE
if score_button3.value == False:
score = score + 5
led_strip1.fill(RED)
led_strip1.show()
else:
led_strip1.fill(BLACK)
led_strip1.show()
if ballcount_button.value == False:
ballcount = ballcount - 1
if ballcount == 0:
lcd.clear()
lcd.set_cursor_pos(1, 2)
lcd.print("Game Over ")
time.sleep(2)
score = 0
update_lcd()
ballcount = 3
#print("Ball count Button is PRESSED")
#time.sleep(0.075)
#time.sleep(0.05)
if (flipper1_button.value == True):
led_strip5.fill(BLACK)
led_strip5.show()
# The input has a pull up, so this means
# the value is True when the button is not pressed
flipper1_solenoid.value = False
else:
# The button is pulled to ground, so the switch is pressed
led_strip5.fill(RED)
led_strip5.show()
flipper1_solenoid.value = True # Make the screen scroll sideways
if (flipper2_button.value == True):
# The input has a pull up, so this means
# the value is True when the button is not pressed
flipper2_solenoid.value = False
led_strip4.fill(BLACK)
led_strip4.show()
else:
# The button is pulled to ground, so the switch is pressed
led_strip4.fill(RED)
led_strip4.show()
flipper2_solenoid.value = True
if (bumper1_button.value == True):
# The input has a pull up, so this means
# the value is True when the button is not pressed
led_strip2.fill(BLACK)
led_strip2.show()
bumper1_solenoid.value = False
else:
# The button is pulled to ground, so the switch is pressed
score = score + 5
led_strip2.fill(RED)
led_strip2.show()
bumper1_solenoid.value = True
led_strip3.fill(led_strip3_color)
led_strip3.show()
update_lcd()
my_servo.angle = 0
#time.sleep(2)
#my_servo.angle = 180
#time.sleep(2)
# Write your code here :-)
Bumper Top
Bumper Bottom
Target Top
Target Bottom
Flipper Top
Flipper Bottom
Launcher
Unique Mechanical Component
Neopixels Bottom
Neopixels Top
Servo Top
Servo Bottom
Scoreboard Top
Scoreboard Bottom
Ball Return Top
Ball Return Bottom
The Launcher starts the game by being pulled back compressing the spring and when released puts the ball into play. The targets increase the score when hit by the pinball, and so does the bumper but the bumper also launches the ball by closing and pinching it away both of these things trigger their own LED strips. The flippers react to a button and when pressed the solenoid attached goes forward flipping the flippers. The servo spins through the game and the ball return decreases the score by 1 when the ball comes in contact with it. Lastly our unique mechanical component spins whenever the ball goes under it.
This has been one of the most challenging projects that I have ever done in life or school due to the length and amount of new things that we had to learn in order to complete this year long project. But I have gained a lot of valuable problem-solving skills as well as better work ethic.
It was great to finally have this huge project complete and to see everything come together to make an amazing pinball machine.
I am most proud of the end result of the project because though we encountered difficulties along the way we worked around them and put everything together to complete the machine and make it work as efficiently and also as well as possible.