Introduction: Arduino LCD Game
Making a great many things is very easy with Arduino microcontrollers. This Instructable tells you how to create a simple 1-button video game made from a handful of parts in the Arduino Basic Kit from 123D Circuits. It is a side-scrolling jumping game. This serves as a good starting point for creating your own games from simple maker electronics.
Parts list (all can be found in the Arduino Basic Kit):
- 1 x Arduino UNO
- 1 x LCD screen (16 x 2 character)
- 1 x Electronics breadboard
- 1 x 220 Ω resistor
- 1 x Pushbutton switch
- Solid-core hookup wire
- 1 x USB cable
Step 1: Assembling the Parts
The parts needed are shown in the picture above.
Start off with the Arduino unpowered. Do NOT plug in the USB cable. That will happen in a later step when it is time to program it and try the game out.
Use a long hookup wire to connect the 5V signal on the Arduino to the far left of the red row at the top of the breadboard.
Use a long hookup wire to connect the GND signal to the far left of the black (or blue on some breadboards) row at the top of the breadboard.
The LCD (Liquid Crystal Display) module has a 16-pin male header on the underside. Plug this into the breadboard as shown in the picture. All of the electronic signals that power and control the LCD go through this header.
These pins are (from left to right):
- GND - power ground signal
- VCC - positive power signal
- V0 - contrast adjust
- RS - register select
- R/W - read/write select
- E - operation enable signal
- DB0 - data bit 0 (not used here)
- DB1 - data bit 1 (not used here)
- DB2 - data bit 2 (not used here)
- DB3 - data bit 3 (not used here)
- DB4 - data bit 4
- DB5 - data bit 5
- DB6 - data bit 6
- DB7 - data bit 7
- LED+ - backlight LED positive
- LED- - backlight LED negative
Using short hookup wires, connect GND and LED- (pins 1 and 16) to the black row at the top.
Similarly, connect VCC (pin 2) to the red row at the top with a short hookup wire.
Bend the wire leads of the 220 Ω resistor (red-red-brown colored bands) and connect it between LED+ and the red row at the top of the breadboard.
Use longer hookup wires to make the remainder of the connections:
- Connect DB7 to Arduino pin 3
- Connect DB6 to Arduino pin 4
- Connect DB5 to Arduino pin 5
- Connect DB4 to Arduino pin 6
- Connect E to Arduino pin 9
- Connect R/W to Arduino pin 10 (or to black row at top of breadboard)
- Connect RS to Arduino pin 11
- Connect V0 to Arduino pin 12 (or to black row at top of breadboard)
Plug the pushbutton somewhere to the left of the LCD screen, straddling the channel running along the center of the breadboard (see picture above). Connect one of the top two pins of the button to the black row at the top of the breadboard using a short hookup wire. Connect the other pin at the top of the button to pin 2 of the Arduino.
Step 2: Programming the Arduino
At this point, you should be ready to program the Arduino and test it out.
Start by making sure that you have the Arduino software installed on your computer. Download the LCD_Game.ino file on this page to your computer and open it in the Arduino software. Make sure the board is set properly for programming (Tools → Board →Arduino Uno).
Connect the Arduino to your computer using the USB cable. This will provide power to the Arduino/game and allow you to upload your program to the Arduino.
At this point, the screen of the LCD display should light up.
Program the Arduino by selecting File → Upload (or press the right arrow button at the top of the Arduino software).
If all goes well, the LCD screen should now show the game start screen like in the picture above.
Step 3: Changing Things and Making an Arduino Game Shield
At this point you have everything working, so what more is there to do?
If you want to change the way the game works, or make a cool printed circuit board for this project that plugs directly onto the Arduino and replaces of all those messy wires, here's how to get started.
I developed this game entirely using the very cool (FREE!) online electronics simulator 123D Circuits. I actually had the game fully working and tested before ever taking the Arduino out of the kit. Here's the virtual circuit for the Arduino LCD game.
You can actually play the game right in your browser without ever having to put together any actual electronics ("Oh, now you tell me"). If you want to make any changes to the game, or explore what's going on, you can copy the virtual circuit using the "Duplicate Project" button. You can then edit the source code and try out changes right there. There's also a full-featured debugger where you can step through the program line-by-line and see what's going on!
If you are so inclined, you can also make a circuit board to nicely connect your electronics to the Arduino. The project has a "Download Gerber" button that will get you the files necessary to give to a printed circuit board (PCB) manufacturer to have a custom printed circuit board made. You can see what this PCB look like by clicking the "PCB View" button toward the upper right of the circuit. Here's some useful info on getting that PCB made.
21 People Made This Project!
SantiagoLm made it!
aryas25 made it!
chrisminheere made it!
MarcC105 made it!
FABIOB14 made it!
SaltanatM made it!
EvripidisM made it!
DaveC216 made it!
mladenj made it!
KonstantinosT4 made it!
David_Lin made it!
cliptwings made it!
BitterweedDK made it!
SNS_RYANG made it!
MarekC5 made it!
ProZockermt2 made it!
KonstantinosT4 made it!
orkunza made it!
dadecoza made it!
KonstantinosT4 made it!
zhollett made it!
See 12 more that made it
We have a be nice policy.
Please be positive and constructive.