Simon Says Game
An Arduino is a microcontroller that can allow us to create fun and useful circuits that can be used in our daily lives for various tasks. Within this project, we will be utilizing the Arduino alongside some other components to create a simple Simon Says memory game! Have fun creating this project! Above you can see a picture of the final product, along with the schematic of a basic Simon Says game (if you would rather build a simple version!). First, let's collect all of the components needed to create this project.
Supplies
Prepare Your Breadboard
The first step is to set up our three different breadboards. On the main breadboard at the top, you can see 4 LEDs along with 5 buttons. The first button on the left is the Start/Retry button, while the next 4 buttons are used to play the game. Next, in the bottom left breadboard, we can see a 7 segment display along with two green LEDs, this will be the breadboard that keeps track of the score, and plays a nice sound that indicates if you will be moving to the next level. Finally, the bottom right breadboard acts as an additional piece to the project as it will allow us to create an LED chaser to distract the user playing that will be playing the Simon Says game.
Also, we can begin by providing power and ground to the entire circuit through the 5V and GND pins on the Arduino (as seen in the image above).
Wiring the Game
In the picture above, we can see how the main Simon Says game is wired. We can begin by connecting each of the LEDs to the digital pins on the Arduino Microcontroller, followed by the 5 push buttons being connected to the digital pins. After all the connections are made, 9 digital pin slots should be filled. Also, ensure to use the proper resistors to ensure the circuit works properly. The resistors used are 220 Ω and 10 kΩ.
**NOTE** Colour coding wires can keep ur circuit neat and organized.
Keeping Track of Score
In order to keep track of the user's score, we will be using a 7 segment display, alongside two green LEDs that flash every time the user gets the Simon Says pattern correct. Also, on the same breadboard, we will include a piezo buzzer that makes a sound every time the user gets the answer correct, or incorrect. In order to connect the 7 segment display, we will connect its 7 pins to the digital pins on the Arduino (as seen in the image). This step is very similar to the previous one, except we will be connecting the 7 segment display pins instead of the LED anode. Also, we must connect the piezo buzzer to ground and to a digital pin. Lastly, connect the two green LEDs as seen in the image above. The two different types of resistors used in this step are 330 Ω and 1 kΩ.
**Remember to colour code your wires**
Creating LED Distraction
In order to create a constant flashing circuit, we must create a very basic LED chaser. The chaser's purpose is to increase the difficulty of the Simon Says game as the constant flashing LEDs are distracting. The 555 timer works with the decade counter to generate oscillations/pulses that allow us to create an LED chaser. In the image above, you can see how the wiring works. It is important to make sure that each of the wires are connected to the correct pins. In the next step, we will connect this simple circuit to 5 LEDs that work as the distraction.
Connecting the Distraction LED's
In the image above, we can see that the different pins (Output 1,2,3,4,5) are connected to the anode pin of the LEDs, while the LED cathode pin is connected to ground. This allows us to connect the LED chaser circuit to the LEDs, thus making a proper LED chaser circuit.
Coding
The link attached above is the source code for this project. If you are interested in viewing the code, you may simply download it. If you built the circuit exactly how it is explained within this Instructable then the code above should compile perfectly.
**Common Mistakes**
If the code is still not running properly, then ensure you have put the correct wires into the correct Arduino pins, a good way of keeping track of this is to colour code your wires!
Downloads
Brief Overview of Code
The images above showcase some vital parts of the code. The first picture shows how we created 10 different void functions that ensure the 7 Segment Display is working correctly. It also clearly shows how the circuit will know how each number looks like as it allows the program to understand what segments of the display need to be lit up. Next, we can the two functions that show whether the user's input is correct or incorrect. If the user entered the incorrect pattern, then the program will create a loud sound using the buzzer and will set all of the LED values to LOW (meaning that they are off). However, if the person is correct, then all the LEDs will turn on and then turn off, while the buzzer will make a nice sound. Finally, the last image shows the series of void functions that tell the 7 Segment display when to display each value (depending on what level the user is on). By understanding these simple parts of the code, you will have a much greater experience coding your own game!
DONE!
Finally, your project is done, I hope you enjoyed creating this project and had fun playing the Simon Says Memory game.
Have fun creating future Arduino projects!