An ATTiny85 based handheld game

WP_20161228_21_29_19_Pro (2)Yes, I love gaming.  And there is nothing more satisfying, to me, than building, sometimes coding and playing something I made.  Now, I don’t always WRITE the code, after all, time is a premium these days, but I don’t mind taking something someone else did and making it work with what I built.  For this project, I was very lazy: the design is also someone else’s.  I really wanted to do something with the ATTiny85, but have not really done anything outside of playing with the Adafruit Trinket or Digispark.

So, for this little project, I wanted to also use one of my cool little ssd1306 OLED screens.  While perusing the net, I came across Webboggles.com.  Here, they are selling a nifty little kit called the ATTiny Arcade Keychain. It looks to be of high quality and the author (Ilya Titov) goes through much detail in the design and build.  There are several posts about it and the games.  The game code and schematic have been made readily available. The first of the games was breakout and that is where I started. 

To build the little game, you will need the following:

  • Attiny85 + dip8 socket
  • SSD1306 OLED screen
  • 3x push buttons
  • 2x resistors (10kOhm optimal)
  • Piezo speaker
  • 3V 2032 coin cell battery
  • perf or vero board
  • I used a little speaker out of a toy cell phone instead of the piezo. I would also recommend socketing the screen instead of soldering it directly, you don’t have to, but I wish I had now.attiny85game_schem

    One other thing to keep in mind, you will need a way to program the ATtiny 85 chip, which I will describe in a follow up post. I actually built two programmers: one on breadboard and a quasi shield for the UNO.  I like that better.

    As you can see from the schematic, it is really simple. Even so, I made a few mistakes at first.  Not paying attention to the chip pinout, I got the pins reversed from pin 8 to pin 5. I, for whatever the reason, assumed the actual pin 8 was pin 5, instead of going from pin 4 to pin 5 at the bottom of the chip. Once I figured that out (I had yet to apply power) the rest was easy. I also got SCL and SDA backward (hey, I’m old).  Once I got my mistakes corrected, I was amazed that this simple circuit was now a little game machine.  Now, you aren’t going to play Call of Duty or even Doom, but you can play many classics on the devices.  I am going to build one or two more as this was a blast. I would also encourage ordering a kit from Webboggles as well.

    My next post will discuss creating an Attiny 85 programmer for the UNO.

    WP_20161231_15_20_15_Pro (2)

    11 thoughts on “An ATTiny85 based handheld game

    1. what version of arduino ide are you using? it looks like Ilya is using 1.0.
      i’m using 1.8 and it doesn’t work; even though it compiles and downloads.
      all my wireing has been verified as well as attiny and screen.
      please advise.
      thanks,
      ron w.

        1. I get a error message about ssd1306init not found so I included a 1306 library and it compiles but nothing happens ???
          i’m not using a speaker so pin 6 is open. please advise, thanks.

        2. Something you might try, if you never got this working, is to go into the .h file for the library and make sure the screen address, SDA and SCL pins are correct. Mine were not on a more recent version and changing these fixed that. Go to HalfByte’s facebook page for more.

        3. the screen is blank…..
          I tested the screen…again, and blinked the attiny85 after burning to 16mhz.
          again the sketch compiles but nothing on the screen
          I’m using everything from the webboggles site.
          this is so strange and I’ve never had a problem like this. keep in mind that the sketch doesn’t compile “as is” without me having to include an additional 1306 library.

        1. thanks for replying. i’ll double check bootloader setting and try again. i’ll keep you posted.

    Leave a comment