Introduction: The Memory Game

About: I build fun and awesome projects with Arduino, Raspberry Pi, ESP8266, ESP32 based boards.

If you have a bad memory to remember, Memory game is a great
idea for improving memory and concentration.

This game is a Simon based game for the Arduino. This project consists of 4 buttons, 4 LEDs, an Arduino, a LCD and a speaker.In this game you have to follow the pattern of LEDs/notes as long as you can.

Step 1: Materials Needed

Arduino : https://amzn.to/2qU18sO

I2C LCD Module: https://amzn.to/2NkVQje

16x2 LCD: https://amzn.to/2LlYrJ7

9v battery: https://amzn.to/2zIcBmL

Switch: https://amzn.to/2upTngE

Jumper wires: https://amzn.to/2zKePBX

Cardboard: https://amzn.to/2JtgVFZ

Speaker : https://amzn.to/2qRuE2B

Male DC Barrel Jack Adapter for Arduino : https://amzn.to/2DLx6jI

4 Push Button: https://amzn.to/2qRwssp

100 Ohm Resistor : https://amzn.to/2Q8zxCs

4 different colored LEDs: https://amzn.to/2Kb6EQA

9v Battery Connector : https://amzn.to/2r3TeNP

Step 2: Making the Circuit on Breadboard

  • Place 4 different colored LEDs on your breadboard, make sure to note which way the long leg is facing.
  • Now connect one side of the 100 Ohm resistor to the long leg of each LED.
  • Connect a jumper wire from one side of the 100 ohm resistor to digital pin 8. Repeat this with the other resistors and connect to digital pin 9-11.
  • Place your 4 buttons on the breadboard.
  • Connect a wire from one side of the button to the short leg of LED and then connect a jumper wire with this side of the button to ground on the Arduino. Repeat this with the other LEDs and push buttons
  • Connect a jumper wire from the other side of the button to digital pin 2 on Arduino. Same with the other buttons and connect it to pin 3-5.
  • Connect a jumper wire from a speaker to digital pin 12 and the other wire to the ground.
  • Connect an I2C LCD to SDA,SCL,VCC,GND on Arduino. SCL is the clock signal, and SDA is the data signal. The clock signal is always generated by the current bus master; some slave devices may force the clock low at times to delay the master sending more data
  • To power your Arduino you will need a 9v Battery, a 9v battery connector, a switch,a male DC Barrel jack adapter. Solder the switch to the red lead from the 9V battery connector. Connect the black lead from the battery connector to negative terminal of jack adapter and and connect the lead from the switch to positive terminal.

Step 3: The Sketch

All you need to do is install 1602 I2C LCD library and Tone library. You will get an error if you dont install.

You can download source code and libraries from here.

When you want to add a new library into your Arduino IDE. Go to the directory where you have downloaded the ZIP file of the library. Extract the ZIP file with all its folder structure in a temporary folder, then select the main folder, that should have the library name. Copy it in the “libraries” folder inside your sketchbook

Step 4: Building Cardboard Enclosure.

Find a cardboard box that fits the circuit. Don’t forget to
make holes for LEDs,buttons and also make the holes to mount the switch and the LCD display. Put the circuit into the enclosure.

Step 5: Finish