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):

  1. GND - power ground signal
  2. VCC - positive power signal
  3. V0 - contrast adjust
  4. RS - register select
  5. R/W - read/write select
  6. E - operation enable signal
  7. DB0 - data bit 0 (not used here)
  8. DB1 - data bit 1 (not used here)
  9. DB2 - data bit 2 (not used here)
  10. DB3 - data bit 3 (not used here)
  11. DB4 - data bit 4
  12. DB5 - data bit 5
  13. DB6 - data bit 6
  14. DB7 - data bit 7
  15. LED+ - backlight LED positive
  16. 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.


<p>Thanks so much for developing this project. I used it and modified it for a geocache I just placed. Once the finder gets at least 50 points, the LCD displays the coordinates for the final stage of the cache. </p>
<p>That's brilliant</p>
That's brilliant!!!!
<p>really cool one, thanks for the tutorial</p>
<p>Finally made it work on the IC2 :) It is such a simple setup with that display (Once you code it the right way). Thankyou for a simple, but &quot;hard to figure out&quot; project :)</p>
<p>hi , can you send me the code ?? please :D </p>
<p>Hi my name's Marc and I've just copyed this game for a little school free arduino project. While I was doing it i got an idea. How can I change the characters (little guy, and squares) to animals or other things? (thanks for your help).</p>
<p>hi marc , do you have the arduino code with lcd i2c? can you send me pliz?</p>
<p>The display allows you to customize eight 5 pixel x 8 pixel characters. Look in the source code around line 43 for something like:<br>// Run position 1</p><p> B01100,</p><p> B01100,</p><p> B00000,</p><p> B01110,</p><p> B11100,</p><p> B01100,</p><p> B11010,</p><p>B10011,<br>...<br></p><p>This is where the program defines the custom characters using binary values for each of the horizontal pixel lines of the characters. Each line that begins with 'B' defines a binary value. The following 5 characters are either '0' if the pixel shold be off or '1' if the pixel should be on. I hope that this helps.</p>
<p>What a fun project! I converted the LCD to use the I2C library, which was very simple and much simpler hookup. Very creative and an excellent use for a spare Arduino and LCD. I'm thinking I'll write another version somewhat like Centipede where the blocks come in from different directions. Thank you for the inspiration. This is going to be a LOT of fun!</p>
<p></p><div>Can you send the game code?</div>
<p>where did you changed your code in order to make it work</p>
<p>Hi)) I saw form your picture that you connected the lcd to analog input , that's fimiliar to my situation, but I can not get the image of the game on lcd. Please give me some advice , i want to try it too...</p>
<p>p.s. I love the autoplay option. Very entertaining to just let the thing run by itself.</p>
<p>somehow I managed to get over 395</p>
<p>very good!!</p>
<p>I got 91</p>
<p>İ am 10 years and I got 147 my dad got 256</p>
<p>i got 104</p>
Acil yardim edin arduino atinca programi boyle hata veriyor acil yardim edin
<p>abi hatanı copy edib at b&ouml;yle g&ouml;remedim. </p>
<p>Maalesef sorunu tamamen anlamıyorum. Ayrıca, T&uuml;rk&ccedil;e bilmiyorum. BareMinimum &ouml;rnek programında olduğu gibi &ccedil;ok basit bir programı derleyebiliyor ve y&uuml;kleyebiliyor musunuz?</p>
<p>Doesn't work for me. I checked the wiring 3 times and it didn't work anyway. The LCD turned on but it shown just a white line at the top. what can I do? Please help me.</p>
<p>I am getting the same line on the top</p>
I've not encountered this particular problem. In the picture from the first person, it looks like the backlight resistor is not 220 ohms. It might be possible that the circuit is drawing too much current, so the LCD panel isn't able to properly initialize. Try removing the backlight resistor or that wire to ground, and see what happens after resetting the Arduino.
<p>Great project<a href="http://emojipedia.org/thumbs-up-sign/" rel="nofollow">?</a> Works nicely!</p>
<p>SO I CAN'T SAY I MADE IT!!!!</p>
<p>I think you need to add some more images</p>
<p>The Arduino IDE will not open the sketch. Can you send a text file?</p>
<p>The .ino file is actually just a text file. Try changing the .ino to .txt or just open it with a text editor and copy and paste the text into a new Arduino project.</p>
<p>My LCD backlights arent glowing. how do i fix it ? i did everything exactly as mentioned.</p>
<p>Some LCD panels don't have a backlight installed. It is the (often) trapezoidal shaped part immediately to the right of the panel. If yours does have the backlight installed, it could just be faulty. It's like any other LED, so if you at any point you connected it without the resistor, it could have broken because of too much current through it.</p>
<p>This was super fun and easy. This was my first project on my new arduino and I made it with almost no problems</p>
<p>Your project is really great! It inspired me to try it too! But in my lcd i have 4 pins: vcc, gnd, sda,scl and i have been connecting them to arduino board 's analog input in order vcc-5v,gnd-gnd,sda-A4,scl-A5. And i have changed in code LiquidCrystal_I2C<br>lcd(12, 11, 5, 4, 3, 2); to LiquidCrystal_I2C<br>lcd(0x3f,16,2); and there is no picture(( Please, help me .</p>
<p>I've never used an I2C module, but there are a couple of possibilities that I see here. It appears that you may have the row/column parameters swapped. According to this page (http://playground.arduino.cc/Main/LCDI2C), the # of rows should be the second parameter and the number of columns the third. Also, are you absolutely sure that the I2C address (the first parameter) is correct?</p>
<p>really great and easy, i build it myself and well... one tip for new ones solder your wires into the lcd properly and you wont get any flicks it will work perfectly.</p><p>Also i will code some other Games for this Layout maybe a multiplayer for this game ;)</p><p>Al</p>
<p>very good. but now I also want to control everything from a mobile application made in app inventor. you can help me?</p>
<p>I've no pactical experience with app inventor, so I can't help directly. How do you plan to send the button pushes to the Arduino?</p>
<p>Thanks for sharing this amazing project!<br>While checking the code, i did not understand this line.<br>Can you plz explain , what this line do?<br>digitalWrite(PIN_AUTOPLAY, terrainLower[HERO_HORIZONTAL_POSITION + 2] == SPRITE_TERRAIN_EMPTY ? HIGH : LOW);</p><p>Thank you!</p>
<p>And can you plz tell me where Arduino pin 1 (TX pin) connected to?<br>From the schmaticDiagram, it seems like it is connected to Ground(GND) pin.</p>
That pin is connected to a second, secret &quot;cheat&quot; button.
You are very observant! You found the easter egg. If a second button is connected between PIN_AUTOPLAY and the normal button pin, when it is pressed and held, the hero automatically jumps at the correct time. It's the game cheat button!
<p>Loving all the comments in your code.......</p>
<p>Cool project :D</p><p>Very nice game! The only thing that could be added is a Highscore ;-)</p>
<p>this game is very very nice</p>
<p>this game is very very nice</p>
<p>this game is very very nice</p>
<p>Great project, I started on arduino a few days ago and I love your idea.</p>

About This Instructable




More by joshua.brooks:Pogo pin programming connector Hand-held zoetrope sculpture Neopixel Night Light 
Add instructable to: