DIY Arduino Ball Balancing Game

by ROBO HUB in Circuits > Arduino

1046 Views, 5 Favorites, 0 Comments

DIY Arduino Ball Balancing Game

arduino game balancing.JPG
arduino balance game project.gif

Hi readers, Welcome back to my other yet creative Instructables project!

In this project I will show you how i made this Ball balancing game with the help of arduino, This is an very interesting game to play with friends, especially at parties!

To begin with, let me go through the inspiration behind this project and later I will tell what this project actually does.

The source of inspiration was the maze game, i had a pencil on the back of which was a maze board of small size, in my part time I was trying hard to get the ball to the center of the maze, This sounded boring to you too right?

This was when I thought of scaling this but in a different way, I thought of an easy yet interesting way.

In this phase, I thought of arduino and with it the servo and most widely used joystick module (few call it as ps2 module too)

I coupled up these things and built a balancing robot you can call, In this game you have to balance the ball placed at the center of the scale.

The challenge arises in the control and this is made intentionally to make the game more challenging.

Play with multiple friends so check who is the master of balancing.

With this being said, now lets jump to the supplies required to build this project.

Supplies

1a.png
3a.png
2a.png
8a.png
4a.png
7a.png
6a.png
5a.png
  • Arduino Uno
  • Micro servo
  • Joystick module
  • Battery holder (2x18650 batteries)
  • Jumper wires
  • Ruler (15cms)
  • Ball
  • Cardboard stripes
  • Sheet of cardboard
  • Hot glue
  • Color paper(optional)
  • Arduino USB cable and IDE

Gather all these before building so you have all the parts handy during the time of build

Circuit Diargram

arduino balance game.jpg
free shipping .jpg
rigid flex pcb.png
rigid flex pcbs.png
rigid pcb.jpg
flexxible pcbs.png
rigid flex pcbs.jpg

The circuit used in this project follows simple logic.

The PS2 module or analog joystick module as few call is kind of potentiometer, When the button is moved each time the change in resistance occurs and this is used to control the servo movements

The micro servo has 3 pins, The positive and negative supply and the signal pin

Connect the + and - pins to the 5v and Gnd pins of the uno board, Whereas the signal pin is connected to D3 pin of uno.

Joystick module has 5 pins and in this project we are using 4 pins

The 5v and gnd pins are again connected to the 5v and gnd pins of the uno board

Vrx and Vry pins of the joystick module are connected with the analog pins A0 and A1 pin of board.

You also can simplify this circuit to a Single PCBComplete your electronic projects in the best way from PCBWay

Why them? They have provided me with the best PCB and The quality is just amazing compared to other providers in the market

They are raining shipping discounts for assembled orders click here to get your discount offer.

Check Here for Rigid-flex Pcbs with this your circuit becomes flexible! I have added the images to this step kindly check.

A revolutionary solution that combines the best of both rigid and flexible circuitry to elevate your electronic projects to new heights.

With their expertise in advanced manufacturing techniques, they offer a seamless integration of rigid and flexible components, ensuring enhanced reliability, durability, and space-saving benefits

Arduino Code

3.png
2.png
balance project arduino.gif
1.png

After the circuit is completed, connect the Arduino board to a computer using USB and open the IDE.

Copy and paste the code given below and select the proper com port and board type.

You can alter the servo horn angles with the parameter highlighted in the program (first image of this step).

After the code is done uploading, you can check if everything is correct by gently pushing the button of the joystick module, to verify if everything is connected properly the below action should happen.

When the joystick is moved towards the right the servo horn should move towards the right and when it's pushed towards the left the servo should make a left movement.

Placing Servo

7.png
8.png
10.png
12.png
18.png
17.png

There are multiple ways in which you can set this up, I have gone through many models and found that this was the one that would be most compatible to this project depending on the usage.

I had made the box kind of thing to hold the electronics inside and make it look cleaner.

To add a more appealing look you can add color paper to the parts like I did.

The V shape holds good strength in keeping the servo intact, use hot glue to stick the servo into this v shape tip.

After the glue is dry add the horns to the servo and if needed secure the horn with a screw.

Use a descent amount of hot glue wherever you are using cardboard since mild hot glue won't contribute to good strength.


Joystick Holder

19.png
20.png
21.png
22.png
23.png

Are you wondering why i place this ps2 module at the bottom even though i had lots of space on the top part.

The answer is simple, if i had placed there at the top it would cause distraction when the balance stick is moving sideways.

To make the wire less visible follow the steps like i did, i have made a small hole in the body and inserted wire through it, Use a small piece of cardboard to place the joystick and secure it with hot glue.

Check for the wires connection again before you place all the components inside this box.

Can I use a longer balance stick?

You have áš­he option to use longer stick but parallely you have to increase the height of the servo holder.


Balance Stick

25.png
28.png
29.png
27.png
1t.png

I call this a balance stick as we are placing the ball inside this and balancing them.

I thought of using the cardboard here but those come with slight friction, I got rid of this issue by simply using a plastic ruler.

Use a 15cm ruler and to the sides of this add small strips of cardboard, This cardboard will act as a barrier to hold the ball within.

Leave the sides as it is since this is the place where the balls will be falling off.

The horns of the servo was not long enough to hold this, so I extended the servo length by adding a small piece of cardboard.

I had marked the center earlier and now all i did was glue the ruler to this cardboard and hold it till it dried completely.

Playing the Balancing Game

4t.png
6t.png

The game is very easy to play, After I built this project the first thing I did was calibrate the servo and joystick module.

Don't worry i have calibrated and provided you the code, all you have to do is just use the codes, Start my moving the servo towards left and towards right fully, now reduce the angle bit by bit.

Practise this a few times so you have hands of experience with the control, Now when you finally think you are able to control place a ball.

The challenge is to keep the ball centered without allowing it to fall off from the balance stick.

In the initial play, you may find it a little tricky but after several attempts, you can be able to balance the ball to center.

Invite your friends and keep a stopwatch to monitor the time of others.

Tricky Tip: You can add a whole new level of complexity if you swap the x and y movements of servos!

Working Video

DIY Arduino ball balancing game

The game is very interesting and when more players are added it adds more stress to the player as challenges become hard!.

You can check my video, I used a mobile timer to record the timings of my balance, The video also contains the complete build of the project.

I hope you will have fun building this project as i did, if you think I forgot to mention something you can tell me in the comments. Happy gaming and happy building.