This fun ping pong ball launcher is constructed out of scrap materials and outfitted with some Adafruit electronics, creating a simple and highly entertaining introduction to basic mechanical concepts and coding.

The materials for this project are all things you can find around the house. This project uses the Circuit Playground Express microcontroller programmed in Microsoft MakeCode for easy upload and changes.

Electronic Parts

A Black woman's manicured hand holds a round microcontroller with lit up LEDs.
Circuit Playground Express is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and...
In Stock
USB cable - USB A to Micro-B - 3 foot long
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or...
In Stock
Angled shot of 3 PKcell AAA batteries.
Battery power for your portable project! These batteries are good quality at a good price, and work fantastic with any of the kits or projects in the shop that use AAA's. This is a...
In Stock
Front angled shot of 3 x AAA battery holder with on-off switch and 2-pin JST PH connector.
This battery holder connects 3 AAA batteries together in series for powering all kinds of projects. We spec'd these out because the box is slim, and 3 AAA's add up to about...
In Stock
Video of a CD DVD Spindle Motor spinning.
What's this? A record player for ants?? Not at all! This is a DVD/CD Spindle Motor, that thing that's inside a CD or DVD player, that turns the disc...
In Stock
 Bundle of Small Alligator Clip to Male Jumper Wires
For bread-boarding with unusual non-header-friendly surfaces, these cables will be your best friends! No longer will you have long strands of alligator clips that are grabbing little...
In Stock
Bundle of Small Alligator Clip Test Leads
Connect this to that without soldering using these handy mini alligator clip test leads. 15" cables with alligator clip on each end, color coded. You get 12 pieces in 6 colors....
In Stock
Wheel for Micro Continuous Rotation FS90R Servo
We're keepin' it wheel with this one!Need a great drive solution for your little robotic friends? This black plastic Micro Continuos...
In Stock


For this project you will need:

Before going much further, it's a good idea to make sure our motors and code will work as expected.

For this project we will be using Microsoft MakeCode for Adafruit, a web-based code editor. It provides a block editor, similar to Scratch or, and also a JavaScript editor for more advanced users.

If you haven't used MakeCode before, this guide is a good place to start.

Getting into Bootloader Mode

Your Circuit Playground Express board comes ready to work with CircuitPython. When you connect the board to your computer for the first time, it will appear as a flash (or thumb) drive named CIRCUITPY.


We'd like to make it work with MakeCode, which is done by putting it into "bootloader mode". All that's required to do this is to connect the board to your computer with a micro USB cable and click the small reset button in the center of the board. The available thumb drive should change from CIRCUITPY to CPLAYBOOT. Your code file will be placed on CPLAYBOOT.

The Code

Click this link or enter the portal below to interact with and change the code used in this project.

How to upload code

To upload code, connect you Circuit Playground Express to your computer using the micro USB cable, click the Download button in the above portal to download the .uf2 file to your computer, and drag 'n drop it onto the CPLAYBOOT drive. 

The drive will automatically eject itself. (Your computer may give you a "failed to eject drive correctly" error, you can ignore this.)

Occam's Code

The code for this project is as simple as it gets, and that's ok! All we need is a start and stop function for the servo motor, so we can start and stop firing ping pong balls when we want. 

If you'd like to make changes, such as increasing or decreasing the rate at which balls are launched, you can change the value in the servo write pin A1 block from 180 to something smaller, like 120, and the motor will turn slower, thus launching balls at a slower rate.

Test the Circuit

Once your code is uploaded to Circuit Playground Express, connect the motors (one at a time is easiest to manage), and test that they both respond as expected.

CD/DVD Motor Test

The motor that will provide the power to launch the balls is a DC motor, of the variety originally used in CD and DVD players. This type of motor only needs to be connected to a power source to run, so connecting to a ground pad and power pad on the Circuit Playground Express will automatically start it spinning. 

Use alligator clips to connect the Black wire to GND, then connect a second alligator clip to the red wire and touch the 3.3V pad with the tip. Your motor should respond right away by spinning up to full speed.

Servo Motor Test

The motor that will push the ping pong balls into the path of the spinning wheel is a continuous rotation servo (not to be confused with a regular servo motor, which can only turn 90 degrees in either direction). This motor can't spin as fast as a DC motor, but can be controlled with much greater precision.

Connect the servo motor to Circuit Playground Express by running the:

  • Brown wire to GND,
  • Red wire to Vout, and
  • Yellow wire to the A1 pad

When you press the A Button the motor should start slowly spinning, pressing the B Button will bring it to a stop.


Problem: My motor isn't spinning!

Solution: Make sure that your Circuit Playground Express is connected to a power source (anywhere between 3V-5V is safe). If you're using a AAAx3 battery pack, check that the switch on the battery pack is set to "ON".


Problem: My Circuit Playground Express doesn't show up as CPLAYBOOT!

Solution: Your Circuit Playground Express board comes ready to work with CircuitPython, and will show up as a flash drive named CIRCUITPY the first time it's connected to your computer. To switch over to work with MakeCode, connect the board to your computer with a micro USB cable and click the small reset button in the center of the board.  

When Circuit Playground Express is in Bootloader mode, all the LEDs will flash red briefly, then turn green. Your computer should now show removable drive called CPLAYBOOT. Now you can copy the MakeCode file to the CPLAYBOOT flash drive.

Some prep work is needed before moving on to making the rest of this launcher. 

In this step we will prepare the DC and servo motors so that they will be easy to install later on.

Make a Piston


Glue a small square of cardboard to the end of a 4" length of straw.


Poke a hole in the other end with a piece of wire or paper clip.

Piston assembly


Cut a straight length of metal from a paper clip.


Introduce a 90 degree bend to one end.


Stick this through a hole around the outer edge of the servo wheel and glue in place.


Stick the straw onto the wheel.

Piston Platform


Create a small elevated platform for the servo motor to sit on.


Use a square of double sided tape to stick the servo motor on top.

Adjustable Platform

You may notice this small platform is able to wobble back and forth. This is to our benefit. 

Positioning the piston perfectly can be hard. This small wobble will allow for fine tuning the position of the piston even after it's stuck to the platform. 

Use a Brace


Adjust position of servo motor as necessary so that ping pong balls are just able to fall into place when the piston is pulled back as far as it will go.


Only when you are 100% certain of the position of the piston should you glue the brace to the adjustable platform.

Prepare the Launch Wheel


These wheels come with a grippy rubber ring, which will reliably grab and launch the ping pong balls. 


The wheel centers itself conveniently on top of the CD/DVD motor. Place it on the motor to feel where it engages.


Use hot glue to connect the wheel to the top of the motor. Once the glue has cooled a bit, spin it to make sure it's centered and well-balanced.


At the speeds this will be going, a wobbly wheel is no good. 

The Platform


A fast and easy way to create the 3-dimensional shape we need is to cut a single outline that will be folded into the desired shape.


You have some freedom here, you're not necessarily constrained to follow this example exactly. Any shape with a handle and enough real estate to mount all the electronics on will work just fine.

Cut holes for Motor


Draw the outline of the motor on the edge of the cardboard. Be careful not to position it too close to the handle.


Cut a space for the motor hub to fit.


Cut another hole in the top for the wheel to poke through. This should be long enough for the wheel to poke about 1/4" through the top.

Launching Tube


Cut about 2 inches off the end of a cardboard tube from a paper towel roll.


Cut a small gap from this short piece of tube.


Glue this section of tube over the hole cut for the motor's wheel. This will hold the ping pong ball in place so that the spinning wheel can launch it.

Ping Pong Ball Magazine


Using the remaining length of cardboard tube, trace an arc along the bottom approximately the same diameter of the ball you plan to launch.


Cut along this line, testing that the ball will be able to squeeze through it, but not fall out too easily. 


Glue this to a rectangular section of scrap cardboard (this can be trimmed down later if needed).

Guard Rails


Glue two thin strips of cardboard along the sides of the launcher. This will keep the ping pong balls on course.

When you're finished you should have a cardboard launching platform and a separate magazine platform that will fit nicely onto the launcher. 

At this point we are ready to start adding our electronics to the launcher to get things moving!

Glue Motor


Glue the DC motor into hole you cut earlier.


Feel free to use a lot of hot glue here, this motor will be spinning fast and we don't want it to vibrate itself loose.


Check that the wheel lines up with the hole cut in the top of the platform and doesn't rub against the edges at any point.

Piston Positioning


If you haven't already fixed the position of your piston, now is the time. Position servo motor on platform so that the piston is just at the edge of the opening in the tube when the rotor is all the way back.


Use double sided tape to stick the entire magazine + piston assembly onto the launch platform, aligning it in front of the spinning launch wheel.

Cable Wrangling

Everyone has a different way of managing the cables and wires that come with any electronics project. In this case, it helps to position the battery pack and Circuit Playground Express board on opposites sided of the handle, and use zip ties to keep messy wires held together in tidy(ish) bunches.

Time to have fun! Turn on power to battery pack. Three AAA batteries work well to power this project, though a AAx3 battery pack can be used as well, providing longer run times. 

Press the A Button to start turning the piston.

Create a target, or try to launch the balls so they land in a container, or both!

Press the B Button to stop launching balls.

Exploring further

If you enjoy MakeCode and want to continue exploring you can check out lots more MakeCode projects on the Adafruit Learn System.

This guide was first published on Dec 13, 2018. It was last updated on Mar 08, 2024.