It doesn't take a long road trip to experience the joys of miniature golf. Just a few cardboard boxes, craft supplies, a couple of servos, and a Circuit Playground Express with CRICKIT programmed with MakeCode can bring a whole obstacle course to life.

Materials & Tools

To build this project, you will need:

  • Medium-sized cardboard box (to make the course)
  • Scrap pieces of cardboard (to make the obstacles)
  • Scissors and/or X-acto knife
  • Double-sided tape
  • Popsicle sticks 
  • Golf ball (or ping pong ball) and golf putter

Adafruit Parts

1 x Adafruit CRICKIT for Circuit Playground Express
Creative Robotics and Interactive Construction Kit is an add-on to Circuit Playground Express that lets you #MakeRobotFriend using CircuitPython and MakeCode
1 x Circuit Playground Express
Circuit Playground Express is the perfect introduction to electronics and programming
1 x Micro servo
This little servo can rotate approximately 180 degrees (90 in each direction). Works just like standard servos you're used to, but smaller.
1 x DC Gearbox Motor - "TT Motor" - 200RPM - 3 to 6VDC
TT DC Gearbox Motor with a gear ratio of 1:48 and 2 x 200mm wires with breadboard-friendly 0.1" male connectors
1 x USB cable - A/MicroB - 3ft
Standard A to micro-B USB cable
1 x 3xAA holder with DC jack
Battery holder 3xAA batteries with 2.1mm DC jack
1 x Alkaline AA batteries - 3 pack
These batteries are good quality at a good price, and work fantastic with any of the kits or projects that use AAs.

CRICKIT Assembly

If your Circuit Playground Express and CRICKIT aren't already connected, now is the time to do that.

The animation below demonstrates how the two become one.

Unboxing the box

Just about any medium sized cardboard box can work for this project. 

To prepare your box, first cut through any tape on the top and bottom so that the flaps are free.


Find the seam and gently pull it apart.


Unfold the box so it lies flat. 



Two-tier obstacle course

Cut off two flaps from one of the middle sections of the box. These flaps will be made into supports for our course.


Take these two flaps and cut about a 2 inch rectangle off the end.


Use scissors to make a 1 inch cut in the center of both pieces of cardboard.


Slot these two pieces together at 90 degrees to each other.


Press firmly together.


Now we have two free-standing supports! These will allow us to add a second level to our mini golf course.

Slide these two supports under the end of the unfolded box.

This forms the foundation of our mini golf course.

Obstacles can now be added onto the course! 

Mini golf is all about navigating through obstacles to get your ball in the hole.

Below are four obstacle challenges which can be built out of cardboard, paper, tape and glue. We will use CRICKIT with Circuit Playground Express to control these obstacles, and learn a bit of MakeCode along the way.

These obstacles can be used more or less interchangeably. Position them to make your course as easy or difficult as you like!


You can cut out a 2-blade or 4-blade windmill, depending on the level of difficulty you want.

Making the frame


First, we'll need to make a frame on which to mount our spinning windmill.


Take a piece of cardboard about 12 inches tall and 20 inches wide.


Cut out a rectangle from the bottom, leaving 2-3 inches from the outside edge.


Poke a hole in the center of your frame.


Using the excess piece, cut out two new sections of cardboard about 2"x4". These will be used as stabilizing feet for the frame. 


Use scissors to cut 1" slits in the center of the feet and the bottom of the arch.


Align the slits in the two pieces of cardboard and press together. Your windmill frame can now stand on its own.

Mounting the motor


Stick DC motor hub through center hole you added earlier.


Use something pointy to mark the motor's mounting hole positions.


Use a twist-tie or piece of solid-core wire to cinch the motor to the cardboard. 


Screw windmill blade to motor hub.

Once connected to CRICKIT, your windmill will be spinning in no time!

Swinging Gate

Cut a rectangular strip of cardboard, about 2" x 8".


Cut a strip of double sided tape, about the length of one popsicle stick.


Tape cardboard gate to one side of the popsicle stick, and tape the servo horn to the other side.


Trim the corners off the gate. This will help prevent it from colliding with anything as it swings up and down.


This gate is now ready to mount on your servo motor!

This servo-powered gate will be programmed to go up and down in a pattern that you control.

Ball Return

This obstacle is all about accuracy. Not only must you get past all the obstacles, but also aim your putt so the ball goes in the hole. 

The slinky can also be positioned to conveniently return the ball to you.

Cut out an arc of cardboard on which to mount the slinky. This will support the slinky as the ball passes through it.


Tape the ends and middle of the slinky to this cardboard.


A small square of cardboard can be added at the end to further direct the ball as it exits the slinky.


The ball return will be mounted at the very end of the course. Use the slinky to mark the location and diameter of the hole.

Save yourself from chasing down your ball after making a hole in one. This slinky return chute will send it rolling back to you.

Extra Credit: 360 Loop

This loop requires the use of hot glue and is trickier to build than the previous obstacles.

Determined makers read on...

WARNING! BURN HAZARD! Hot glue is very sticky and it's easy to accidentally burn your fingertips. Be careful when using it.

To build a loop, find two circular objects, one about 1" larger in diameter than the other (such as a dinner plate and a medium sized plate).


Trace the outlines on two pieces of cardboard. Cut out these outlines so that you're left with two donut shaped rings.


Cut a line through the two rings. Mount them on a cardboard base, stretching the rings to either side as pictured.


Use a long strip of paper or cardboard to create the track. Carefully glue this track in place, sequentially adding small dabs of glue as you go.


Trim any excess length off the end of the track and glue it firmly in place.

It's fun to test your loop a few times before installing it on your course.

Once you've installed your obstacles on your course, connect them to CRICKIT as pictured.

  • Connect the DC motor powering your windmill to CRICKIT's motor block in position 1. 
  • Plug servo motor into CRICKIT (making sure the brown/black wire is facing inwards).
  • Connect the Battery pack to the CRICKIT and make sure the switch is turned ON

If you need to extend your wires to position the obstacles where you want them, servo extensions can be found here and jumper wire extensions can be found here.

Use double sided tape to stick servo-controlled gate and CRICKIT in place on the course. 

If you find your motors struggling, check that your batteries are fresh!

If you're interested in adding even more obstacles, or having a permanent installation - a 2 amp power supply or 4 Amp power supply can be used and should be able to handle the power needs for as many other motors you want to add! 

Now it's time to upload the code!

Microsoft MakeCode for Adafruit is a web-based code editor for physical computing. 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.

Before you start programming...

...make sure you have the CRICKIT extension installed in MakeCode. Detailed instructions on how to do that can be found in this guide.

Once you've got that taken care of you are ready to move forward!

Getting into Bootloader Mode

Your Circuit Playground Express board comes ready to work with CircuitPython, and will show up as CIRCUITPY when connected to your computer for the first time.


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 Code

Follow this link or enter the portal below to interact with the code used in this project.

Be sure you use the green Servo blocks under the CRICKIT group and NOT the red Servo blocks under the PINS block group!

How to upload code

To upload code, connect you Circuit Playground Express to your computer using the micro USB cable, click the Download button 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.) The code is now on your Circuit Playground Express and ready to run!

What this code does

The sample sketch in MakeCode provides us with some simple commands for our obstacles. 

Firstly, in the on start block we can see that the windmill is set to start spinning as soon as CRICKIT is powered on (the volume is also set to be quite loud).

  • If you need to stop the windmill, press the B button on the Circuit Playground Express.
  • If you want to restart the windmill, press the A button and it will play a warning siren and start rotating again. 

Secondly, in the forever block, we can see that the gate is set to swing up and down in a timed pattern. This gives you a short window in which to make your shot before the gate comes slicing back down. 

If you'd like to play with the code, click "Edit" and a new window will open in which you can create your own version.

If you'd like to make the course more or less challenging, you can change the speed of the windmill in the crickit run motor 1 at 40% block. Increase it to 70%, or decrease it to 30% (note that, depending on your power supply, the DC motor may have trouble spinning below a certain threshold).

The timing of the gate can also be altered by changing the number in the pause blocks. Making these shorter or longer durations will make it easier or harder to time your putt!

It's Alive!

Plug in your battery pack and turn on power to CRICKIT and you should see your obstacles come to life!

Now for the best part - decorating your mini golf course! There are many ways you and upgrade and beautify your mini golf creation, below are three examples of fun additions.


This decorative archway makes an attractive entrance to your course.


Take 4-5 pipe cleaners. Bend the pipe cleaners into a "U" shape, adding a 90 degree bend at the ends.


Tape these in a line to the entrance to the course.


Pass the ball through the archway!

Furry windmill

To spruce up the windmill, as well as make it more challenging, a trail of furry yarn can be added to the tips of each blade.


First, use a screwdriver to remove your windmill blade from the motor hub.


Cut 20-30 pieces of yarn about 4-5 inches long. 


Tie a knot in each end.


Poke a series of holes in the end of your windmill blade (a skewer works well for this).


Using the tip of the skewer, push the yarn through to the other side.


Repeat this process until your windmill blade is sufficiently furry. The trailing bits of yarn aren't just pretty, they will throw your ball off course if you aren't careful!

Scary gate

If a gate coming slicing down isn't already intimidating, adding some personality to it certainly helps.


Use scissors to cut out a row of teeth along the bottom edge.


Use a marker to add a face of some sort (preferably one that looks like it means business).


A glue stick works well to stick googly eyes to cardboard. Add some glue to the back and press them down firmly for ~5 seconds to get a good bond.


You can have fun exploring many different designs for the gate obstacle. Let your imagination run wild!

Once you have everything connected and the course decorated to your liking, it's time to play some Mini Golf!

Start by plugging your power supply into CRICKIT and turning it on.

It may take a few tries to make it past the obstacles.

It's important to time your shot carefully.

Many things can go wrong.

But finally you'll make a hole in one!

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 Jul 05, 2018. It was last updated on Mar 08, 2024.