Grove Beginner Kit for Arduino -The Cooler Basketball Arcade

by skwong243city in Circuits > Arduino

217 Views, 0 Favorites, 0 Comments

Grove Beginner Kit for Arduino -The Cooler Basketball Arcade

IMG_8501.jpg

The Cooler Basketball Arcade is a mini basketball game made with Arduino. There is a mini monitor showing players’ scores and a button for them to restart the game. When they have scored a basket, a melody will be played and the LED rainbow effect will be shown.

Supplies

Below are the materials and tools we have used.

Materials

  • 5V Fan
  • Glue
  • Wires
  • Straws
  • Cardboard
  • Plastic ball

Tools

  • Cutter
  • Scissors
  • Cable Stripper
  • Diagonal Nippers
  • Solder Roll
  • Soldering Iron
  • Soldering Iron Holder

Electronics

  • Grove Beginner Kit for Arduino (Included Button, Buzzer, OLED panel)
  • Breadboard
  • Ultrasonic Sensor (or magnet ball & hall effect sensor)
  • LED strip WS2812B 1m 30LEDs
  • Jumper wires

Hacking the Fan

IMG_8498 2.JPG
IMG_8504 2.jpg

There are lots of ways to make the moving obstacle, like using a servo motor, fast stepper motor with belts etc. Yet, hacking an old fan is a more interesting way to make the machine. We broke an old fan and took the motor out. In order to connect the motor to the board easily, we soldered the motor wires. The motor works well and rotates at a fast speed.

Making the Moving Obstacle

IMG_8499 2.JPG
IMG_8506副本.jpg
IMG_8778.JPG

Since we can’t simply connect the fan motor to the obstacle due to the fast speed, we made the motor reducer instead. We cut a circle shaped cardboard and glued it to the motor. Then, cut a hole near to the arc of the cardboard.

Next, prepare a slim straw and a giant straw, make sure the thinner one can be put inside the thicker one. Cut a rectangular shape on the side of the giant straw. For the slim one, cut a hole in the middle part and one near the end point of the straw.

Make the obstacle and attach it to a wood stick. Put it inside the middle hole of the straw.

Try to connect the wire to ground and 5v and see if it can work.

Circuit

circuit.PNG
Circuit

Coding

Install libraries in Library Manager:

U8g2 - Version 2.31.2 - for OLED panel

FastLED - Version 3.5.0 - for WS2812B LED strip

Install libraries in Board Manager:

Arduino AVR Boards - Version 1.8.2 - new version is not compatible with U8g2

Seeeduino AVR - Version 1.3.0


Setting

hardware_final.ino is the main file.

You can see the pin number. You can edit some pins / settings.

#define LED_PIN 8 //ws2812b
#define NUM_LEDS 30 //ws2812b


#define Hall_Sensor A3
#define Hall_Sensor_D 4


#define buttonPin 6  // reset button


#define buzzerPin 5


#define fanPin 7 //Potentiometer
#define Potentiometer A5 //Potentiometer


#define pinInterruptPiezo 2 //Piezoelectric sensor


#define trigPin 9 // ultrasonic
#define echoPin 10 // ultrasonic


bool buzzerMute = true;
bool useHallSensor = false;
bool usePiezo = false;
bool useUltrasonic = true;


Detect the ball

You can use an ultrasonic sensor.

You may try the hall effect sensor (A3144) - need a strong magnet, otherwise, it cants detect the ball.

You may try the piezoelectric sensor - need a heavy ball to hit the sensor.


If the fan is too fast, you may need a potentiometer to adjust the fan speed.

Building the Machine

IMG_8779.JPG
IMG_8777.JPG
IMG_8500 2.JPG

You can decorate the machine yourself! Make sure to cut holes on the cardboard to show the score. Also, cut a hole to put the hoops and cut a rectangular shape to put the ultrasonic sensor.

Done!

IMG_8501 2.jpg

Thank you for checking this out! The steps and code are just for reference, you can also add your new ideas to it! Let me know if you have built this!