GitHub
https://github.com/Inconceivable142/Beer_Pong_Robot
YouTube
https://www.youtube.com/channel/UCLmZAuSpfN231cyCWFEyoQg
How to Almost Build a Beer Pong Playing RobotIn April of 2021 I was looking for a project to spend my ample amount of free time on. For some reason a beer pong playing robot popped into my head. At a high level I envisioned a robot that would use a camera to find cups and fire a ping pong ball at said cups. I decided a Raspberry Pi would be used as the “brain” and would handle the image processing. The Raspberry Pi would tell an Arduino how to orientate the firing mechanism. Having a 3D printer I planned to print a majority of the firing mechanism. Over the next year I would spend my time designing, testing, and redesigning various aspects of the robot in hopes of improving its accuracy. I am writing this to document all of the effort I put into to the project and in hopes of it helping someone else.
Prototype 1I start the first version of my robot by trying to come with a firing mechanism for the ping pong ball. The first thing that came to mind was emulating the throwing action of a human arm with a robotic arm. But some preliminary testing with an already built robotic arm and the power from hobby servos wouldn’t provide the torque necessary to throw the ball very far. I then had the idea of propelling the ball using a fan. I decided to use a spare blower fan from a Christmas inflatable. I started the mechanical with deciding on a rotating base for the robot. I already had the base for the Thor robotic arm (http://thor.angel-lm.com/) and decided it would suite the job. I then went on to design the adapter plate for the base mounting bracket for the launcher, and the launcher itself. In my first prototype the launcher was entirely 3D printed, comprising of a barrel and a hopper. The barrel had a servo with a rack and pinion used to stop the ball and the fan mounted at the end. The hopper also had a servo with a rack and pinion to load the ping pong balls into the barrel. The STL files for my first prototype of version 1 can be found in the following directory Prototype_1/STL_Files. Having the rough prototype of the hardware it was time to focus on the electronics. As stated before the “brains” of the robot would is a Raspberry Pi3 Model B which controls an Arduino Nano used for interfacing with other devices. The base is controlled using a stepper motor driven by an A4988 with a10k potentiometer to track the base’s position, the fans speed is controlled by a PWM driven MOSFET, and the servos are controlled via PWM from the Arduino. The electronics are power by a 12V ac adapter which is stepped down by a dc to dc converter for everything but the fan and stepper motor. I have created a rough schematic for the electronics in the directory Prototype_1/Schematics.
After testing out my initial prototype I found that I was having issue with accuracy. While maintaining the same position and fan speed the launched ping pong balls would be somewhat accurate but not precise. At 8ft(maximum distance of a cup on a regulation table) the balls would make it in the solo cup less than 50% of the time. After a lot of trouble shooting, I hypothesized that the 3D printed barrels surface was fairly non uniform and created random drag when being launched. To solve this issue I bought an acrylic tube with less than a millimeter of clearance for the ping pong ball. I then redesigned the launcher so that the acrylic tube could be used instead of the 3D printed barrel. The STL files for the modified barrel can be found in the directory Prototype_2/STL_Files.
After completing and testing the second prototype I found that while the precision had improved it still seemed below 50%. The data I collected for the second prototype can be found in the directory Prototype_2/Test_Data, and as the data shows my suspicions were correct and shots are only made around 46% of time. Obviously collecting more than 50 samples would have given me a better idea about the actual accuracy and precision, however it gave me enough info to conclude that versus a person the robot would more than likely loose. I then tried to isolate the source of the robots imprecision. I hypothesized that the source imprecision could be caused by any of the following: fan air flow inconsistency, more random effects when traveling through the barrel, random effects of the ping pong ball moving through air with no spin (no Magnus effect), or the ping pong ball is unbalanced due to low the low tolerances of manufacturing. I decided to test the idea that placing a back spin on the ball would result in a more stable trajectory by purchasing a ping pong ball serving machine. The serving machine uses fly wheels similar to a pitching machine to launch the ping pong balls. The reason behind purchasing the serving machine rather than designing my own was I probably wouldn’t be able to match the precision of a commercial product through 3D printing the components. Testing out the serving machine proved that the precision of it was worse than both my prototypes. The serving machine seemed to make shots less than 20% of the time at roughly 4 feet. Back to the drawing board again….
Prototype 3I decided to see if the fan/barrel ball launching mechanism was to blame for the imprecision by redesigning the mechanism. I eventually decided on a catapult to better emulate the action of an arm throwing the ball. The catapult uses a rotating cylinder with springs attached to the throwing arm in order to apply tension. The cylinder is driven by a motor with a worm gear and tracked by a potentiometer. The throwing arm is latched in place by a servo with a rack and pinion while being tensioned. The arm is released under tensioned and stopped by a horizontal bar, propelling the ball forward. The STL files for the catapult can be found in the directory Prototype_3/STL_Files. A couple of changes need to be made to the electronics to facilitate the change to a catapult firing mechanism. An H bridge needed to be added form the worm gear motor and an additional analog input pin was added for the potentiometer. The updated schematic can be found in the directory Prototype_3/Schematics.
Testing the new prototype showed that it suffered from the same imprecision issue as the rest of my designs. After doing some adjusting I found that by adding some padding to the break bar I could increase the precision of the launcher. I also found that adjusting the recess that the ball was sitting in prior launch didn’t affect the precision. I decided to design an auto loading mechanism to facilitate easier data collection. The auto loader consisted of a Halloween bucket, a base with an agitating servo, a series of tubes for the ball to travel through, and a fan to propel the balls.
After collecting 50 samples, prototype 3 was able to make it in a solo cup at 8ft about 20% of time. The test data can be found in the directory Prototype_3/Test_Data.
Video Link:ConclusionAt this point I have spent over a year working on and off on this project only to decrease its precision. In the months following my test of prototype 3, I tried using both a spring loaded piston and compressed air as alternative launch methods. Both of these alternatives failed to produce results that would warrant further interest. Needless to say I am pretty disappointed with the results. I did have fun with this project and it has made an interesting topic to bring up in conversation. Something I didn’t really cover in this log is the software side of things. Outside of controlling it directly via Arduino’s serial terminal, I also wrote a Python script to detect the position of the solo cups using OpenCV and adjust the firing parameters accordingly. I ended up getting pretty good results from the script and the main reason for the ineffectiveness of the entire robot was imprecision of the launched balls. The software I have written can be found in /Software under each of the prototype directories. I haven’t work on the project in a couple weeks and I think it is time to move on to something else. However, if you have any interest in making a beer pong playing robot for yourself feel free to reach out. I am also open to talk about any ideas that could improve the precision of my robot. Thanks for viewing!
Comments