Overview: The Pong-Bot’s job is bouncing ping pong balls into six tumblers as fast as possible. This task is based on Bouncerchallenge from the old TV game show Minute to Win It (although many people say it reminds them of beer pong). A “race function” matches the robot against a human to see who can complete bouncing balls into six tumblers first.
Background: I was intrigued by IBM Watson beating Jeopardy champion Ken Jenkins a few years ago. So, while we have robots fighting robots and robots, and interacting with people in some way, I didn't see many robots challenging humans in physical skill games. This motivated a robot to challenge human competitors in a physical skill game (bouncing ping-pong balls).
Findings: I'll summarize robot vs. human game outcomes from two Maker Faires in this Instructable, and share some "lessons learned."
Technical overview: The robot operates using an Arduino UNO, two servos, a gear motor, and hall effect, optical, and mechanical sensors. An OLED display reports race results. See System Overview and General Operation for details. Also, because this project evolved over time, I'll share some "lessons learned."
Project difficulty: Good electrical and mechanical construction skills, along with Arduino IDE experience is required. Estimated cost $300, and construction time of at least a couple of weekends.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: System Overview and General Operation
The Pong-Bot game system has 4 main Functional Requirements:
FR1: Robot must bounce ping-pong balls into a tumbler
FR2: Robot moves between tumbler locations (from tumbler #1 to tumbler #2 ...) and returns to initial start position.
FR3: Control a "drag race" between Pong-Bot and human competitors and measure elapsed time to bounce ping-pong ball into each of the six tumblers.
FR4: Coordinate the above functions
Details: FR1: Robot must bounce a ping-pong balls into a tumbler -
Ping-pong balls are stored in a length of vertically inclined 1-1/2 PVC pipe. Balls roll down the pipe bouncing off a plywood base and then fly into a tumbler. A "firing" servo releases a single ball at a time. After release, another servo reloads a ball from pipe upper section to be ready for the next "shot."
Step 2: System Overview and General Operation Cont'd
Details FR2: Robot moves between tumbler locations (from tumbler #1 to tumbler #2 ...) and returns to initial start position. -
The ball drop mechanism just described is mounted to a slider carriage riding on bearings above an aluminum rail (a.k.a camera linear motion system). Carriage is pulled left or right by a chain drive arrangement similar to a "pulley clothesline." When the DC motor rotates the drive sprocket CW the chain pulls the carriage right, CCW pulls it left.
A microswitch, and inner and outer hall effect sensors detecting magnets embedded in the plywood base provide carriage position control. Briefly it works this way: to reach home position (and tumbler #1 firing location), the carriage moves to the left until the microswitch is closed by contact with the carriage edge. To reach tumbler 2 - the carriage moves right until the outer hall effect sensor detects the 1st outer magnet (tumbler #2 firing location), to reach tumbler #3 it moves right again until inner inner hall sensors detects the 1st inner magnet (tumbler #3 firing location) and so on.
Step 3: System Overview and General Operation Cont'd
FR3: Control the start of the race between the Pong-Bot and human competitor and measure how long it takes each to bounce a ping-pong ball into each of the six tumblers.
The race starts with human and Pong-Bot tumblers emptied of ping-pong balls, carriage in the home position, and the PVC pipe filled with 6 balls. Pressing "9" on the keypad displays "Get Ready" message on OLED, and then "1" key press starts the race announced with buzzer and OLED message. The Arduino then controls the DC motor and servos as need to bounce balls into each of the six tumblers. The human competitor is simultaneously bouncing balls into their tumblers ASAP.
IR beam break sensors located in human and robot #6 tumblers detect when a ball falls, thus signalling the end of the race (the buzzer sounds again). The Arduino measures elapsed time from race start until #6 tumbler receives a ball - fastest time wins. There is a 30 second time limit, so even if one or both #6 tumblers do not contain a ball, the race ends anyway. OLED displays the human and robot race times, and declares the winner.
Note - it must be visually checked the balls bounce into tumblers 1 to 5 before bouncing into tumbler #6.
FR4: Coordinate all the above functions
The Arduino UNO takes commands from the keypad and controls all functions, see Control system diagram.
Step 4: Tools, Parts and Drawings
Electric Drill and drill press and drill bit set, 1/4-20 tap
Dremel tool with cut off wheels and milling bits
Solder iron and solder
Hot Glue gun
Wire cutter and stripper
Hacksaw and metal files
Pliers, tin snips, wrenches, and screwdrivers
See file: parts.pdf
Drawings A-H are included in the file drawings.pdf
Step 5: Build Base & Install Magnets
Note: Drawings are in file drawings.pdf, see link in step 4.
Cut 1/2" plywood 42 x 30 inches. I recommend a quality grade of plywood like baltic birch.
Attach 1 x 2 stiffening boards to the bottom with glue and #8 flat head wood screws 1 1/2 inches long (see photo), be sure to countersink the screws in the top plywood surface. Sand the top smooth and round off the corners.
Drill 18, 3/8 diameter and 1/16 inch deep counterbores using a forstner bit, per the DWG-A. Using E6000 adhesive glue the 12 "tumbler" magnets in place - the magnets should be just slightly proud of the plywood surface.
Warning - before gluing the inner and outer magnets in place, you must first identify the magnet's south pole using a compass (see photo). These magnet must be glued in place with south pole facing up (required for hall effect sensors).
Note the location of the human and robot tumbler positioning magnets as called out on the drawing.
Using 5/8 lg. screws and small washer install the extruded aluminum slide track in alignment with its centerline shown on DWG-A. The track should have about 1 3/4 inches overhang beyond plywood's edge (that is the edge nearest tumbler # 6 magnet location).
Step 6: Prepare Tumblers
Cut 12, 1 3/4" dia. circles from 22 gauge sheet metal. Using E6000 glue circles to tumbler bottoms. After the glue cures, test that the plywood mounted magnets (installed in the previous step) hold the tumblers securely on place on the plywood.
Place a ping-pong ball into 2 tumblers and then at an elevation crossing the ball center, drill two 3/16" holes directly across from each other. Using hot glue attach the beam break receiver (3 wires) to one side of the tumbler and the transmitter (2 wires) to the opposite side. Installed a black skirt around the tumbler bottom to shield ambient light. To learn more about the sensors, and get Arduino quick sensor test code, look here.
For each tumbler solder the receiver and transmitter leads to a 3 pin male header like this: red wires to one pin, both black wires to the middle pin, and the single white to the last pin (see photo).
Step 7: Linear Drive Install and Test Hall Effect Sensors
Note: Drawings are in file drawings.pdf, see link in step 4.
Make one idler sprocket bracket per DWG-B, and two idler idler sprocket side plates per DWG-C. three inches from the end of the aluminum slider track, drill a 1/4 inch hole through the track center and through the plywood below. Mount the idler sprocket bracket with 1/4 carriage bolt nut and washer.
Make one carriagemounting block per DWG-D. Per DWG-E, make one each drive chain anchor and cable guard. Center the mounting block above the slider carriage and using the top 2 1/4" holes as a guide, drill and tap 2, 1/4-20 holes in the carriage top. Attach the mounting block, drive chain anchor, and cable guard to the slider carriage with 2 1/2" long 1/4-20 studs and nuts (see) photo.
I used windshield wiper DC gear motor (106 max rpm) cat# DCM-434 from Allelectronics.com. However, it's no longer available from All Electronics, monsterguts.com has a similar motor but it only runs at 50 RPM,so you'll need to increase the driver sprocket proportionately. There may also be other similar motor available elsewhere. Instructions below apply to cat# DCM-434, and hopefully other most other windshield wiper motors.
The motor shaft has two opposite facing flats about 0.32 inches apart, so we need to cut a 1/16 deep matching groove in the drive sprocket. I used a Dremel and metal file, but of course a milling machine would work better (see photos). A M6 bolt attaches the sprocket to the shaft end. Use plenty of loctite red to keep it tight. Attach the motor to the plywood base using a 1 x 2 l wood block, aluminum angle and bracing arm, bolts nuts and washers (see photos). The attachment must be such that the drive sprocket aligns with slider track centerline and motor drive shaft center is about 2 1/2 inches above the plywood base.
Loosen idler sprocket adjustment nut and loop #25 drive chain around drive and idler sprockets. Temporarily attach one chain end to the drive chain anchor with a master link and determine how much you'll need to shorten the chain. Here's a video explaining chain length adjustment and master link installation process. Using two master links attach chain ends to the drive chain anchor, and check that to chain runs true between the drive and idler sprockets, adjust the chain tension using the idler sprocket adjustment nut. Test operation by briefly touching motor leads to a 12 volt battery terminals to move the slide carriage back and forth.
Step 8: Hall Effect Sensors Install
Taking note of hall sensor pinout & orientation of "magnetic sensing side," then solder hall sensor leads to strip board (see wiring diagram). I used 4 conductor telephone wire, about 10" for "bridge section" and 6" for male connector lead wire.
Cut 2 pieces of 1/8" hardboard 1 3/8" by 2 1/2". File a groove at bottom for sensor body, and attach sensor to hardboard with hot glue. Position bottom edge about 1/8" above plywood, attach with small self tapping screws (see photo).
Step 9: PVC Ball Drop Assembly
Note: Drawings are in file drawings.pdf, see link in step 4.
Using 24" long, 1 1/2 PVC pipe cutout sections per DWG-F. I used a Dremel with plastic cutoff wheel.
Per DWG-G, make one top servo mtg. plate and one lower servo mtg. plate. Attached the mounting plates to conduit hangers with 5/16 carriage bolts, nuts and flat washers. Attach servos to mounting plates using double sided tape (see photo). Extend the servo arms with popsicle sticks to provide a 1 1/2" swing radius. Don't worry about positioning of arms on servo shafts for now - we'll adjust position later at the Setup and First Test step.
Per DWG-H make inner and outer PVC pipe support arms from 1/4" by 1" aluminum bar stock. Add two more conduit hangers to top and bottom of PVC pipe per photos. Attach top of support arms to clamps with 5/16 carriage bolts, nuts and flat washers. Attach bottom of support arms to the carriage mounting block with 1/4 hex head bolts, nuts and flat washers. Use flat washers as needed to offset centerline of PVC pipe about 1' from hall effect sensor (se photo). We'll fine tune the offset later at the Setup and First Test step.
Step 10: 12 and 6 VDC Wire Harness
The wiring harness includes: alligator clips for connection to 12 volt battery, volt and amp digital readout gauge, 6 volt regulator to power servos, illuminated main on/off switch, and 10 amp fuse. See photos and wiring diagram.
Drill 2, 1/2" holes in Simpson Strong-Tie 2"x1-1/2"x1-3/8" Angle (A21Z) to house the main on/off switch, and 10 amp fuse (see photos). Attach the angle to plywood base with a small screw and nut.
Note: the Arduino itself is powered separately via a 9 volt AC adapter that plugs into the Arduino barrel jack.
Step 11: Arduino Hardware & Software
Hardware: Three PCBs are stacked on top of each other, starting from the bottom:
- Arduino UNO,
- 10A DC Motor Driver Arduino Shield ,
- Arduino Proto Shield
The DC gear motor leads connect to motor shield terminals. Everything else plugs into to the Arduino Proto Shield, which has no electronic components other than a bunch of connectors (see Connector Layout photo).
Attach the UNO to the plywood base with double stick tape.
Software: Download the sketch bouncerMainR1.ino to your computer then open it up in the Arduino IDE. You'll also need to have 4 libraries installed on the IDE
StopWatch.h you can find the necessary files here
Keypad.h you can find the necessary files here
AXE133Y.h you can find the necessary files here here
Servo.h should already be included as standard with the IDE
Connect Arduino to computer's USB port, and specify broad type and Com port in the usually way. Compile and upload sketch to Arduino UNO. Check that it uploads successfully.
Step 12: OLED Display, Keypad, Piezo Buzzer, Micro-Switch, Battery and Cabling
The OLED display is enclosed in a 4 x 2 x 1 plastic project box, and attached to the DC motor via a long screw, wing nut and hose clamp (see photo). A servo extension cable provides connection with Arduino.
Keypad is attached to a 3" x 5" 1/8 thick hardboard with ribbon cable exiting out the backside through a slot. Keypad Label is taped to the top. The hardboard is attached at the bottom with 2 self tapping to a small aluminum angle.
Piezo buzzer is attached to the DC motor with velcro.
The "Home" microswitch is attached to the plywood base with small screws, and positioned so that the switch is closed by the back edge of the slide carriage when the carriage mounted PVC pipe is aligns with #1 tumbler.
The 12 volt battery is held down with small bungee cords and eyebolts.
For the two IR sensors, and two servos, and two hall sensors, I made cables using 4 conductor telephone wire since each pair of devices required only 4 wires. The hall effect and servo cables received special attention since it must move with the sliding carriage. These cables are attached at one corner of the plywood base and allowed to "fall over" the back edge (see photos). A carriage mounted cable guard keeps the cables from rubbing against the plywood edge. Also see the file ArduinoCableEnds.pdf.
Step 13: Setup and First Test
Arrange 12 tumblers directly on top off their embedded magnets as shown in photo.
Test 1: Double check all connections. Remove the 12 volt battery and servo arms. Just apply power to Arduino. You should see the OLED display "AXE113Y V001 Bouncer Robot".
Test 2: Press "9" on the keypad. You should see the OLED display "Get Ready ...".
Test 3: Connect 12 volt battery, make sure a 10 A fuse is in the holder, and turn main power switch on. You should see the power switch light come on, and the volt/amp gauge display12+ volts and near zero amps. You may also detect slight random movement of servo shafts on initial power up.
Test 4: Press "7" on the keypad. You should see both upper and lower servo shafts move. When the shafts stop they should now be in "ball closed" position, so install the servo arms with popsicle stick extensions (see photo). With arms in place press "7" again to verify the arms move correctly and freely.
Test 5: Place up to 5 ping pong balls in the PVC pipe top. Press "7" once: This should load a ball into the chamber between the upper and lower servos. Press "7" again to release a ball down the pipe and reload another ball into the chamber.
Test 6: Locate the "A" and "B" push buttons at the rear of the Arduino Motor shield (opposite the motor connection terminals). Briefly press "A," the slider carriage should move toward the DC motor. Briefly press "B" the slider carriage should move toward the idler sprocket. If the carriage moves in opposite way, just reverse the motor connections to the shield.
Test 7: Use "A" and "B" push buttons as needed to move the carriage half way between DC motor and Idler sprocket, Now press "8." The carriage should begin moving towards the motor, but before it gets there, manually close the home microswitch. The carriage should stop when the switch is closed, and not move after the switch is released. If this works - press "8" again and check that the carriage comes to a stop when it closes the microswitch (this is the Home Position). Warning when testing carriage motion, always keep a hand near the main power switch in case of malfunction.
Test 8: With carriage still in home position, press "4" - the carriage should move to the first outside embedded magnet, and be more or less align with tumbler #2. Press "6" - the carriage should move to the first inside embedded magnet, and be more or less align with tumbler #3. Press "4" then "6: to move to tumblers 4 and 5 respectively. To get to tumbler #6 press "5." From tumbler #6, pressing "8" should return to home, just pressing "5" should move all the way to tumbler #6 in one motion. Move the carriage back and forth using the "5" and "8" keys and observe the amp reading on the metering - more than 4 amps indicates a problem.
Test 9: With carriage in home position, and load balls into PVC pipe, using the "7" key release balls and check that they bounce into #1 tumbler. Odds are you'll need to make some adjustments - there are 3 type of adjustments available.
a) Moving PVC support arms adjust bounce point and angle of bounce
b) Loosen conduit hangers holding PVC pipe can raise or lower the pipe which effects how high the ball bounces
c) Add or remove flat washers between support arms and conduit hangers will move the "ball bounce point" on the plywood relative to the left or right of the tumbler.
You should aim for a nice arching shot that lands near the center of the tumbler rim. After you can hit the tumbler 6 out 6 times, advance to the next tumbler take another six shots, and so on down the line to tune in the adjustments.
Finally after you have the above three adjustments dialed in you can make small adjustments be moving each tumbler a bit relative to its magnet. With proper adjustment, on a good day, I've observed less than 2% miss rate.
Test 10: With carriage in home position, and 6 balls into PVC pipe:
Press "9" - the OLED should display "Get Ready ... "
Press "1" - the OLED should display "Start ! " and the piezo buzzer sounds. The robot will now fire balls into tumbler #1, then move on to tumbler #2, and so on until finally it bounces a ball into tumbler #6 (you hope!). It typically takes about 15 seconds for the robot to finish. Since a human is not playing this time, nothing else will happen until the 30 second time out limit is reached, then the buzzer sounds again and the OLED displays "ROBOT Wins!" and then displays the Robot and Human times, see photo.
I recommend you replay the game under different scenarios. For example make the human win by putting a ball in human tumbler #6 5 seconds after the start, and so on ...
Congratulations - now the real fun begins !
Step 14: Maker Faire Experience
Maker Faire Detroit July 2016:
I setup the robot Friday afternoon before the Faire started and it was working fine, but on Saturday morning the linear slide mechanism was jammed up. I was able to free it, but it was still straining to move. After several hours it stop functioning completely. I concluded the failure cause was - the Maker pavillon was just a roof over asphalt, and asphalt unevenness translated to out-of-flatness in the table top the robot sat on, which deformed the plywood base enough to cause jamming, and DC motor current spikes killed the electronics. At that time I was using hand built PICAXE PCBs so, repair was not possible.
Based on this experience, I made several design changes:
- Added stiffening ribs to plywood underside.
- Installed commercial linear motion slider system (see comparison photo),
- Replaced hand built PICAXE PCBs with Arduino UNO and Motor shield.
- Switched from IR remote control (which didn't work well in sunlight) to keypad.
- Added Volt/Amp gauge and fuse to main power line.
Northwest Ohio MakerFest Sept 2016:
The improvements made since Detroit were successful, so with no technical issues, I was free to focus on gameplay between robot and people.
Game Basics: There a 12 total tumblers arranged in two rows of six, one row for the robot, and across from that, one row for the human competitor. The object for both robot and human is to bounce ping-pong ball into each of their 6 tumblers ASAP. The robot typically completes the task in 15 seconds, and while it moves slowly compared to humans, it almost never misses. The competition is run drag race style, to see who finishes first. Elapsed time is recorded for both robot and human. I record and post on a whiteboard the fastest human times. There is max timeout limit of 30 seconds, regardless if human and robot are done or not. Humans are allowed a generous number of practice shots before the game starts. Here's an actual game Video .
Less than 10% of people beat the robot on their first attempt, and more the 30% failed to get all 6 balls bounced in within the 30 second time limit.
Six or seven years old appears to be the lower age limit for children to succeed at this game, but above that age, age does not seem to matter much.
Children are more likely than adults to make repeat attempts if not initially successful.
Some people are very competitive and will keep trying until they beat the damn robot.
Miss rate is the key determinate of success in beating the robot, zero misses virtually assures victory. More than 3 or 4 missing makes it tough to beat the robot.
Panic sets in for most people when they see they're falling behind the robot.
A father and son were both able to beat the robot, so they began competing with each other for fastest time. The father prevailed with 5.13 seconds - a world record.
The ping-pong balls will eventually pick up dirt, which carries over to the plywood surface increasing robot and human miss rate - so I try to keep the plywood surface and balls clean.
Conclusions: In my view, robots designed to compete with people in physical skill games provide a playful way for people to experience robot technology.
This project was both challenging and fun in a geeky sort of way. The Arduino UNO and motor shield made sensor interfacing and motion control fairly straightforward.