Monthly Project Arduino Game

From BinarySpace
Jump to: navigation, search

Introduction

The Gamebuino is a very nice little arduino compatible game console. It's a nice little platform to play games on and to learn about arduino and game development. Inspired by this we are building a diy version on a breadboard (which can then be transplanted to a veroboard). This is perfect for getting a hands on experience and learning more about arduino and electronics. If you are only interested in playing games or doing embedded game development (ie. you don't want to build this stripped down version) then rather buy yourself a Gamebuino.

Gb complete.jpg


Project/Workshop Night 26 February 2015

Required Components

  • Nokia LCD + Level Shift
  • Arduino
  • Buttons (x7)
  • Jumper Wires
  • Breadboard
  • Speaker

Build Instructions

Build instructions are divided into different pieces to test each piece and to learn how it goes together

Connect LCD

  1. Follow the 'Nokia 5110/3310 Monochrome LCD' tutorial from Adafruit to hookup and test your lcd.
  2. If all goes well then you should have a adafruit flower on your display.

Next you need to change the lcd wires according to the Gamebuino setup:

 #define SCR_CLK 13  
 #define SCR_DIN 11
 #define SCR_DC  A2
 #define SCR_CS  A1
 #define SCR_RST A0

This means you need to change the following wires:

 7 -> 13
 6 -> 11
 5 -> A2
 4 -> A1
 3 -> A0

Install Gamebuino Library

Once you have tested your lcd according to the adafruit tutorial and modified your lcd wiring we can now get the Gamebuino library and test it on our setup.

  1. Download the Gamebuino Library
  2. Extract to a temporary folder
  3. You only need to copy the Gamebuino,petit_fatfs and tinyFAT folders from the zip file downloaded in step 1 (found in libraries folder) to your arduino library folder (mine is at C:\arduino-1.0.6\libraries)
  4. If your Arduino was running then close and open again
  5. Open the a_Hello sketch under the Gamebuino examples and load onto your arduino

If all went well then you should have the following showing on your screen

Gb helloworld.jpg

After a few seconds it will turn to this (the gamebuino has a battery connected so it will check a non-existing battery and claim that the battery is low. We will fix this in the next step)

Gb lowbatt.jpg

Disable Battery Monitoring

To disable battery monitoring we need to edit the settings.c file in the Gamebuino library. (Mine is located at C:\arduino-1.0.6\libraries\Gamebuino\settings.c). Close Arduino before doing the change

Find the following line:

 #define ENABLE_BATTERY 1 //disable battery monitoring

and change to:

 #define ENABLE_BATTERY 0 //disable battery monitoring

Battery Monitoring should now be disabled and it won't give you the error message any more. Remember to recompile your test sketch and upload to the arduino.

Add Buttons

Without buttons you can't really play any games, so lets wire up some buttons:

You will need 7 buttons (up,down,left,right,A,B,C). The are connected to the following pins on your Arduino:

 #define BTN_UP_PIN      9
 #define BTN_RIGHT_PIN   7
 #define BTN_DOWN_PIN    6
 #define BTN_LEFT_PIN    8
 #define BTN_A_PIN       4
 #define BTN_B_PIN       2
 #define BTN_C_PIN       A3

Connect the push button between the pin number above and GND. The gamebuino library uses internal pull ups so no resistors needed (although couldn't hurt).

Arrange the buttons on a piece of veroboard similar to the following layout:

Gb buttons.jpg

Add Sound

Sound output is on Pin 3.

Hookup a 8 ohm speaker with a 100 ohm resistor between pin 3 and gnd.

Play Games

Either develop your own or download games from the Gamebuino site.

Hardware/Kits

Component kits were cancelled due to lack of interest.

BinarySpace members remember to use your discount code. Order you kit here

Resources

Our DIY project is based on the Gamebuino, it's very awesome so consider buying one for yourself :)

Gamebuino