Introduction: Golf Ball Dispenser

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (

Hello fellow makers,

The following steps are detailed instructions and information regarding my project for the Makecourse.

My project is a ball dispenser activated by a proximity sensor and controlled by an arduino.

The attached file is the video of my 3D animation so you can see how it all works.

Step 1: Knowing the Requirements and Picking a Topic

The requirements for this project are simple:

  • It has to include at least one 3D printed part
  • It must move in some way
  • It must incorporate the project box
  • Lastly it has to work, and work well!

Next you must pick a topic. I am an avid golfer so I knew I wanted to make something related to golf. Originally I wanted to make a motorized golf swing simulator. But after realizing the amount of difficulty in that task I settled on making a ball dispenser. That last part brings me to a good tip: Know your limitations!! There are definitely limitations to 3D printing and also the micro controller, motors, and sensors.

Step 2: Creating a Design

Now that you know what you want to make you can start designing.

I chose to use Solidworks because I am most familiar with it.

Since we had to use the project box, our teacher provided us with the files for the box that can be opened in Solidworks.

I then Found a 3d design of a golf club on the website

I edited this golf club part in Solidworks to be able to attach to a horizontal shaft so that it could be rotated around the horizontal axis like you would normally swing a golf club.

I had to design a "housing" to hold the golf club shaft and be hollow inside to attach the rubber band that gives tension to the golf club.

Then I designed the ball dispenser. I had made a similar mechanism before this project so this was the easy part for me.

Next, I had to decide where all of the pieces were going to go onto the top of the project box.

You need to make the cut outs into the top so that the rubber band can go through as well as the shaft of the ball dispenser.

My Solid works part files are attached below.

Step 3: 3D Printing

Once you have all of your files finished to your liking you need to have them printed.
To do this I had to save all of my files in the .STL file format and then I took them to the "Advanced Visualization Center" on campus where they have multiple 3D Printers.

When I took the files there they put them into the Makerbot software and put them in the best orientation for printing.

After about a week I went back and was able to pick up most of my parts.

There was only two parts that had to be re-printed.

One was the housing because it fell over during printing and the other was the golf club because it got stuck to the build plate and broke when they took it off. They kindly reprinted the broken parts for me and a few days later I had all of my parts.

Now that I have all of the main moving parts I need to decide what is going to move all of these parts.

P.S. If you don't have access to a 3D printer there is a website called and they will take your files and give you a quote to have them printed by someone in your area. I have used this service before and had an excellent experience.

I have attached the .STL files below

Step 4: Creating a Control System

You will need an arduino Uno or similar to control everything. Now that you know what parts are going to move on your project you can decide what motors and sensors to use. For my project I needed two servo motors. One motor was small to fit inside of the ball dispenser, the other servo was a large servo to spin the whole dispenser. I knew that my big servo was going to need an external power supply because of the current draw. This power supply needs to be 5V and close to 1A. I found a old barrel type charger for an old camera I didn't have anymore so I cut off the connector and soldered on pins to the positive and negative wires. Also, due to the project requirements I needed to have a proximity sensor connected as well, to make my ball dispenser move.

Step 5: Programming the Control System

For this you will need to download the arduino IDE which is just the program that you type the code into.

To start writing my code I needed to have a basic Idea of what I wanted everything to do and how it needed to work together.

So these are the steps that need to happen:

  1. I need a proximity sensor reading to determine if I need to start the motor loop
  2. "IF" the reading is less than a specified distance I need the big servo to spin the dispenser infant of the golf club
  3. Make the small servo push a ball out towards the bottom hole
  4. Then make it retract back to the original position
  5. Now turn the big servo back to its original position
  6. end the loop and start reading the sensor again

To read the sensor I used a code from a previous assignment for this class.

Then I wrote an "If" conditional statement that took the reading and determined if it was less than or equal to 5cm.

If it is then move the big servo to 120(my servo needed to be set to 120 just to rotate 90).

Then delay a few milliseconds .

Now move the small servo out (then delay) and back.

Then end the loop and delay 200 milliseconds for the next reading so that if the conditional isn't met it gets a reading ever 200 milliseconds.

Step 6: Assembly

With the coding and the printing finished you can start to assemble parts.

For this you will need:

  • Epoxy or super glue (or both)
  • Some clamps to hold the parts together during gluing
  • Some thing to make motor and sensor mounts out of
    1. The best mounts would be 3D printed. I chose not to print mounts because the AVC was too busy and I wouldn't have received them in time to finish my project.
    2. I chose wood but you could use foam or acrylic (foam would be the easiest but least sturdy)
  • Tools to cut the prices of wood
  • Some sand paper or files to smooth out prints (acetone vapor can be used to smooth out abs, I did not do this)
  • A cotter pin to hold the golf club to the shaft
  • Something thin and soft (I used a small pice of velcro, fuzzy side up) to hold the ball for the club to hit
  • A bunch of airsoft bbs or something similar to use as "golf balls"
  • A lot of PATIENCE!!!!!!

To start, take the ball dispenser shaft and put it though the cut out in the box top. Then glue it to the servo horn for the big servo using clamps to hold them together. Then glue the club housing to the box top. Now you can start to put things together. While assembling the golf club to the shaft I broke the 3D printed shaft. I decided to buy a thick metal pin to replace the printed one. The one I found was A little too long so I drilled out the hole in the golf club attachment box so that the pin could stick out the front.

Then I made mounts for both of the motors out of pieces of wood. I cut them close to size and then filed and sanded them down to the right shape.

Next I cut holes in the side of the box for the proximity sensor.

I then ran the wires to all of the components. Once this was done I put the mounts in their places and adjusted them as needed. Next I glued in the mounts and screwed in the motors. Then you can glue the velcro to the box top where the ball lands so it will hold it in place for the club to hit. The Only thing left to do is connect the rubber band for the golf club I pushed the rubber band through the hole in the shaft and then glued a block of wood to the underside of the top with a hook in it for the rubber band to go around.

Now you can just put the top back on the box making sure the wires are in the correct places and then push the servo horn (that is glued to to dispenser) onto the servo inside the box.

Step 7: The Finished Product

It may take some tweaking to get it in just the right spot and to change some of the code values.

But once it is adjusted it will work very well.

Thanks for reading,