Introduction: Simon Says With LCD Display
Have you always wanted to create an Arduino project that is one, really fun to play with, and two, easy to build. Well look no further. Hi there and welcome to my instructable. Here, I will be teaching you to create a Simon Says game with a LCD display.
As I was looking for a project to create for my final evaluation assignment for computer engineering, my teacher gave my class some ideas to create for a project. One of her ideas was to create Simon Says. Simon says was always a game that I had cherished when I was little. Back in kindergarten, my classmates and I would have so much fun playing this game. By understanding the joy I got from playing this game, I went ahead and decided to do this project, however, I wanted to add a bit extra towards the projects, so I used a LCD display to display the score for the user and to notify them when they lose the round.
If you are beginner, it may be a bit difficult for you to create this project, as you will need a basic understanding in building circuits, but don't worry. You can still make this project. I watched a few videos to really inspire me on what I specifically wanted for my project and how I should go ahead and approach it. Here is a great video that really made me understand this project.
Step 1: Materials
Here is a list of all the materials that are needed in this project. A link will also be provided to let you purchase that item.
- Arduino UNO
- 16x2 LCD Display
- 1 Red LED
- 1 Blue LED
- 1 Green LED
- 1 Yellow LED
- Push Buttons (will need 6)
- 8 ohm Speaker
- 330 ohm resistors (will need 4)
- USB 2.0 Cable Type A-Male to B-Male
- Male to Female Wires (will need 4)
Total Cost: $73.72
*Tip---> If you don't know how the material looks like, the images are in order of the list provided to you.
Step 2: Let's Build
First things first, grab a jumper cable and connect it to the ground pin on the Arduino Uno. With the other lead of the jumper cable, connect that to the ground rail of the breadboard. Now after completing this, get a jumper cable and connect it to both ground rails of the breadboard. By doing this, both ground rails on the breadboard will be receiving ground.
--->Refer to the image and the Tinkercad sketch to see how you would connect the wire to the ground rail.
Step 3: Wiring the LEDs and Buttons
The next step is to wire the LEDs and their push buttons. Wiring these components are critical for this project, as we need some sort of way to allow the user to match the color combination presented to them. When the program causes a random LED to turn on, the user will click a specific button to output a colour(s) that is exactly the same as what the program outputted.
Let's wire the red LED first. Firstly, get a jumper wire and connect that to digital pin 2. With the other lead of the jumper wire, connect that to any row on the breadboard, preferably on the far right so that the circuit is a lot neater. With the jumper wire lead that is connected to the breadboard, get a 330-ohm resistor and connect one of it's lead with the same row as the jumper cable. With the other lead of the resistor, connect the anode(long leg) of the red LED on the same row of the lead of that resistor. Now with the cathode(short leg) of the LED, put it in series with a button. We are doing this because we want the button to have the ability to control the LED. On the opposite side of the button, get a jumper wire and connect it with the ground rail and the row that holds the button lead. Now you have two of the four leads of the button connected to some type of source. With the lead that is left of the one that is connected to the LED, get a jumper wire and connect that lead to digital pin 8. You have now wired the first LED. Do the same with the other LEDs and buttons. Here is a list of which digital pin you should connect the LEDs and buttons.
Green LED ---> 3
Button 2 --->9
Yellow LED --->4
Button 3 --->10
Blue LED ---->5
Button 4 --->11
*Tip---> Wire each LED and button ONE BY ONE. Don't do it all at once, as it makes it harder for you to wire everything.
--->Refer to the image and the Tinkercad sketch to see how you would connect the LEDs and buttons.
Step 4: Wiring the LCD Display
The LCD (Liquid Crystal Display) screen is an electronic display module that is capable of producing a series of characters to a user. The 16x2 LCD display, the display you will need for this project, can display 16 characters per line with the display having two lines. This LCD has two registers, namely, Command and Data. The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. The data register stores the data to be displayed on the LCD.
The LCD display will display the intro part of the project, the player's score, a message indicating when the player lost, and a message asking them if they want to play in the beginning.
On the back of the LCD display, you will notice four leads. There will be a GND, VCC, SDA and SCL. For the VCC, use a male to female wire to connect the VCC pin to the 5v pin on the Arduino. This will provide 5 volts to the VCC lead. For the GND lead, connect it to the ground rail with a male to female wire. With the SDA and SCL leads, connect it to an analog pin with a male to femal wire. I connected the SCL pin to analog pin A5 and the SDA pin to analog pin A4.
Step 5: Wiring the Speaker
A speaker converts electricity (input) into sound (output), however, what does the 8 ohms represent. Well, that represents the speaker's impedance. Speaker impedance, often called speaker resistance, is the resistance any speaker give to the current and voltage being applied to it. Speaker impedance isn't a set value because it changes based on the frequency of the signal fed to it. So, you would have something called nominal impedance. This value is basically the lowest amount the speaker will dip down to in resistance to the electrical load applied at any given frequency.
The purpose of the speaker is to make the game more fun and engaging. In the beginning, after you say that you do want to play the game, a sequence of sounds will begin to play to let you know that the game has begun. Sounds will play to let you know when you have completed a round and will also let you know when you lose.
When you look at the back of the speaker, you will notice two wires connected to some solder. One wire will be connected to power (will be indicated with + sign) and the other wire will be connected to ground (will be indicated with - sign). With the wire that is connected to power, put that wire in digital pin 12. Connect the ground wire of the speaker into the ground rail.
--->Refer to the image and the Tinkercad sketch to see how you would connect the speaker.
Step 6: Wiring the Remaining Two Buttons
When the game begins, a message will appear on the LCD display asking the user if they would like to play the game. The buttons will be used to allow the user to choose whether they want to play. When clicking on one of the buttons, the game will begin. Otherwise, if the other button is clicked, then a message will appear. That message is "See U Later".
Place a button on the breadboard preferably on the leftmost side as it will make the breadboard neat. Get a jumper wire and connect it to digital pin 13. With the other lead of the jumper wire, connect it in the same row as a button.Get another jumper wire and connect it to the ground rail. Connect the other lead of the jumper wire to the opposite row of where the button is placed. Do the same with the other button. Use digital pin 0 for the other button.
--->Refer to the image and the Tinkercad sketch to see how you would connect these buttons.
Step 7: Time to Code!
It's finally time to code this game. We are going to be combining everything we just wired up into a program so that we can make the actual game work. Before we begin, you need to download some libraries in order to make the code work. Click on the downloadable files to download the libraries.
To register these libraries into the Arduino coding program, click on "Sketch" from the main menu. Once you do that, you will notice an "include library" tab. Click on that. After doing that, you will see "add .ZIP Library". Click on that and click on the zip folder that you downloaded. After doing all of that, the Arduino coding program will have the libraries you just got.
I had lots of difficulties making my program work, in terms of coding it. So much so that I wanted to give up at a certain point. There are lots of for loops and functions that can easily confuse a writer. My teacher and friends told me not to give up, as I had already put in all the effort I could for this project. So I didn't give up. Soo after, I actually began to understand the code as I took the time to understand what was really going in the program. Before you play the game, please examine the code and make sure that you understand what is going on in the code. It will help you a lot because by understanding the code, you will be able to easily include new items in your game.
Click here to see the code.
Step 8: It's Complete!
It's finally complete. Great job! Now you can finally play the game.
Step 9: Extra Features and Final Thoughts
Even though this is done, there is still so much you can do with it. For example, you can place this project in a box and make it more appealing. Or you can add an RGB led to let the user know when they completed a round or when they lose. There is still so much you can do with this project. What I did was give you the foundation to your great idea.
In the end, I am really happy that I chose to create this project for my final evaluation. I had a great time making this project and playing it with my friends. The joy that I had once lost for Simon Says has come back after a long time. I hope you gain the same happiness I got from playing and making this project. Please share this project with your friends and family and thank you for reading my instructable.