Introduction: Spin the Wheel

Hi, my name is Ramneek and today I will be show casing my final project. For this project I have created a spin the wheel game. The objective of this game is to spin a wheel and make it stop with an IR remote; and once it stops it will give you a designated task that you will have to complete in 9 seconds. To show that you have completed this task you than click a completion button off to the side, otherwise a red light will indicate your fail. Heres an example; you start the game and the wheel (attached to a servo motor) spin continuously. Thats until you you click the (+) button on a remote and that will stop the wheel. Then the will will give you a task such as "Spell your name backwards"; you get 9 secs to complete the task, and finally the LED's will represent whether or not you've done that. Now lets see what materials are needed for the completion of this project...

Supplies

- "Arduino Uno x1

- Seven Segment Display x1

- LED's (Red &Green) x 2

- Push Button x1

- Servo motor x1

- 5 Resistors ( three 330, and one 10K)

- IR Receiver & Remote x 1

- Wires

Along with a breadboard that keeps your circuit neat!

Step 1: Reasearch

Before I found out what I wanted to do for my FE I took a look into other instructables for some inspiration. I wanted to incorporate the servo motor as I found it interesting and fun so in the search bar I searched "servo motor" after scrolling a bit I came across a project : Automatic Food dispenser

When I saw how the servo motor was utilized in this project I tried to think of objects and games that use a spinning motion. That when I remembered "spin the wheel" the game show that comes on my tv! The game show let me branch off and create my own idea, replacing the direction of the spin, replacing the money with tasks and adding my own spice with the countdown time limit. This is how I was inspired to make my final project game!

Step 2: Wiring

For the wiring portion I have given you a TinkerCad and IRL photo for assistance.

1. Connecting Power

Since by project and components require ground and power the first step in to apply the VCC and the GND from the Arduino to the breadboard(preferably 5V)... Don't forget to add a jumper wire so that the whole breadboard can be connected.

2. Building Seven Segment display

The next step in to build the seven segment display that will show case the numbers from 9-0. First we add wires connected to the correct pins on the seven segment for example:

int a = 13;
int b = 12;

int c = 7;

int d = 8;

int e = 9;

int g = 11;

int f = 10;

Than you will connect to resistors (330 ohms) on each side for power (+). The seven segment display will show numbers from led segments.

3. Servo Motor

The next component you will attach is the servo motor; and its quite simple. There are 3 colours on the servo motor orange representing 'pin' red representing 'power' and black representing 'ground'. You will connect all of these to the sated above. Check the photos for better guidance. When turned on the servo motors arm will move in a continuously in one direction like a clock.

4. IR receiver

Next is adding the IR receiver. For the IR receiver you need ground power and a pin. In my tinkerCad you can see where each one goes. When a HEX signal is given to IR receiver (infrared signals) then it shall function; you can check if your IR receiver is working by using the serial monitor.

int RECV_PIN = 5;

5. LED's

This one is straightforward you will need a connection to ground from both through resistors (330) and on the other side you need to connect it with a pin.

int greenLed = A4;
int redLed = A5;

Step 3: Coding Part 1

To begin the coding portion you will have to start with the variables. This sets everything up and ensures that the code will run smoothly; this is a very crucial part so don't mix anything up!

Step 4: Setup - CODE

Now that all of your variables are initialized, you need to set them to input or output to actually connect the pin. LED's are output

Push button is Input

and so on...

Step 5: Voids - CODE

I have multiple voids that contain codes for each funtion of my project. These voids are:

void nine - void zero

void servoMotor

Countdown Voids

Additionally you will need to decode you remote in order to find a HEX value. Here is the code for the decoding:

#include <IRremote.h><br>
int RECV_PIN = 5;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup(){  Serial.begin(9600);  irrecv.enableIRIn(); // Start the receiver}
void loop() {  if (irrecv.decode(&results)) {    Serial.println(results.value, HEX);    irrecv.resume(); // Receive the next value  }}

Step 6: Loop Function - CODE

Here is the void loop that will run continuously. This lets all the components work and act their part correctly.

For the project the loop function is programmed so that the servo is running continuously.

I also add how I would like that if the push button is pushed (HIGH) the led will turn green otherwise (LOW) it will be red. (indication of completion..)

The next part of my loop is me hooking up my IR remote; and it states that if 490 HEX (which is decode for the 'volume up' button on the remote) is received, the servo motor will be LOW; in other words it will stop.

Finally if the servo motor is low... Then the countdown will turn on. This allows for my game to run smoothly with no complications.

Step 7: Demo Video

Now that we have completed the setup lets run a Demo of this completed project!

Independent Game Video