Spin the Wheel

by 874195 in Circuits > Arduino

22 Views, 0 Favorites, 0 Comments

Spin the Wheel

Spin-the-Wheel-Logo.png

Hello, My name is Vanshika and I made this Spin the Wheel Game. How the game works a wheel spins using a servo motor. The player uses a remote control and presses the “+” button to stop the wheel. Once the wheel stops, the game gives the player a random task, like “Count to 10”. The player has 9 seconds to complete the task. Once the player is done the task, they have to press the button. When the time is up, the game checks if the task was done. A green LED lights up if the task was completed, and a red LED lights up if it wasn’t. The game uses an IR receiver to read the remote, and the Arduino controls the servo motor, LEDs, and countdown display. Now let's see how to make this fun game.

Supplies

Components.png

Research

Before I was researching as to what to make for my Final Evaluation, I knew I wanted to make something that included a Servo Motor that is when I came across a project which gave me an idea of what I can make which is: Spin the Wheel. I found it really interesting and decided that I can make this as my project. It looked simple enough to make and also a really cool thing to make overall.

Wiring

Spin the wheel.png
Screenshot 2025-06-17 133635.png
Screenshot 2025-06-17 163405.png

The Wiring can be a bit tricky as all of the components will be connected to the Arduino so make sure to double check the Wiring. I have put a Tinkercad and real life circuit diagram to help with the wiring.

The Seven Segment Display:

The Seven Segment displays the numbers counting down from 9 to 0. It has around 8 pins. which 2 of the pins 330 resistors connect to which are in the middle of the seven segment display and are called COM. It is on both sides of the display and one side of the resistor connects to the display and the to power (+) side of the breadboard. Each number lights up a segment which is labeled from a to g.

Here are the connections:

int a = 13;

int b = 12;

int c = 7;

int d = 8;

int e = 9;

int g = 11;

int f = 10;


Servo Motor:

It is very easy to attach the servo motor, which is the next component that you will attach to your breadboard. The three colours on the servo motor are orange for "pin," red for "power," and black for "ground." When turned on, the arm of the servo motor will move in a circle and the arm will point to the choice on wheel when it is stopped.


IR Receiver and Remote:

The next component that you will add is the IR Receiver which will get the signal from the remote to stop the servo motor from spinning. You can see where each wire is connected in my TinkerCad.When an IR receiver receives a HEX signal from the remote, it should work; you may use a serial monitor to see if your IR receiver is working.


The pin that the IR Receiver is attached to is:

int RECV_PIN = 5;


LEDs:

This one is simple: the resistors (330) must be connected to ground or shorter side of the LEDs, and a pin must be connected to the Arduino.

Connect them to these pins:

int greenLed = A4;

int redLed = A5;


Push Button:

The push button is also very simple: One Leg of the button is connected to the ground side, the power is connected by a wire and the one of the legs is connected to the Arduino.

The pin for the Button is:

int button = 2;

Coding

Screenshot 2025-06-17 185056.png

This is very start of the code, make sure that this is before Void Setup(). This is a very important part of the code as it reads what component is connected to which pin and if it is not connected to right pin, it may not work as you want it to or you might run into some errors.

Step Up - Code

Screenshot 2025-06-17 190314.png

To actually connect the pin, you must now set all of your variables to input or output.

Voids - Code

Screenshot 2025-06-17 190853.png
Screenshot 2025-06-17 190937.png
Screenshot 2025-06-17 191027.png
Screenshot 2025-06-17 191119.png
Screenshot 2025-06-17 191155.png

The code has multiple void which functions the Seven Segment Display to countdown from 9 and also the Servomotor void.

Here is the Countdown voids if it takes to much time to write:


void nine(){

digitalWrite(a,LOW);

digitalWrite(b,LOW);

digitalWrite(c,LOW);

digitalWrite(d,HIGH);

digitalWrite(e,HIGH);

digitalWrite(f,LOW);

digitalWrite(g,LOW);

}


void eight(){

digitalWrite(a,LOW);

digitalWrite(b,LOW);

digitalWrite(c,LOW);

digitalWrite(d,LOW);

digitalWrite(e,LOW);

digitalWrite(f,LOW);

digitalWrite(g,LOW);

}


void seven(){

digitalWrite(a,LOW);

digitalWrite(b,LOW);

digitalWrite(c,LOW);

digitalWrite(d,HIGH);

digitalWrite(e,HIGH);

digitalWrite(f,HIGH);

digitalWrite(g,HIGH);

}


void six(){

digitalWrite(a,LOW);

digitalWrite(b,HIGH);

digitalWrite(c,LOW);

digitalWrite(d,LOW);

digitalWrite(e,LOW);

digitalWrite(f,LOW);

digitalWrite(g,LOW);

}


void five(){

digitalWrite(a,LOW);

digitalWrite(b,HIGH);

digitalWrite(c,LOW);

digitalWrite(d,LOW);

digitalWrite(e,HIGH);

digitalWrite(f,LOW);

digitalWrite(g,LOW);

}


void four(){

digitalWrite(a,HIGH);

digitalWrite(b,LOW);

digitalWrite(c,LOW);

digitalWrite(d,HIGH);

digitalWrite(e,HIGH);

digitalWrite(f,LOW);

digitalWrite(g,LOW);

}


void three() {

digitalWrite(a,LOW);

digitalWrite(b,LOW);

digitalWrite(c,LOW);

digitalWrite(d,LOW);

digitalWrite(e,HIGH);

digitalWrite(f,HIGH);

digitalWrite(g,LOW);

}


void two() {

digitalWrite(a,LOW);

digitalWrite(b,LOW);

digitalWrite(c,HIGH);

digitalWrite(d,LOW);

digitalWrite(e,LOW);

digitalWrite(f,HIGH);

digitalWrite(g,LOW);

}


void one() {

digitalWrite(a,HIGH);

digitalWrite(b,LOW);

digitalWrite(c,LOW);

digitalWrite(d,HIGH);

digitalWrite(e,HIGH);

digitalWrite(f,HIGH);

digitalWrite(g,HIGH);

}


void zero(){

digitalWrite(a,LOW);

digitalWrite(b,LOW);

digitalWrite(c,LOW);

digitalWrite(d,LOW);

digitalWrite(e,LOW);

digitalWrite(f,LOW);

digitalWrite(g,HIGH);

}

Loops - Code

Screenshot 2025-06-17 191254.png

The void loop() runs continuously and controls the main code. It keeps the servo spinning the wheel using myServo.write(180) until a button is pressed on the IR remote. When a signal is detected, the servo stops, and a countdown from 9 to 0 is shown on the 7-segment display. During this countdown, the player must complete a task. If they press the button in time, the green LED lights up; otherwise, the red LED turns on. The loop also checks and resets the IR sensor so it is always ready for the next input.

Here Is an Schematic of the Circuit

Screenshot 2025-06-17 200548.png

Demo Video

Here is a demo of what it looks like: