Introduction: Homemade Table Tennis Robot for ~$230
After looking around at a bunch of table tennis robots out there to help me practice, I decided to make it a fun project with my wife to build one of our own with a feature-set that was similar to or better than what was already out there. It's been a long on-and-off development cycle, but it's finally to the point of being usable. It utilizes a dual-wheel ball thrower with vertical, horizontal, and rotational servos. It is currently controlled by an Arduino Mega 2560 microcontroller, but I have plans to change that to a Teensy 2.0. Drills are created on a PC using a simple Java application and then saved to an SD card. The Arduino displays available drills on an LCD interface and a standard TV remote is used to select the drill and start/stop it. Power is provided by a standard ATX computer power supply (both 5V and 12V).
I had originally started this project with the intention of making everything hand-made using off-the-shelf parts from the local Home Depot/Lowes, but it quickly became apparent that anything made would not be easy to reproduce so that was idea was scrapped. We then went the route of home fabrication with a 3D printer and purchased a Reprap Prusa Mendel from Makergear to help make any parts that we modeled on the computer. This has been absolutely essential to making this design work :-) So, there will be some parts obtained at a local Home Depot/Lowes and some purchased online. All-in-all, the total Bill of Materials comes to about $230 without shipping. BoM is attached below (as both a PDF and XLSX).
Summary of construction
I will break this out into three main components: frame/ball path (including PVC and custom parts), electronics, and software. To complete this project you will require basic hand tools, a wood saw, a drill, measuring tape, stapler and staple gun, a 3D printer (or printing service), soldering iron, multimeter, and a PC with a USB port (and an SD card reader/writer if you want to use customized drills). While not necessary, I found it much easier to utilize a custom PCB to mount all the electronic components (LCD/SD/resistors/servo leads/etc) - to do so, you'll either need a laser printer and chemicals to do etching, a CNC mill for PCB milling, or utilize a PCB creation service.
1) The larger the throwing wheel, the slower it needs to spin since as the wheel gets larger, the linear speed at the outside diameter will increase while the angular speed remains the same. This being said, a larger wheel allows for better granularity of speed as well as quieter operation (lower motor RPM). The downside is that the throwing head needs to be a bit larger.
2) If you throw a ball with absolutely no spin (in table tennis this is a dead ball, in other sports it may be known as a knuckle ball) it will fly very erratically and be incredibly inconsistent. Rather than throw deadspin balls, I found it was better to throw a _very_ light backspin ball so it would fly consistently and be almost dead once it hit the table.
3) With the speed controllers I have selected, if the motor is spinning and is stopped for any reason (too much load, reversed without stopping first, someone held the motor, etc) they will not spin the motor again until they are brought back to neutral (0) throttle. I think this is a safety feature to prevent overloading of the speed controller if the motor is stuck or dead.
4) Due to the nature of FDM (fused deposition modeling - a method of 3D printing), the parts can sometimes be weak along the printed axis. As an example, let's say you printed a cup as if it were placed vertically on a table. If you were to pull the top and bottom in opposite directions, they would come apart quite easily along a layer seam. With this in mind, it can be beneficial to lightly coat certain stress points with plastic cement (hobby glue) to help increase strength. Such places to coat would be hinge tabs, screw holes, etc.
Step 1: Robot Construction
The main frame assembly is simply some 2x4, 1x2, plywood, and brackets/screws, so it's pretty simple to put together. Here are some generic notes about the assembly:
1) The pieces of 1x2 that the ball trays attach to are slanted downwards at about a 2-3 degree angle to help the balls roll towards the opening.
2) The pieces of 1x2 that mount the agitator servo only have a single screw per piece so that they can pivot upwards in case of some stubborn balls. There is a screw going into the main frame piece just beneath the 1x2 to prevent the 1x2 from drooping too far down.
I have attached the stl files (and reference images) for the printed parts as a zip to this step. Other than that, please follow the detailed images for assembling the robot! Feel free to ask any questions if you need clarification.
Step 2: Assembly Diagrams
On this step I have all of the assembly images. I also attached a zip of the PDF files which can be zoomed in a bit more if needed. Please let me know if you need clarification anywhere!
Step 3: Electronics
At the heart of the electronics is ATX power supply. We will be using two voltages from this power supply: 5V and 12V. A standard ATX has several molex connectors (usually the whitish 4-pin connectors) that have both the 12V (yellow) and 5V (red) feeds. The 12V feed is used to power the Arduino and the main ball throwing motors, and the 5V feed is used to power the servos. A note on getting an ATX power supply to actually power on: computers tell the power supply to operate by connecting the green wire in the large 20(or 24)-pin connector to ground - you can do the same with a paperclip by bridging the green wire to a black wire.
At the moment I am using an Arduino Mega 2560 to control the robot, but I have plans to port that over to a Teensy 2.0 since it is considerably cheaper, has a smaller footprint, and I can still use the Arduino IDE.
There are five servos used in this robot. Two high-torque servos are used for the ball feed/vertical positioning, and three moderately torqued servos are used for rotation/horizontal positioning/ball agitation. The servo for ball agitation needs to be modified to be a continuous rotation servo: http://www.acroname.com/robotics/info/ideas/continuous/continuous.html Alternatively, you can just purchase a servo that is already continuous rotation (such as a Parallax 900-00008), but they cost a bit more.
The motors that I chose are hexTronik DT700 brushless outrunner motors. I went with brushless motors because of longevity requirements, and as a bonus these are quieter and more efficient than most brushed motors. The speed controllers are HobbyKing SS Series 25-30A brushless ESC and are controllable via the standard Arduino servo library. Finally, since these speed controllers are not reversible, I have two DPDT relays (TE Connectivity RTE24005F) to reverse the motors for excellent spin :-)
These items are nice to have, but not strictly necessary to get a ball-flingin' robot :-) The LCD is a standard 16x2 character that is well used in the Arduino community. The SD card is pretty well standardized, and I chose a pre-assembled module so I didn't need to purchase any additional resistors/mounts/etc. The IR sensor is great to control the robot remotely with a standard TV remote - you don't need to program it, just press any three buttons when the robot is powering up to let it know what you want to use for up/down/enter! Finally, the custom PCB is not really necessary, but it sure makes assembly easier!
Most of the effort here is in connecting the devices to the Arduino for operation, so it's easier to show you the layout that I generated in CADSoft Eagle. I have also attached the Eagle project file if you wish to make the board yourself and/or get more clarification on where things are connected. The large areas of blue are ground planes. Again, I'd like to note that this is for the Arduino Mega 2560 and I will eventually modify this for the Teensy 2.0. As for other connections that need to be made that are not displayed here:
1) 12V output from power supply goes to Arduino power input (I used a power plug from Radio Shack) and to the speed controllers.
2) 5V output from power supply goes to 5V input on board (for servo use). It is important that you do not try to use the Arduino 5V output to power the servos as it cannot handle the load the servos will require.
3) Brushless motors and speed controllers have three leads. One lead from the speed controller goes directly to the motor. The other two go to the input for the relay - we do this so we can reverse the direction of the motor. See image below for more information. We control the relay with the circuit shown on the board (see here) - the 5V along the top side of the board near the 1N4004 goes to the relay input and the two empty holes just below the 1N4004 go to the relay ground. There are two motors, so we need two relays and two control circuits (note the two transistors/resistors/diodes on the board). For more info on DPDT relays, please read the Wikipedia article for lots of info :-)
4) The LCD that I used was the same one used by Adafruit. A potentiometer is required to adjust contrast on this particular model, but I placed that close to the LCD so I only needed 8 wires (CAT5 ethernet cabling) to connect the Arduino to the LCD.
5) The SD card module that I used already had resistors in place, and you can even use a MicroSD module if you wish. However, if you have a plain old SD slot that you want to use, please be sure to use the proper wiring/circuitry to prevent damage to the SD card!
Step 4: Software
The software section will be split into two parts: the Arduino/Teensy software and the Java application to design the drills to be stored on the SD card. I still have a bit of work to do for the all-in-one control software (conversion to Teensy), so for the time being I will post the Arduino code that I have for testing the robot. It's pretty simplistic, but it works! :-)
Full program coming soon. Attached below is a testing application.
Participated in the
Make It Real Challenge