Carnival Game

Introduction: Carnival Game

Introduction

For our project, we made a Carnival Game that involved throwing a ball at a box. There are 5 LEDs on the top of the box. The harder you throw a ball at the box, the more LEDs would light up. If you were able to throw the ball hard enough for the fifth LED to light up, it would stay lit up for a few seconds.

Supplies:

Materials

  1. Arduino Uno board
  2. 10x Male, Female wires
  3. Xx Male, Male Wires (different for everybody)
  4. 5x different LED's (preferred different colors of LEDs)
  5. Laser-cut boards (assembled)

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: How to Build

In order to make it as easy as possible for you to construct this Carnival game, we have split the building process into 4 separate sections. In the first section, you will cut out and assemble the shell of the Carnival Game. In the second section, you will attach the LEDs as well as put in the circuit board and Arduino. In the third and final section, you will upload the code as well as attach a 9 Volt battery to keep the Carnival Game running without having to be plugged into a laptop.

Step 2: Section 1

The Carnival game has a total of 7 pieces. 2 pieces are used to hold up the carnival game, 4 are used in slotting to keep it stable, and the last one is used as a target for the ball. I have created a Tinker Cad model of each of the pieces. I will attach images of each piece of the Carnival Game.

The pieces with their dimensions (in order from left to right)

  1. The pieces used to hold up the box (tinkercad link attached)
  2. 3x Slotting Pieces, 1x Target (260 x 130mm)
  3. 1x backboard holding the target, also slotted. (232 x 240mm)

Step 3: Section 2

Now that you have the model of the box setup it is time to set up the wiring inside the box.

The final wiring should look like the first attached image. We made it very tidy but that is up to you. It helps you in case you make a mistake you can easily follow every wire and retrace your mistake. The Arduino Uno board is the main component in this build. Everything runs from that board Make sure it is somewhere safe so the ball can not hit the board. We glued it to the side of the box. The force-sensitive resistor will be taped underneath a plate as shown in the second image.

The plate does not affect the readings if done correctly!!
The FSR has to be plugged into the port assigned during coding, ground, and power (5v) The assigned port during coding goes together with the ground. Those 2 get plugged into the same row. Then in the other row, you have the wire connecting to 5v. The LEDs are the easiest to set up. If you look closely at the 2 pins on an led you can see that one of the pins is longer than the other. The shorter has to be plugged into the ground while the longer one has to be plugged into the port assigned during coding.

Step 4: Section 3 (final Section for Build)

The final section of the build will explain the coding, which will allow your Carnival machine to work! We will explain how to use the LEDs and how to utilize the force sensors to light up your LEDs.

To assign the LEDs to a port you have to type

Int (LED name) = port of choice on the Arduino board.

I suggest if you use more than 1 led that you make the ports 2 apart. For example if I have 2 led’s I would suggest assigning one of them to port 12 and the other to port 10 so the wires don't interfere.

To turn a led on and off you type digitalWrite((LED name), HIGH) ← This is to turn the light on digitalWrite((LED name), LOW) ← This is to turn the light off

To make the LEDs coordinate with the FSR you have to combine the LED turn on and LED turn off with if statements. To do this you want to type this =

If (force> (force that you choose)) { digitalWrite(LED4, HIGH) } If force is greater than 400 (example) Then turn on led number 4

Else { digitalWrite(LED4, LOW) }

This says that anytime the force isn't greater than 400 the LED will stay turned off.

These are all of the basics that you need to know in order to make your project work.

If you are unable to do the coding yourself, below is the code that we used for our Carnival machine:

int pressurePin = A0;
int force;
int LEDpin = 12;
int LED10 = 10;
int LED8 = 8;
int LED6 = 6;
int LED4 = 4;
int pos = 0;

void setup() {
Serial.begin(9600);
pinMode(LEDpin, OUTPUT);
pinMode(LED10, OUTPUT);
pinMode(LED8, OUTPUT);
pinMode(LED6, OUTPUT);
pinMode(LED4, OUTPUT); }

void loop()
{
force = analogRead(pressurePin);
Serial.println(force);
if (force > 900)
{
digitalWrite(LEDpin, HIGH);
for (pos = 0; pos <= 180; pos += 1)
}
else
{
digitalWrite(LEDpin, LOW);
for (pos = 180; pos >= 0; pos -= 1)
}

if (force > 800)
{
digitalWrite(LED10, HIGH);
}
else
{
digitalWrite(LED10, LOW);
}

if (force > 600)
{
digitalWrite(LED8, HIGH);
}
else
{
digitalWrite(LED8, LOW);
}

if (force > 400)
{
digitalWrite(LED6, HIGH);
}

else
{
digitalWrite(LED6, LOW);
}

if (force > 200)
{
digitalWrite(LED4, HIGH);
}
else
{
digitalWrite(LED4, LOW);
}

Step 5: Finished!

After you do all of this your project is finished! All you need to do is throw a ball at the target and watch the LEDs flash up!

Be the First to Share

    Recommendations

    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Wearables Contest

      Wearables Contest
    • Fix It Contest

      Fix It Contest

    Discussions

    0
    audreyobscura
    audreyobscura

    6 weeks ago

    Thanks for sharing your project, it would be cool to see more photos from your build :)