Introduction: Arduino Laser Pinball

Picture of Arduino Laser Pinball

Overview:

This project uses laser tripwires, solenoids, and erector set parts to build an Arduino controlled pinball machine. Solenoids are used to power flippers that propel the ball around the playfield. Targets consist of “baskets” that hold the ball. Once the ball comes to rest in a target, a laser tripwire automatically triggers a solenoid to eject the ball, putting it back in play. A bell is sounded when the ball is ejected from a target.

Motivation:

In a previous project, Arduino Ping Pong Pinball, I used solenoids and u-brackets to construct a pinball type game. However, in this earlier version, a solenoid had to be manually triggered to eject the ball from a target. Also, the game did not have true “flippers” to propel the ball. Thus I wanted to revamp the game to bring it more in line with a true pinball experience. I originally envisioned microswitch targets and ball lanes with rollover switches. However, a ping pong ball is far too light to trigger rollover switches or even mircoswitches. But a standard pinball is much too heavy to be propelled with the proper speed and too rough on the plastic playfield.

So, a ping pong ball had to suffice. I was able to fashion flippers from various erector set parts: metal rails, spacers, bolts, regular nuts and some self locking nuts. Solenoids are used to produce the lever action for the flippers. I used the “basket” type targets from the previous version, but I still needed a way to eject the ball automatically. That’s when I saw several instructables (Laser Tripwire Alarm, Arduino - Laser Tripwire Alarm System, and Super Easy Laser Tripwire, among others) using a laser tripwire. This worked perfectly as a way to eject the ball from the targets without any action by the player. A bell is sounded each time a target is hit. Once for easy targets, two or three times for the more difficult targets. Score is kept automatically and is supposed to be displayed on an LCD. This worked fine in the previous version, but does not seem to work in the revamped game. The LCD library I am using employs I2C communication through analog pins 4 and 5. But for some reason the display does not work. I’ve included the Arduino code below. Any suggestions as to the problem would be most welcome.

Step 1: List of Materials

Picture of List of Materials

Step 2: Playfield Assembly

Picture of Playfield Assembly

The large plastic platform contains most of the playfield. There are also two smaller plastic platforms involved. One contains the flipper assembly (See step 3) and the other just extends the playfield near the top. The plastic platforms are connected together using small flat plates from the erector set and nuts and bolts. Long thin rails along with 30mm standoffs are used to make the perimeter of the playfield along with the ball launching lane. The targets are just shorter rails and 30mm standoffs arranged to form "baskets" to cradle the ping pong ball. They can be located anywhere you please and should offer a range of difficulty during game play. Just make sure you have enough room to position a solenoid that will be able to eject the ball from the basket. Targets on the perimeter of the playfield take up the least amount of space. The targets in the interior of the playfield take up much more room since the entire solenoid must rest in the playfield. (Another option that I did not try is to mount the solenoids vertically underneath the playfield with an attached bolt extending up through a hole in the playfield as a ball ejector.) Two curved erector set rails made a nice funnel down to the flippers, with a ball drain on either side and a center drain between the flippers, just like on a standard pinball machine.

Step 3: Flipper Assembly

Picture of Flipper Assembly

The hardest part of the project was coming up with flippers that act like the ones you find on a real pinball machine. See the pictures above to see how I fashioned mine. Most of the parts came from the erector set and consisted of two short rails bolted together with spaces. I also had to use some longer bolts along with a spacer to get the correct height when the flippers are mounted on the playfield. The long bolt acts as a pivot for the flipper. A solenoid will pull the short end of the flipper and the long end will propel the ball. The small plastic platform that I used for the flipper assembly is actually part of a robot deck from a retired Trossen Robotics rover. They don't seem to sell these decks anymore, but two holes can just be drilled into whatever plastic platform you happen to be using. The trickiest part was attaching the flippers to the solenoids. The right angle brackets that come with the erector set are too big, so I had to fashion my own using the duct strap mentioned in the list of materials. Just use tin snips to cut out a section of two consecutive holes and trim it down as small as you can. One of the holes was too big for the head of the bolt I was using, so I had to fashion a small "washer" using a section of the duct strap near one of the smaller holes. See the detailed figure above. Use these homemade right angle brackets to connect the short end of the flippers to the extended end of a medium solenoid. The flippers are attached to the plastic platform from below using a small erector set rail and a self locking nut. See the last picture above. The self locking nut should allow the flipper to swing freely, but the flippers do stick on occasion. Two erector set parts are used to make the two vertical platforms that contain the flipper buttons. Again, see the photos above.

Step 4: Laser Tripwires

Picture of Laser Tripwires

The laser tripwires consist of a laser at one end shining directly onto a photoresistor sensor at the other end. To make the photoresistor sensor, take a 3-pin sensor cable with a 10K resistor inserted into the signal and ground openings and then bend it back out of the way. Next, insert the photoresistor into the signal and voltage openings. See the third figure above. Finally, wrap the whole thing in electrical tape to avoid shorts. Now position the laser/sensor pair on a playfiled target so that the laser beam is broken when the ball comes to rest in the target. We will use the broken beam to trigger the solenoid to eject the ball from the target and advance the game score. I used nuts, bolts and short erector set rails to attach the lasers and sensors to the playfield in the appropriate places. I had to wrap the laser modules in electrical tape since they had a lot of exposed metal that could cause shorts. See the figures above.

Step 5: Electrical Circuit

Picture of Electrical Circuit

The basic electrical setup is given in the diagram above. I didn't have room to show all of the connections, so I just put in representative ones. The Arduino and the lasers are powered by a 6 volt supply and the solenoids run on 12 volts. The flipper buttons are attached to pins 2 and 3. The ball shooter button is connected to pin 4 and the LCD reset button to pin 5. The relays controlling the bell, left flipper, right flipper, ball shooter, left target, center left target, center right target and right target are attached to pins 6 through 13, respectively. The photoresistor sensors for the left target, center left target, center right target and right target are attached to analog pins 0 through 3, respectively. Analog pins 4 and 5 are used for the RobotGeek LCD module, but, again, I have not been able to get this to work. A solenoid is positioned next to the call bell so that it rings the bell when the solenoid is activated.

Step 6: Arduino Code

Picture of Arduino Code

The Arduino code is contained in the file below. It is an adaption of two files available from Trossen Robotics, "Controlling a Solenoid with Arduino" and the LCD file "Hello World." The only problem was that a laser beam was often broken when the ball bounced into and then out of a target without coming to rest. This type of activity should not trigger the solenoid and should not advance the score counter. To overcome this I just use a one second delay. For each target, there is a test to see if a laser beam is broken. If it is, I delay one second and test again to see if that laser beam is still broken. If it is, I assume that the ball really has come to rest in one of the targets. I then fire the appropriate ejection solenoid, advance the game score, and ring the bell. The easiest target to score is the center right target. It is worth 10 points and rings the bell once. The left target is worth 50 points and rings the bell twice. The center left and the right targets are the hardest to score. They are worth 100 points and ring the bell three times. Finally, some calibration is necessary to set the appropriate target thresholds that tell the Arduino when a laser beam has been broken. I use serial communication to send the readings from the analog pins (attached to the photoresistors) to the computer screen. When no laser is hitting a photoresistor, I get a reading around 700. When a laser is hitting a photoresistor, I get a reading around 900. Thus I made a threshold value of 800 and test to see if an analog pin reading is below the threshold to determine if a laser beam is broken.

Step 7: Game Play

Picture of Game Play

The ball shooter button is pressed to begin the game. This sends the ball up the ball launching lane and into the playfield. The ball can exit the playfield through the center drain between the flippers or through either of the two side drains. Flippers keep the ball in play and (hopefully) send the ball into one of the targets. I use a call bell rung by a solenoid to indicate a successful target hit. The more difficult the target, the more times the bell rings. You could also use something like a wave shield to provide more advanced audio, like that used in modern solid state pinball machines, but I actually prefer the "low tech" sound of the old school electromechanical pinball machines. A game can run until the ball has drained off the playfield, say, five times. The score reset button can then be pressed to reset the LCD. A nice thing about this game is that you can reposition the location of the targets whenever you want to create a whole new game. Game play can be made as easy or as difficult as you please.

Comments

kooth (author)2016-12-01

Very cool! I gotta build one! Thanks for posting!

joesinstructables (author)kooth2016-12-01

Thanks! I'm glad you enjoyed it.

About This Instructable

3,918views

27favorites

License:

More by joesinstructables:Snake RobotArduino Quadruped RobotArduino Laser Pinball
Add instructable to: