Introduction: Handheld Pong & Invaders on the Cheap (Arduino Compatible)

About: Call me Ugi. Special offer! Make something based on one of my instructables and post a picture for a free 3-month pro membership (while stocks last).

A retro hand-held gaming system cheap enough for a kids' project. Possible? Absolutely! Just bring on the power of Arduino and cheap Chinese components!

This project was designed as a soldering project for a group of half-a-dozen 9 and 10 year-old kids but it's a great introduction to soldering, Arduino, programming, and many other aspects, all for less than £16 ($22.50) a shot. Not bad when a kid's science club costs £40 a day and they get nothing much to show for it!

The "console" detailed in this 'ible has the following features (among others):

  • Fully integrated and autonomous game console
  • 1 or 2 player "Pong" game and 1-player "Invaders" game pre-programmed
  • Easily reprogrammable using the Arduino IDE
  • Integral rechargeable Li-ion battery (several hours of play on one charge)
  • Integral USB recharging circuit
  • Integral speaker and sound effects
  • Software controllable backlight and volume
  • Retained settings and high-score table in EEPROM

Here's a few videos of it in action:

Pong Game (starts slowly but it gets faster later):

Invaders Game (Start):

Invaders Game (After a few waves):

Step 1: Things We'll Need

These are the materials needed for each console. They are nearly all available from e-bay, ali-express and/or Banggood.com. Make sure you leave a month or more for delivery if ordering from these suppliers - you don't want to be missing a crucial component on the day!

BoM:

    • ATMega328P (with 8MHz Bootloader - see later step**) (£1.35)
    • Custom PCB (see later step) (£1.50)
    • Nokia 5110 LCD with breakout board (50p) There seem to be red and blue versions available - go red
    • WTV020 Sound Module (£2)
    • SD card (2GB or smaller - 512 MB worked fine & anything from around 2MB would do!) (50p)
    • MCP1825 3.3v ULD regulator (Mouser.com) (60p)
    • 8MHz crystal and 22pf ceramic caps (50p)
    • 10K linear potentiometers (anything up to 100k or so should be fine) (2x at 25p each)
    • Plastic caps for pot's (2x at 10p each)
    • 220uf electrolytic caps (2x at 5p)
    • 100nf ceramic caps (2x at 1p)
    • Resistors 1% (3 x 10k-100k (1%), 2 x 100-500 Ohm (through-hole) and 1 x 2k7 surface mount 603) (10p)
    • 3mm LED (5p)
    • Tactile switches (two tall 15mm & one small red) (30p)
    • Small toggle switch (25p)
    • Socket for ATMega, female and male (90') header pins, 3x DuPont F-F cable (50p)
    • Small "gameboy" speaker (£1.50)
    • TP4056 Lithium Battery Charging Board (modified for <500mA - see later step) (50p)
    • 500mAh Lipo Battery (Hubsan X4 H107) (£2.20)
    • USB charging cable (40p)
    • Mounting screws 4x (10p)
    • Plastic project box (£2.30)*

    Approx Total: £15.97 each for 10 pcs.

    Prices above are based on buying 10 pcs including delivery from Chinese e-bay or ali-express sellers or from Bangood.com unless indicated otherwise. The PCB fits a 5 x 10cm outline and can be sourced for less than £15 for 10 delivered from iteadstudio.com. Other cheap PCB shops may do even better.

    The prices are approximately what I paid in 2015 but may not represent the prices now available. Your mileage may vary.

    Tools:

    • Solder station
    • Helping hands
    • Clippers
    • Flux pen
    • Drill
    • Rotary tool or file & lots of patience
    • Jet-lighter
    • Screwdriver
    • Hot glue
    • Sharpie or similar marker
    • Tape

    Programming / Debugging Tools:


    PC with Arduino IDE installed (v 1.0.3 if you want use my sketch)

    USB to UART adaptor (I use a cheap CP2102. FTDI would work too if it has 3v3 output).


    For Bootloading**:

    ISP programmer

    or

    Arduino + breadboard or ISP shield

    * Plastic box was 85 x 58 x 35mm "waterproof" project box with clear lid (useful to see charging lights). I sourced from here: http://www.ebay.co.uk/itm/181618566372 They go in and out of stock but the dimensions and pictures should allow you to find it.

    **You can buy pre-bootloaded chips but they expect a 16MHz crystal. If you ran this on an 8MHz crystal then it would throw out all your timings and generally be a pain. It is certainly preferable to burn an 8MHz bootloader (see later). It's not hard to do. You could in fact run at 8MHz on the internal oscillator without needing a crystal. I didn't try this but I expect it would work fine. Let me know if you try it.

    Step 2: Design

    Microprocessor

    The key to the design of this console is the Atmel ATMega328P microprocessor. This has been the core of many of my projects and it's great for this because it will run for hours off a single lithium ion battery and although we have to drop down to 8 MHz at 3v3, that's easily enough for a few games on a low-resolution LCD display. We can also program it from the very popular Arduino IDE which makes writing your own games etc as simple as possible.

    The ATMega328 also has stacks of in/out pins so we can drive the display, control the backlight, measure analogue and digital inputs and still have spare pins for measuring battery voltage, controlling the sound module etc. In fact, we have pins to spare even after all that so those are broken out on the board in case you want to add some extra function I didn't think of! A light-sensing backlight would be quite cool.

    Other Key Components

    The rest of the components are also driven by acceptable performance at low cost. A single Li-ion cell and USB charger board allow us to avoid needing to access the battery, which means we can use a cheap plastic box. The Nokia 5110 LCD display is cheap but has enough resolution to give a real representation of simple retro games and is supported by some great Arduino libraries. Finally, the WTV020 takes some mastering but once tamed gives pretty good sound for its cost and footprint. You could dispense with the WTV020 and drive a speaker direct from the ATMega, which would save about £2.50 (over 15%) on the price-tag but that module was new to me and I wanted to master it. Also, I like the proper "piew ... crash!" when you shoot the invaders!

    PCB & Connections

    The implementation of this is centred around a custom PCB. You could put this together on perf-board but I really needed to jam things in to make it all go in the box so I would expect that you would need a bigger enclosure without the PCB. In general, the screen and input buttons and the parts needed for re-programing are on the top of the PCB with the potentiometers, ATMega and other components on the bottom. The charger board glues down to the bottom of the enclosure and that, the speaker and the battery attach to the PCB by jumper wires.

    The LCD is controlled from digital pins D8 to D13 (skipping D12 which we break out). We use the hardware SPI clock and data pins to drive this as fast as possible using the excellent "PCD8544_SPI" library by Arthur Liberman (aka 'The Coolest' - http://www.alcpu.com). See later steps for more on that. PWM output pin D5 gives us brightness control of the built-in backlight on the LCD module. If you use D12 for other things, it probably needs to remain an input pin. If you use it for an output it will probably mess up the SPI interface.

    User controls are provided by switches on digital pins D6 and D7 and analogue controls with a potentiometer on A0 and A1. Analogue ping A3 is used with a 50/50 voltage-divider to measure the battery voltage against the 3v3 regulated voltage.* The WTV sound module runs off D2-D4 and A2, leaving A4 & A5 free for additional analogue or digital sensors or to add i2c peripherals. Similarly, D0 and D1 are left free and could be used for inputs but are useful for serial re-programming or to add a serial device. Serial output is also useful for debugging if you are writing your own code.

    Attached Materials

    The full schematic and board files in Eagle 6.x format are attached to this step, as well as .pdf and image versions of the schematic. The board file meets the design rules for iteadstudio.com but should be fine at most board houses. The v1.1 version in this step has a couple of issues fixed over the first version I had made up so there are a few small differences from some of the pictures. It's the same size and should work just the same.

    *In my v1.0 I didn't have the voltage senor circuit on-board so that was just added with a couple of resistors from the spare battery connector point to the breakout point of A3.

    Step 3: Prep - Modify the Charging Board for <500mA

    The TP4056 is a great little lithium ion battery charging board but it comes as standard set to deliver a 1A charging current. This is perhaps a little high for our 500mAh battery and will cause problems with some USB ports (e.g. on PCs or laptops) which are only made to deliver 500mA.

    The current delivered by the charging board is controlled by the tiny "RProg" resistor on pin 2 of the chip, right down at the near edge of the board as pictured. This is set at 1.2k as delivered.

    The charging current can be calculated as 1/RProg x 1200 A so the current provided by the standard breakout is 1/1.2k x 1200 A = 1A. We want something less than 500 mA, so we want RProg > 2.4k. I used 2.7k giving a calculation of:

    1/2700 x 1200 A = 0.444 A = 444 mA.

    That means we are charging our battery at less than 1C, which it should be able to handle, and we will draw less than the 500mA that a standard USB port can supply.

    The process is fairly simple - just "wipe" off the original resistor with the side of your soldering iron tip, dab some flux on the new resistor (603 size on my board) and hold it in place with a small object (toothpick or similar). Then touch the iron to one end of the resistor between the board and the component to fix it on. Follow that up with some very fine solder at each end to be sure of a good contact. The one in the picture is the first and worst of the batch I did but it still works fine!

    Step 4: Prep - Modify the Enclosure

    We need to hack the box about a little so that it will take the board and will have space for the screen, switches and charger. The easiest way to do this is to put one of the boards in and use that as a template.

    Firstly, we don't need the middle standoff at each side, so clip that out of the box.

    Next, put a board in the box and mark on the lid where the switches need to go through.

    Now, put an LCD breakout board with the screen removed on top of the PCB and heat up the metal surround with a jet lighter or similar. When the clear acrylic top is put down over the hot metal, it will mark the exact outline and allow an easy cut with a rotary tool. You could probably do this with something like paint without needing the heat.

    Drill holes for the tactile switches and notches to take the potentiometers. The charger board can be lined up inside the case to align the holes for the charging plug.

    The last hole will be for the on/off toggle switch. A little care is needed to avoid interfering with the sound module when the switch is mounted.

    Step 5: Prep - Bootloading the ATMega328P

    In order to use the Arduino IDE reliably at 8MHz, you need to burn the "Arduino Pro Mini 8MHz" bootloader onto your ATMega328.

    There are all sorts of ways of doing this, but I will assume here that you have a '328 based Arduino board (like an Uno, nano or Duemilanove). Using this you can bootload your '328 using either a dedicated "shield" or just a solderless breadboard.

    Breadboard method:

    1) Place your '328 in the centre of your breadboard. Run +5v and Gnd from your arduino to the power rails on your breadboard (Red and Blue jumpers in the above picture).

    2) Run a 10K from pin 1 on the BB (reset) to +5v (not actually essential and not shown in the pic').

    3) Fit a crystal (8 or 16MHz) and cap's (22pf) on pins 9 and 10 on the BB.

    4) Join pins 7 and 20 (on the BB) to +5v and pins 8 and 22 to Gnd with jumper wires (Red and Black links above).

    5) Jump from D11, D12 and D13 of the Ardu' to pins 17, 18, 19 on the breadboard (Orange, Yellow, Green above).

    6) Jump from D10 on the Ardu' to pin 1 on the BB (Green at Bottom-Left above).

    7) Plug the Ardu' into your PC and burn the the Arduino ISP sketch onto your Ardu' from the Examples.

    8) Put a 10uf capacitor from reset to Gnd on the Arduino (not the BB).

    9) In the IDE, select "board" as Arduino Pro Mini 8MHz. Select the programmer as "Arduino ISP"

    10) In the IDE click "burn bootloader".

    11) The lights will flicker for a bit while the bootloader is transferred.

    12) When it's finished, the D13 light on the Ardu' should flash regularly. That's in parallel with D13 on the new chip and tells you the blink sketch, which is burned with the bootloader, is running on it. This is good.

    Shield Method:

    I got fed up with laying out BBs the whole time so I made an small ISP shield. The picture is of mine but if you don't want to make your own then you can buy one from EMSL.

    The procedure is very similar to the breadboard but reduces the setting up to one step:

    1) Burn the Arduino ISP sketch onto the Arduino & un-plug it.

    2) Put your '328 in the shield and the shield on the Arduino.

    3) Plug in the Arduino and disable auto-reset (jumper or switch on the shield)

    4) In the IDE, select "board" as Arduino Pro Mini 8MHz. Select the programmer as "Arduino ISP"

    5) In the IDE click "burn bootloader".

    6) The lights will flicker for a bit while the bootloader is transferred.

    7) When it's finished, the D13 light on the Ardu should flash regularly. That's in parallel with D13 on the new chip and tells you the blink sketch, which is burned with the bootloader, is running on it.

    Testing:

    Your '328 should now be ready to be programmed. If you want to test it before putting it on the board then you can lay it out as a breadboard Arduino as described above. Now, disconnect the Arduino from the Breadboard and connect up the CP2102 USB to TTL converter. That will go to +5v and Gnd, with Tx on the CP2102 going to D0 and Rx to D1.

    Some CP2102s are marked backwards so you may need to switch the Rx and Tx.

    Finally you need to add a reset switch between pin 1 and Gnd (see picture above). You might also want an LED and resistor (say 1k) between pin 19 and Gnd. This is the D13 LED that comes as standard on most Arduino boards.

    To load a sketch, select Arduino Pro Mini 8MHz as the board and upload a sketch. Just when it finishes compiling and tells you the final size at the bottom of the IDE, press and release the reset button to start the upload.

    You should be able to upload the blink sketch and see the D13 LED flashing with a new timing.You can burn the final sketch now if you want. It will save you connecting the CP2102 up to the final game console board. See a later step for the sketch.

    Step 6: Prep - Set Up the Sound Module and SD Card

    The WTV020 module is a little touchy to use but when set up correctly it will function well and reliably.

    Micro SD Card:

    Firstly, it is important to use a micro-SD card no larger than 2GB - I found some cheap 512MB which worked well. In practice, we only want a few small sound clips so a few MB is all we will need. You may struggle to find really small cards these days

    The best bet for cards that are easy to use is SanDisk originals. If you look at the back of a small SanDisk card you will usually find a small rectangular raised portion. If your card has this and is =< 2GB then it's ideal for this job.

    Format your SD card with SD Formatter . The normal Windows formatting works for most things but does not work reliably for the WTV module. Use 16-bit FAT full overwrite formatting with SD Formatter. It's slow (a minute or two) but works every time.

    If you can find a micro SD card with rectangular "bulge" on the back then those are the easiest to use - they require no special modification to work. If not, you may need to add a ground-short to the WTV module - see below.

    Sound Files:

    The WTV020 works best with sounds in "AD4" format. That's not a format I had ever heard of before but it's what you need for this. The easiest way to make the conversion is to use the attached conversion tool, which is available in a .zip file on this step. It runs on Windows, certainly up to Windows 7. There may be tools available for other OSs. Simply run your .mp3 or .wav files through the converter to generate .ad4 files. I have read that the files must not be very high volume, but I never had any issues with them.

    The sound files you choose to use will depend upon what effect you want to create. I did a search of free to use online sound samples and converted some of those. Some sound good. Others don't. You may need to experiment a bit with them.

    I found lots of useful sounds at fee sites such as freesound.org or audioblocks.com. There are many others. You'll need to enter a few search terms before you'll find exactly what you need.

    Sometimes what you want is only a small part of a longer clip, in which case a free editor such as Audacity is handy.


    The files need to be named with 4-digit numerical titles: 0000.ad4 0001.ad4 etc.

    In my sketch, the following file numbers are used:

    0000.ad4 - PingPong Sound

    0001.ad4 - Bomb sound (not actually used in sketch)

    0002.ad4 - Ship Destroyed Sound

    0003.ad4 - Alien Destroyed Sound

    0004.ad4 - UFO Destroyed sound

    0005.ad4 - Ship Fires Sound

    0006.ad4 - Hello Sound (Played at setup)

    0007.ad4 - Let's Play Sound (Played at game start)

    The module won't tolerate any deviation from this file numbering and the sound files probably need to be in the top level of the SD card. However, if you adhere to this then they should work well.

    If the sound clips are too short (less than a second or two) then they sometimes don't play well. A free tool such as Audacity can be used to add some quiet time to the end of the sound clip to fix this.

    Hack the Module:

    If you can't get an SD card with the raised portion on the back (see photo) then you may not find that it plays reliably. The way to fix this is to short pin 6 of the SD card to earth. I think this is essentially an enable pin on the SD card and some cards are perhaps not fast enough and need to be enabled all of the time. A tiny wire from the connector for pin 6 of the card to the ground pin of the module (pin 8 of the module) will fix this. With this Pin 6 to Gnd wire in place, all micro SD cards of 2GB or less that are formatted with SD Formatter do seem to work fine.

    Step 7: Assemble the Board - Soldering

    The time has now come to populate the PCB. Generally, we will work from the centre outwards although, on this occasion, we must make sure that we add everything to the back of the board before we put the screen on the front. If not, things are going to get very inaccessible. If the kids are doing the soldering, check every joint as you go along. Fixing things once the screen is in will take a load of effort (and probably a new screen).

    1. Add the chip holder and two strips of female headers (for the sound module) to the bottom. You could solder both of these items direct to the board if you like and save some space. For the sound module, you could add the headers to a spare module before you solder them to ensure that they line up correctly.
    2. Put in the 100nf decoupling caps, bend out the legs under the board to hold them and solder.
    3. Repeat with the 22pf decoupling caps, the crystal and the 100-500 ohm backlight resistor. All of these can go either way around. Once soldered, clip the wires nice and short because the LCD will have to go over the top of these joints & we don't want any shorts.
    4. The 220 uf caps go next to the sound module, observing the polarity: long leg to + and white stripe away from the sound module.
    5. Still working on the bottom of the board (soldering on the top side) add the regulator and the potentiometers. These may need to be held in place with tape while they are soldered.
    6. On my board, the voltage measurement was added with resistors next to the battery connector. On the v1.1. board in this 'ible, they are nicely laid out on the board. Two identical 1% resistor are needed. Use something around 10k-100k. Add these now.
    7. Now is a good time to add some male pin headers for the charging board, the switch, the speaker and the battery. I found that round-pin headers took the battery connector nicely. There are various alternative positions for battery connectors if your battery has a different connector to mine. Use normal square-pin 0.1-inch headers for the rest.
    8. Time to move on to the top of the board - firstly with the remaining resistors - a 100-500 ohm for the power LED and a 10k for the reset pull-up. No polarity on resistors so they can go in either way around again.
    9. Add a 90' male header to allow the chip to be programmed. If you programmed your chip already and don't want to re-program in-place then you can skip this. There is space for 6 pins but you only need the bottom 4 (Tx, Rx, 3v3 and Gnd).
    10. Add two tall tactile switches for the play buttons and a short one (I used red) for reset. If you aren't adding the programing headers then you don't need the reset switch either, although it doesn't hurt.
    11. The LED goes in with the long wire towards the middle of the board and the short wire at the edge. Make sure this goes right down flush to the board. It shines through a hole at the corner of the LCD and if it's not right down then the screen will not go flat over it.
    12. Now is a great time to check that everything is in place and that the joints look good - the screen goes next and things start to get hard to fix after this!
    13. Add the screen - the thin side of the metal bezel goes towards "Player 1" or the little arrow on the LCD board points up to "Player 2". Make sure it's flat and solder it down.

    Wow!

    That was a load of soldering but we're now only a few steps from having a playable game console.

    Step 8: Assemble the Console - Plugging Up

    Most of the remaining assembly is just plugging and screwing together. The trick with all of these will be getting the polarity right.

    1. Insert the SD card into the sound module. This is fiddly - you have to slide the metal cover forwards and lift it, then insert the card, drop the cover and slide it back.
    2. Plug the module into its sockets. Easy but make sure the half-round cutout aligns with the mark on the board.
    3. Bend the chip pins in a little on the desk if needed and then plug in - again, make sure pin 1 is correct by aligning the markings on the chip and the board/socket.
    4. Align the charging board with the hole you made and hot-glue to the case. The holes strategically positioned in the PCB will allow the charging lights to be seen through the case lid, even when the PCB is over the top.
    5. Now the speaker gets glued the other side of the case and the switch is put through its little hole and the nut put on to hold it. Check it's not interfering with the sound module.
    6. The easiest way to make the battery line up without needing longer leads is to fix it to the top of the chip with a little double-sided tape. Make sure the red wire goes to + on the header when you plug the battery up.
    7. Now plug in the rest of the components that you just fixed to the box - the charging board must go with the correct polarity but the switch can go either way. I tried to match the speaker polarity but it does not seem to matter much.
    8. Time to slip the pot's into their slots and add the retaining nuts. The board can be screwed into the standoffs on the box and the knobs added to the pot shafts.

    That's assembly done but don't fit the lid yet - time to program it console, add the top cover and play!

    Step 9: Program the Board - LCD, Characters and Aliens

    The sketch provides the method by which we will read the inputs (two switches and two analogue potentiometers) and generate the appropriate output on the LCD display and/or sound module. The sketch was written in the now somewhat out-dated Arduino 1.0.3. It may run on newer versions but 1.0.3 is still available for download if you need it.

    The key for displaying on the LCD is a modified version of the excellent PCD8544_SPI library by Arthur Liberman (aka 'The Coolest' - http://www.alcpu.com). This is tweaked to allow characters beyond 127, which are defined to represent the aliens, some smaller font numbers and the spare ship icons.

    The modified version of the library is attached to this step as a .zip file. Unzip and save it into the libraries directory in Arduino 1.0.3. Restart Arduino and it should be picked up.

    In the modified library, characters 0x80 to 0x8D represent seven pairs of aliens with each alien having two forms in consecutive characters. Characters 0x90 to 0x99 contain numerals 0 to 9 in a miniature font, which allows the score to be displayed without taking a whole line of the display. These are the same ASCII codes as normal digits 0 to 9 but with the top bit set. We use that in the sketch to make displaying numbers easier. The spare ship icon is also defined here in 0x9A.

    The Nokia 5110 LCD displays six lines of characters, each character being defined in a 6x8 (w x h) pixel grid. Because you need a space between characters, in practice the font is defined as five bytes per character, with each byte representing one column of the character. Both the library definition and the LCD itself take character data in this format (one byte representing one column of 8 pixels). Weird, I know.

    I printed the attached character design sheets and had the kids colour in boxes to generate two forms of each alien. I defined a few myself and let them make 2-3 more. They added up the values for each of the coloured boxes to give a number representing each column in their alien design. This was then validated using the attached Excel sheet to check that the numbers they had calculated represented the aliens they had designed. We don't use the top row so that the aliens don't merge when displayed.

    To enter a new alien into the sketch, open the file PCD8544_SPI.h from the library folder in WordPad or similar text editor and edit the character definitions in 0x80 to 0x8D. Save the file and reload Arduino to implement the new aliens.

    Step 10: Programming - the Sketch Functions

    The sketch itself is attached to this step. It's fairly lightly commented but the variable and function names should be fairly self-explanatory and I think it's pretty straight-forward so feel free to adapt it as needed. Please keep in mind that I only get stretches of around 20-30 mins at a time on my commute to write sketches so it's probably not the most elegant or systematic piece of code. It works pretty well but use it at your own risk!

    In general, the main functions of the code do the following:

    void setup():

    This simply initiates the LCD and sets the pinMode for switches etc. It would play a "hello" sound if one is set, displays the current battery voltage and briefly tests the backlight. It reads the high scores, backlight brightness and sound volume from EEPROM and initialises the EEPROM if this chip has not been used for the game before.

    void loop():

    Each function of the console has a "gameType". This includes the main menu and the settings menu. The main loop simply directs us to the appropriate subroutine. When returning from a subroutine we need to set the correct gameType (e.g. gameType = 0 for main menu).

    void pong():

    This reads the position of the player 1 bat and either manual or automatic position of player 2 bat. It then checks the position of the ball, checks how long the game has been played (increasing the speed every 30s) and updates the screen. The variable frameDelay holds the period in ms between frames and after updating the screen, it waits for that period to expire before starting again.

    void invaders ():

    Similar to the Pong game, this cycles round reading the bat (player) position, checking the status of the shots and bombs, updating lives, checking whether the game should speed up, moving the aliens and updating the screen. The aliens move one pixel across at a time, but they animate only every 4 pixels so they don't simply blur and the better resemble the original game. As described in the last step, the aliens are held and displayed as characters, as are the score and the spare lives. The bat and the UFO are drawn with lines. The UFO fits in the 3-pixel space above the top row of aliens, which we gained by defining a very small font for the score.

    void checkBatt():

    This monitors the battery voltage and prompts the user to turn off and recharge if the voltage drops below 3.6v.

    Step 11: Programming - Upload the Sketch

    Programming this board is just like programing most other Arduino boards but the key thing to remember is that this board does not have an auto-reset so you will need to press the "reset" button (that small red tactile switch) at the right time to upload a sketch. This can take a few tries to master.

    Hardware:

    For this step, you will need a PC loaded with the Arduino software (v1.0.3 with the modified library loaded if you are using my sketch), your newly made console board and a CP2102 UART to USB converter. An FTDI based USB to UART board should work exactly the same as long as it has a 3v3 output.

    Connect 3v3 (not 5v) from the CP2102 to 3v3 on the console board. Connect the Gnds together. Connect Rx on CP2102 to Tx on the console and Tx on the CP2102 to Rx on the console (sometimes the CP2102s are marked backwards so if this doesn't work try joining Tx to Tx and Rx to Rx).

    Sketch:

    My sketch is attached to the previous step. You will also need to modified PCD8544 library from an earlier step loaded into the libraries folder.

    The sketch was written in Arduino IDE v1.0.3. I have not tested it on any other version. The only additional library needed should be the modified PCD8544 library. The SPI and EEPROM libraries are required but should have come with the Arduino IDE.

    Upload:

    To talk to the console board you will need to load the drivers for the CP2102 on your PC and select the new COM port in the Arduino environment. Now select the board as "Arduino Pro Mini 8MHz". The 8MHz is important because you used an 8MHz crystal and so if you select a 16MHz board then all the timings will all be off (& it might not work correctly because the '328 is only guaranteed stable up to 16MHz on a 5v supply).

    To load up the sketch, click "upload" and wait for it to compile. When the IDE shows the final compiled size, press and release the reset button on the console board. Lights should flicker for a while, then the sketch should start up and say "Hello" on the LCD. This is a good sign!

    Step 12: Play!

    Once the sketch is loaded, disconnect the CP2102 and screw down the cover. Your console is now ready!

    To play, flick the toggle-switch and observe the battery charge level. If it's lower than around 3.8v then it's a good idea to re-charge. Plug the console into a USB port using your charging cable and watch through the hole near the little arrow on the LCD board to see the charging lights. My board goes red for charging and then green for fully-charged.

    The menus use the player-1 knob to highlight an option and then player-1 button to select. In some cases the player 1 and 2 buttons are used to select alternative actions, for example to re-play a game or return to the menu.

    I'll put the videos here too, so that you can see how your resulting console should operate.

    Pong:

    Invaders (Start of Game):

    Invaders (After a few waves):

    Happy Gaming!

    Ugi

    Step 13: Annex

    In this step I have simply Annexed the handout that I gave to the kids on the day that we did this project - it may help as the basis for another project for someone. It assumes that the case-mods, the bootloading and preparing the sound module/SD card have been carried out in advance. It would also make useful off-line instructions if you were making this project yourself.

    Happy Gaming!

    Ugi

    Raspberry Pi Contest 2016

    Participated in the
    Raspberry Pi Contest 2016

    Full Spectrum Laser Contest 2016

    Participated in the
    Full Spectrum Laser Contest 2016

    Gaming Contest

    Participated in the
    Gaming Contest