Engineering Applications
Stop Light LED's
In class, We learned wiring practices and received breakout boards to practice our wiring. We were given three LEDs to make light up separately such as a stoplight. We used a software called mu editor to program the Pico.
Chaser Pattern
We programmed our Pico to consecutively light up the LED's on our breakout board into a chaser pattern. We used our serial monitors on the Mu Editor software to troubleshoot and get it working. GitHub Code
Start Button
For a pinball machine, the start up button lights the machine up, puts the scoreboard up, and it puts the ball into the launch lane. To the left is a video of the button in action.
Launcher Button
The launcher is a mechanical, spring-driven ball propeller that is manually used to push the ball into the machine's primary mechanism. You can pull back the handle of the launcher that hangs out of the device, When you release the handle it uses a spring mechanism to launch the ball into play.
Target
In pinball machine, a target is a special spot to hit with the ball for points and it might activate different features within the pinball machine. When the ball hits the it sends a signal using a sensor to the machine to give points. Typically the balls can drop down and will stay down til the game is restarted.
There's a rod that has ground so when the ball touches both, thats when its triggered .and it closes the loop. When the solenoid recieves a signal that the circut is closed it slams on the ball sending it at high speeds into play.
Target
In pinball machine, a target is a special spot to hit with the ball for points and it might activate different features within the pinball machine. When the ball hits the it sends a signal using a sensor to the machine to give points.
Drawing Practice: Stairs
Drawing Practice: Scoreboard Mount
Drawing Practice
Drawing Practice: Rectangles and Circles
Drawing Practice: Stairs
We used rectangles and the duplicate tool to make a staircase in onshape.
Drawing Practice
We made a square with two rectangles which are the same size
Drawing Practice
We made a large rectangle and on the inside we made squares on the inside using the duplicate and mirror tool.
Drawing Practice: Rectangles and Circles
We made 2 corner point rectangles and inside of the rectangles we added tiny circles.
Flipper Research
Video 1
Video 2
Video 3
The function of a pinball flipper is used to make the ball move and hit other things on the board. To know if my or flipper is successful, I would check a few things. First, it should hit the ball with enough force to send it all the way down the pinball. Second, it should work every time I press the button. Third, it shouldn't break off or wear out too quickly. And lastly it should be . If it does all these things, then I'd consider my bumper or flipper a success!
code
import board
import digitalio
import time
import busio
import pwmio
from adafruit_motor import servo
# 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.GP3, duty_cycle=2 ** 15, frequency=50)
# Create a servo object, my_servo.
my_servo = servo.Servo(pwm)
# 0 == LED off and 255 == full brightness
target1 = digitalio.DigitalInOut(board.GP11)
target1.direction = digitalio.Direction.INPUT
target1.pull = digitalio.Pull.UP
target2 = digitalio.DigitalInOut(board.GP4)
target2.direction = digitalio.Direction.INPUT
target2.pull = digitalio.Pull.UP
target3 = digitalio.DigitalInOut(board.GP5)
target3.direction = digitalio.Direction.INPUT
target3.pull = digitalio.Pull.UP
ballcount_button = digitalio.DigitalInOut(board.GP13)
ballcount_button.direction = digitalio.Direction.INPUT
ballcount_button.pull = digitalio.Pull.UP
leftflippersolenoid = DigitalInOut(board.GP15)
leftflippersolenoid.direction = Direction.OUTPUT
leftflippersolenoid.value = False
leftflipperbutton = DigitalInOut(board.GP22)
leftflipperbutton.direction = Direction.INPUT
leftflipperbutton.pull = Pull.UP
rightflippersolenoid = DigitalInOut(board.GP26)
rightflippersolenoid.direction = Direction.OUTPUT
rightflippersolenoid.value = False
# Initialize the flipper button as an input
rightflipperbutton = DigitalInOut(board.GP16)
rightflipperbutton.direction = Direction.INPUT
rightflipperbutton.pull = Pull.UP
bumper1_solenoid = DigitalInOut(board.GP20)
bumper1_solenoid.direction = Direction.OUTPUT
bumper1_solenoid.value = False
# Initialize the flipper button as an input
bumper1_button = DigitalInOut(board.GP19)
bumper1_button.direction = Direction.INPUT
bumper1_button.pull = Pull.UP
bumper2_solenoid = DigitalInOut(board.GP21)
bumper2_solenoid.direction = Direction.OUTPUT
bumper2_solenoid.value = False
# Initialize the flipper button as an input
bumper2_button = DigitalInOut(board.GP18)
bumper2_button.direction = Direction.INPUT
bumper2_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)
def update_lcd():
if score != old_score or ballcount != old_ballcount:
lcd.clear()
lcd.set_cursor_pos(0, 1)
lcd.print("Your 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("Score: ")
lcd.print(str(score))
lcd.print("Ball Count: ")
lcd.print(str(ballcount))
time.sleep(0.05)
lcd.set_cursor_pos(0, 0)
#lcd.print("Starting Pinball")
#time.sleep(4)
while True:
my_servo.angle = 180
#print(ballcount_button.value)
if target1.value == True:
score = score + 10
print ("target1 is pressed")
if target2.value == True:
score = score + 5
time.sleep(0.5)
print ("target2 is pressed")
# else:
if target3.value == True:
score = score + 5
#print ("target3 is pressed")
#else:
#print ("target3 is not pressed")
if ballcount_button.value == False:
ballcount = ballcount - 1
if ballcount == 0:
lcd.clear()
lcd.set_cursor_pos(1, 2)
# time.sleep(2)
score = 0
update_lcd()
ballcount = 3
#print("Ball count Button is PRESSED")
#time.sleep(0.075)
# time.sleep(0.05)
if (leftflipperbutton.value == True):
# The input has a pull up, so this means
# the value is True when the button is not pressed
# print ("leftflipperbutton is not pressed")
# time.sleep(.01)
leftflippersolenoid.value = False
else:
# The button is pulled to ground, so the switch is pressed
# print ("leftflipperbutton is pressed")
leftflippersolenoid.value = True # Make the screen scroll sideways
#print ("leftflipperbutton is not pressed")
#time.sleep(.01)
if (rightflipperbutton.value == True):
# The input has a pull up, so this means
# the value is True when the button is not pressed
rightflippersolenoid.value = False # Make the screen scroll sideways
# print("not pressed")
#print ("rightflipperbutton not pressed")
#time.sleep(.01)
else:
# The button is pulled to ground, so the switch is pressed
rightflippersolenoid.value = True
# print ("rightflipperbutton is pressed")
#time.sleep(.01)
if (bumper1_button.value == True):
# The input has a pull up, so this means
# the value is True when the button is not pressed
bumper1_solenoid.value = False
else:
# The button is pulled to ground, so the switch is pressed
bumper1_solenoid.value = True
if (bumper2_button.value == True):
# The input has a pull up, so this means
# the value is True when the button is not pressed
bumper2_solenoid.value = False
else:
# The button is pulled to ground, so the switch is pressed
bumper2_solenoid.value = True
update_lcd()
#time.sleep(2)
# Write your code here :-)
Final Pinball Documentation
This project allowed more creative design freedom and independent exploration than most structured school assignments or personal projects. It required a mix of structured research and innovative thinking, making it unique. Completing this project felt incredibly rewarding. It brought a sense of accomplishment and relief after overcoming various challenges and seeing the hard work come to fruition. I'm most proud of the innovative solutions and the project outcome. The project reflects my ability to think critically and work diligently, showcasing my skills and dedication.
Bumper top and bottom
A bumper is a spring-loaded component that reacts when hit by an object, like a ball. When the object strikes the bumper, it compresses and then quickly rebounds, pushing the object away with force.
Servo top and bottom
A servo is a motor with a feedback mechanism that allows precise control of its position. It can rotate to a specific angle and hold that position, commonly used in robotics for movement and positioning tasks.
Flipper top and bottom
A flipper is a lever-like mechanism that flips or rotates when activated, often used in pinball machines. It's powered by a solenoid or that moves it rapidly to hit or deflect the pinball.
Target
Target
A target in a pinball machine is a designated spot or object that the player aims to hit with the ball. Hitting targets often scores points or triggers specific game features, like lights or bonuses.
Launcher
The launcher uses a mechanism to propel an object (like a ball) into the air. It typically involves a spring or a motor that provides the necessary force to launch the target.