MakeArt Final: CPB & Arduino Mini Golf Course

by Angie-Saggers in Craft > Cardboard

1531 Views, 0 Favorites, 0 Comments

MakeArt Final: CPB & Arduino Mini Golf Course

Screen Shot 2021-12-09 at 1.26.05 AM.png
Final Project: CPB & Arduino Mini Golf
Screen Shot 2021-12-09 at 1.25.26 AM.png
Screen Shot 2021-12-09 at 12.54.55 AM.png
Screen Shot 2021-12-09 at 12.55.33 AM.png
Screen Shot 2021-12-09 at 12.55.43 AM.png
download.jpg
Screen Shot 2021-12-09 at 1.34.45 AM.png
shopping-1.png
shopping-2.png

Hi there!

This guide will give you an overview on how to build your very own mini golf course using the CPB, Arduino Nano RP2040, and APDS9960 Proximity Sensor! As a part of the Boston College Physical Computing class, I have the opportunity to create a fun final project that incorporates the tech gadgets we have learned in class. Since I love mini golfing, I thought it would be fun to create a practice course. So, without further ado, let's get started!

Supplies

Cardboard Boxes (2x)

Colored papers

Mini Wooden Pole

Tape

Cables/Wires

CPB

Arduino Nano RP2040

APDS9960

Breadboard

LED Light Strips (2x)

3D Printed Figurines (could be any mini figurines though)

Golf Balls (I used some light weight balls)

A putter or wedge (to actually play it)

Tools:

Glue Gun

Scissors

Box Cutters

Deconstruct Boxes and Build the Course

Screen Shot 2021-12-09 at 1.11.37 AM.png
Screen Shot 2021-12-09 at 1.12.03 AM.png

For this project, any medium-sized cardboard box will suffice. I ended up using two boxes in this project for the actual ramp and the decorations. To begin, cut through any tape on the top and bottom of the box to remove the flaps. Find the seam and pull it apart carefully. Fold the box in half to make it flat.

Similar to the Adafruit inspiration (https://learn.adafruit.com/mini-golf-course-with-m...), I also created a two-tiered obstacle course. If you choose to do so, you would need to create some free-standing supports that will be glued on to elevate the second tier. Make sure that your ramp support is strong enough to handle any added on weight of your decorations too!

Making a Sign, Swinging Gate, Boundary, and Flag

Screen Shot 2021-12-09 at 12.59.42 AM.png
Screen Shot 2021-12-09 at 1.00.00 AM.png
Screen Shot 2021-12-09 at 1.13.18 AM.png
Screen Shot 2021-12-09 at 1.13.35 AM.png
Screen Shot 2021-12-09 at 1.13.46 AM.png
Screen Shot 2021-12-09 at 1.13.55 AM.png
Screen Shot 2021-12-09 at 1.14.11 AM.png
Screen Shot 2021-12-09 at 1.14.26 AM.png

You will have so much fun decorating your course! First, I covered the entire course with colored paper to make it look more presentable. Then, I wanted to make a sign for the course and started by making a frame and small support pieces to stabilize it. Next, I created a swinging gate by cutting a 2" x 8" a rectangular strip of cardboard. Since I wanted to make it look cheerful, I decided to make swinging gate a sun and you could design it to whatever your heart desires. Since I had to attach the cardboard to the servo, I found a small stick to tape together with the horn of the servo. After slightly trimming the corners of the intended gate, I attached it to the servo motor (which is programmed to go on a customized up and down motion). As for the boundaries, I just grabbed some extra pieces of cardboard and covered that with colored paper. These will help guide the ball to pass through the proximity sensor and swinging gate. Lastly, I created a flag using a thin wooden pole and paper to help players see the hole on the second tier.

3D-Printing & Laser Cutting

Screen Shot 2021-12-09 at 1.16.27 AM.png
Screen Shot 2021-12-09 at 1.16.36 AM.png

I wanted to spice up my course a little bit more and ended up 3D printing with Resin out of the SLA printers the following figurines from Thingyverse:

Windmill https://www.thingiverse.com/thing:594659 ( a classic mini golf decor)

Chinese Lion: https://www.thingiverse.com/thing:660923 (a symbol of strength and stability)

The MakerSpace also happen to have extra figurines (blue) made out of PLA-plastic which are created with FDM printers. They added another layer of flare in this course.

Additionally, using the laser cutting machine in BC’s MakerSpace with the help from the TAs I also created some arches to enhance the appearance and challenge of the course. Once I had all of my figurines and components I used a hot glue gun to attach them into the course.

Coding the CPB and Arduino

Screen Shot 2021-12-09 at 1.17.07 AM.png
download-1.png
download-2.png

Here are Prof. G's video tutorials that really helped me figure out the coding for this specific project:

I highly encourage you to check out the entire playlist too where Prof. G covers different types of boards and all of its extensive capabilities. My main tip is for you to have a lot of cables ready. Considering the size of this project, you have to be aware how the LED light strips will be connected to the same cords on the breadboard alongside the proximity sensor APDS9960 and the Arduino Nano. Make sure you keep track of what each of the cables does too!

Codes That I Used

download.png

Proximity Sensor

#import

import board, time, neopixel

from adafruit_apds9960.apds9960 import APDS9960

#LED Strip - Red - VIN (also works with 3.3v), White - D7 (Data - could use most digital pins) #Black - GND (could be any GND, but in this diagram it's in the same column as STEMMA-QT ground. It's OK to share power & ground)

strip_pin = board.D7

leds_on_strip= 30

strip = neopixel.NeoPixel(strip_pin, leds_on_strip, brightness=0.5, auto_write=True)

i2c = board.I2C()

multi_sensor = APDS9960(i2c)

multi_sensor.enable_proximity = True

while True:

reading = multi_sensor.proximity #this will give us a number from 0 to 30

print((reading,))

if reading>=10:

for i in range(0, leds_on_strip):

strip[0:i] = (255,0,0) * i

strip[i:leds_on_strip]= (0,0,0) *(leds_on_strip-i)

time.sleep(0.01)

time.sleep(10.0)

strip.fill((0,0,0))

Swing Gate - Servos

import board

import time

import digitalio

import pwmio

from adafruit_motor import servo

#create buttons

button_A = digitalio.DigitalInOut(board.BUTTON_A)

button_A.switch_to_input(pull=digitalio.Pull.DOWN)

button_B = digitalio.DigitalInOut(board.BUTTON_B)

button_B.switch_to_input(pull=digitalio.Pull.DOWN)

#Set up a servo

pwm = pwmio.PWMOut(board.A2, frequency=50)

servo_1=servo.Servo(pwm, min_pulse = 750, max_pulse = 2500)

#or servo_1=servo.Servo(pwm, min_pulse=0, max_pulse = 2500) for

while True:

for angle in range(0, 93, 5):

servo_1.angle = angle

time.sleep(0.05)

time.sleep(0.5)

for angle in range(93, -1, -5):

servo_1.angle = angle

time.sleep(0.05)

time.sleep(0.5)

Put It All Together

Screen Shot 2021-12-09 at 1.00.45 AM.png
Final Project: CPB & Arduino Mini Golf

As mentioned, once all the programming is done, all you have to do is wire the LED light strips together to the Arduino and attach the Servo to the CPB. Make sure that you have enough cords to place some distance between the LED strips as they would be attached on either sides of the ramp. Since I wanted to hide the wiring and preserve its connectivity, I securely taped everything to the bottom of the course. It definitely does not look that pretty, but the course itself will be very functional and enticing.

Practice Your Swing!

Screen Shot 2021-12-09 at 1.01.51 AM.png
Final Project: CPB & Arduino
Final Project: CPB & Arduino Mini Golf Course - Angie Saggers

Congratulations, now you have completed your very own mini golf! Go have fun and remember me when you are playing with the pros at the PGA tournament!