Creatively Modified Simon Says Circuit

by 345646376 in Circuits > Arduino

31 Views, 0 Favorites, 0 Comments

Creatively Modified Simon Says Circuit

IMG_7610 (1).jpeg
IMG_7642.jpeg

In this instructable, I will show you how to make a simple Simon Says game. This game provides the purpose of providing a psychological benefit to the player such as memory enhancement if an individual has trouble remembering or memorizing specific actions or events as it will enhance the brains motor skills which which will also improve mental health. This game is neither to easy or difficult as the player will be invested throughout the duration of the game.

The schematic drawing is provided above which shows the connections from resistors, to components, to negative and positive wiring with red and black colours.

https://www.instructables.com/Arduino-Simple-Simon-Says-Game/

This is a link to the instructable where I have gained my inspiration from as I was invested into their project.

The Things I have changed prom my project that was not in theirs is that I build my code prom scratch withou even touching their code, I added a buzzer and not a speaker, I added a RGBLED and they did not, I added 5 LED's and 5 push buttons while they did 4 for each and I adjusted my connection differently to theirs.

Supplies

IMG_7651.jpg

Standard LED's(5) LED cost

Resistors 330 ohm (5) Resistors 330 ohm cost

Resistors 10k ohm (5) Resistors 10k ohm cost

Push buttons (5) Push Buttons cost

Arduino Uno(1) Arduino Uno R3 cost

Breadboard(1) Breadboard cost

RGBLED(1) RGBLED cost

Piezo Buzzer(1) Piezo Buzzer Cost

Additional supplies non components:

Red Wires

Black Wires

Yellow, green or Blue wires

Wires cost (all colours)

Connect Arduino UNO to the Breadboard

IMG_7622.jpeg

In this step, connect the arduino plug to any object that will produce power such as a monitor, computer, or mobile.

Next, you will connect a red wire from the 5V pin of the Arduino to the positive rail of the breadboard.

After that, you will connect a black wire from the GND pin of the Arduino to the negative rail of the breadboard.

Finally, you will 2 more wires (red and black) and connect them accross so that both sides of the breadboard recieve power and grounding.

Attach LED's to the Breadboard

IMG_7621.jpeg

After you have done the first step, 5 LED's need to be attached.

They will be placed into an array with an even amount of spacing. I have 8 holes of spacing between each led which is enough for me to attach my buzzer and RGB LED in the steps ahead.



Connect Push Buttons

IMG_7619 (2).jpeg

After you have connected your LED's, you will connect your push buttons.

They will be placed between the barrier of your breadboard in the middle separating the 2 sides and slightly right to your LED's.


Connect Positive Wires and Resistors

IMG_7616.jpeg

After connecting your push buttons, you will add the resistors and wired connections to the positive rail from the push buttons.

For the 330 ohm resistor, you will connect it to the shorter (negative leg) of the LED and you will connect the 10K ohm to the top right leg of the push button. All the resistors should be connected from the negative rail to compoenents (LED's and Push Buttons).


Lastly, we will connect a red wire from the positive rail of the breadboard to the bottom left leg of the push buttons because we have to connect it opposite to the side of where the resistor was connected to the push button (top right) so it could function. I decided to do it like this but you could also connect the resistor to the top left leg of the push button and attach the positive wire opposite to it which is bottom right leg. It doesnt matter as either method will work.


Common mistakes/errors

  1. You might have connected the resistor and positive rail red wire which are not opposite to each other which will not allow it to function.
  2. Push buttons might keep popping out as they might not be fully inserted into the breadboard as it might keep popping out and a solution is that you could push it down hard to make it stay in place or grab another push button.
  3. The LED's will not turn on even after further steps because you might have connected the positive/anode leg of the LED to the resistor(s) pin and to fix this solution, just switch it around so the negative led of the LED is connected to the resistor(s).





Connect Arduino Pins to LED's and Push Buttons

IMG_7615.jpeg

In this step, you will attach wires of yellow, green, or blue colours from your Arduino pins to the LED's and resistors.

The wires will be connected to specific push buttons and LED's based on you're code. For example, my code include the pin connections of

int leds[5] = {2,4,6,8,10};

int buttons[5] = {3,5,7,9,11};

To connect the LED's to the Arduino, you will connect it to the positive/anode leg of the LED which means the LED's positive legs will be connected to the Arduino pins, and the negative LED's legs will be connected to the 330 ohm resistor.

For the push buttons connection to the Arduino, since the top right legs are connected to the 10k ohm resistor, the legs beside it which will be the top left legs will connect to the Arduino pins.


HEADS UP!

A mistake that might occur might be that you have not connected your pins to the correct compoenents based on your code so make sure to check that.

Also, if it doesn't work after that then your pins in the Arduino are not functioning properly so replace the Arduino board.

Connect Buzzer Into Circuit

IMG_7613.jpeg

After finishing all the connections between the push buttons and LED's to the Arduino, we will connect a piezo buzzer to the circuit.

so your buzzer, like the push buttons will be connected in the middle of the breadboard on the right side on the LED's and push buttons. on the positive side where mine was at the top, you will connect the Arduino pin to the positive leg of your buzzer based on your code. Fore example, Mine was

int buzzer = 12;

Then, you will connect the negative leg of the buzzer at the bottom to the negative rail of the breadboard.


Ensure that your code is adjusted to which pin you connected your buzzer.

Connect the RGBLED

IMG_7610 (2).jpeg

This after you have connected your buzzer, you will now connect the RGBLED.

The position does not matter but I placed it between my buzzer and LED's/buttons. Many RGB LED's have different colour codes, but mine had a red, cathode, green, blue patters (RCGB) which is why my first RGB leg is connected to the Arduino pin A2 because it provided the colour red which is what I we need if the player is incorrect, the second leg (longest leg) is connected to the negative rail of the breadboard since it functions through cathode, then my third pin of my RGB was connected to A4 of Arduino because we need green if the player is correct.

Finally, the last leg which is the blue leg is not connected to anything since we do not need blue.

My code showed

int redRGB = A4;

int greenRGB = A2;

which is why mine worked but if yours does not work, make sure Arduino pins match the code.


Create Code

This is the code I created from scratch for this game.

Simon says code for Eshan - Google Docs

  1. For the variables, I have included leds, buttons, buzzer, level(it keeps track of the games current round/level), sequences (for the number of patterns the player will conduct), red and green RGB's.
  2. for my setup in my code I have set my components as inputs and outputs, I have set up my buzzer and RGBLED's as well as the gameStart() which runs the random animation as it will generate the first random sequence.
  3. For my loop(), the showSequence() will display the current squence, as it will wait for the player to repeat it while using the push buttons. Also in my loop, it will check if the push button matches the sequence which was played and if its correct, the RGB will turn green and a new level/led will light up but if it is incorrect, the gameOver() will reset the game to level one displayed on the code.
  4. For my functions, they include

showSequence()

buttonPlayerPressed

gameOver()

gameStart()

checkButtonPressed()

victorymode()