Home » Blog » Beer Pong Robot

Beer Pong Robot

Introduction

For our Mobile Robotics project, we decided to build a robot that plays beer pong. In other terms, it should be able to throw a ping pong ball into a cup which is standing on the same flat surface as the robot. The cup is standing about 2 to 3 meters away from the robot, but the exact distance is unknown initially.

Projectile launched at an angle

Throwing the ping pong ball can be modelled via one of the most fundamental and basic problems of physics, the projectile launched at an angle. Assuming that air resistance is negligible and given the speed and angle at which a projectile is launched, we can exactly predict the projectile curve. In this setting, the mass of the projectile has no influence on the projectile motion.
We decided to fix the angle at 55 degrees. It is a compromise between energy needed to travel, which is smaller at more accute angles, as the balls velocity vector has a bigger horizontal component, and desired landing angle, which should be as wide as possible to land smoothly into the cup.We calculated that throwing a projectile at this angle with a velocity of 5 m/s means that the projectile crosses the launch height at exactly 2.39 m distance from the launch position. This is a typical distance we want to cover in our application. So for the following, let us assume that without air resistance, a launch speed of around 5 m/s is suitable.

 

Air Drag

As a ping pong ball has a relatively low mass, it will be affected by air drag already at low speeds. This effect is a lot harder to calculate than above. We researched the effect of air drag a bit and roughly estimated, including our previous results, that the launcher should be able to produce maximum launch speeds of at least 6 m/s.

Deciding for a launch mechanism

Given the low mass m=2.7g of a ping pong ball, one could assume that not much power is needed to accelerate the ball to the desired speed. However, one has to keep in mind that not only the ball but the whole launching platform that the ball sits on needs to be accelerated to this velocity.
Our first idea was to use a long rotating arm to throw the ball. For speed and position control, we would need a control loop for the motor, meaning that a servo motor would have been suited. However, none of the cheap hobby servos were strong enough for this. Additionally, it seems like this mechanism makes it hard to exactly control the launch angle and position.

Instead, we opted for a spring mechanism. The ball would be launched from a rod with a platform at its end for the ball to sit in. This rod is inside of a tube. The spring is located between the rod and the tube, meaning that when the rod is pulled, the spring will compress. After compressing the spring, it is released, which accelerates the launching platform to the desired speed.

Choosing the right spring 

To allow for the high precision that is required in our application, we need to choose a suitable spring. One requirement is that it fits into the tube and around the launching rod. This can be easily filtered when shopping springs online. However, for good precision, a longer compression range is preferable. As we still need the spring to compactly fit in our design, we tried to optimize the ratio between compression range and length of the spring. This led to a free spring length of 11 cm and a compression range of 7 cm. But, most importantly, the spring needs to have adecuate power for our application. This means it can neither be to strong, which reduces the precision, nor too weak, which may mean that the ball does not fly far enough even at full compression. Luckily, we can estimate the kinetic energy needed to accelerate our launcher to the desired speed and then choose a spring that can store this amount of energy. For this, we first made the assumption that our launcher has a mass of m = 100g, which was a reasonable guess given our first CAD prototype. We use the equations for elastic potential energy and kinetic energy:

We neglect the loss of energy through friction. Inserting the mass of the launcher and the desired speed, the result gives 1.8 Joules. Assuming a spring constant of 2000 N/m, this same energy would be stored in the spring if it was compressed by approximately 4 cm. We filtered our search for the preceding attributes and ordered the following springs:

 

The springs have a free length of 110 mm, diameter of 32 mm, and spring constant of 1850 N/m and 2220 N/m respectively.

Choosing the right motor

Now that we have decided for which spring to use, we need a motor that is capable of compressing the spring to the right position. For this, we need a motor that is both strong enough and precise enough. Thus, we decided to use a stepper motor with a 10 cm screw, similar to the motors used for DIY 3d-printers.

When operated correctly, they allow for high repeatability without needing a feeback loop. The motor we chose has a maximum thrust of 12.5 kg. Converting from kilogram-force to Newtons gives about 120 Newtons of maximum force, which is enough to compress the spring to about 6.6 cm. This is sufficient, considering that we only need to compress the spring between 4 and 5 cm. Another interesting thing we can calculate using the above formulas is by how much milimeters we must change the spring compression such that the ball flies either 1 cm further or 1 cm less far. Our calculations showed that this were about 0.05 mm, which, although very small, should be achievable using stepper motors, which often have repeatibility values of 0.01  mm.

Electronic parts for the robot

Of course, our robot should be mobile, so we needed a wheeled vehicle to mount the launcher onto. We found a mecanum wheel kit which included four mecanum wheels, 4 DC-motors and 2 aluminium plates which form the base of the robot.

We used two different motor drivers to operate the wheel motors. We got a cheap Arduino Starter kit from AliExpress, which contained the Microcontroller, Arduino Uno, Breadboard and Jumper wires.

Additionally, we bought servos, sonar sensors and laser sensors. These sensors were intended for finding out the distance from the robot to the cup. For the launch mechanism, we used solenoids, which have a electromagnet that activates and pulls back a rod when powered.

For these solenoids, we needed a diode to protect the components. Also, for the stepper motor driver, we needed capacitors for voltage spike protection. As the solenoids and the stepper motor driver were rated for 12 Volts, we used a 12 V power supply. For this we bought a power adapter and a battery holder, which holds 8 1.5 V batteries in series. As stepper motors draw a lot of power, we got another battery holder which we could use parallel to increase battery life. Also, we powered the solenoids using a relay module.

These are the main components of the robot.

**** Robot Picture drivable ***

3D-Models

The starting concept for the launcher structure was flawed but provided a general sense of the mechanism. Over a long iterative process, we refined the models.

The main problem here was that the force from the linear motor is not applied coaxial to the launcher structure, which has a bigger strain on the materials and may cause energy losses. Over a long period of time, we changed several things.

  • The composition and structure of the launcher and the tube:
  • The cap, which now has a defined geometry for fixing the ball, which allows for a controlled throw of the ball:
  • Centralizing the stepper motor
  • Small other things for better endurance and stability

For a better understanding, of the mechanical system, the following paragraphs provide assembly instructions for the launch structure.

In the first step, the ramp is fixed (with glue or screws) to the robot base.
After that the linear stepper motor and the solenoids are added.

Then the tube and the components within it (launcher, spring, cap) have to be assembled. First, the spring has to be put in the launcher and then the cap is added on top via a thread. Next, these two assembled components go into the tube.

The end of the launcher with the assembled components will be placed into the end of the solenoid fixture for axial guidance. After that, the tube will be fixed with a screw onto a big support structure, which is screwed or glued to the robot base. The final assembled robot looks like this:

Developing the app for remote control

We used the MIT App inventor to develop the app. We connected the Arduino to the Arduino bluetooth module to receive inputs which could remotely control the robot. As we were using non-holonomic wheels, we manually coded different movement patterns that are illustrated below.

Autonomic Distance Sensing

As the initial distance to the cup is unknown in the beer pong scenario, we need to use sensors to detect it. Additionally, the sensors cannot be at the same height of the cup (parallel to the table) as the own players cups will omit the vision of the sensor. We planned to use a Laser Range Sensor. The Vl53l1X has can detect ranges up to 4 m with high precision, which is perfect for us. It will be attached to a tilting plate which is rotated by a small servo. Thus, it scans the table in direction of the launcher for irregularities, which would indicate a cup standing there. Using this idea, we could detect the distance to the cup as long as the robot is pointing exactly towards it. Then, we could calculate how many steps the stepper motor needs to operate to compress the spring such that the ball flies this exact distance.

Final result

We did not finish the beer pong mechanism yet and are still working on it. However, we have a remotely controllable mecanum wheel robot which can also use a Ultrasonic Sensor for obstacle avoidance.