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


    Building your own hand held gaming console Part 1

    WP_20151111_23_02_12_RichSince getting involved with Arduino and other Microcontrollers, I have designed and built several ‘consoles’ with the most involved one, the HalfByte Console Computer having its own PC Board designed and fabricated.  That was a fun project, well, they all have been, but this one was special: it was my first PC board design that was ‘produced’.   I also managed to design another console, but this was a game rig that went in an old Gameboy case.  This was only partially my design, as the 328 was actually an Arduino Mini Pro.  I added a sound amp, the screen and controller circuitry. So, it wasn’t entirely my design and it was a bit less satisfying. So…

    I designed my own hand held from the ground up. This one, currently, lacks sound, and has a simpler controller: three buttons which translate into an action button, a left/up and right/down set of buttons. There is also a reset switch.

    This design is very simple: it is a minimalist Arduino 328 compatible with four switches and a Nokia 5110 LCD screen.

    WP_20151103_22_17_58_Rich_LIThe whole thing is on a perf board (in this case, it was a freebie board from Bay Area Circuits, go to their website and request the free boards, there Is a link for the request. These are very nice boards and a cool blue color.)

    I started out by placing the parts on the board to see if I had room.  I did.

    Be sure to photograph the board with the parts located where you wish to place them, this way you have a record of where you put them.

    WP_20151103_23_11_54_Rich (2)

    My initial design had only left and right buttons, no third button. I added that and the reset button to give me a bit more flexibility.

    And, one lesson learned: socket the screen.  On the 5110, the thicker part of the bezel is the TOP, not the bottom.

    For this project, you will need:


    Part Name



    Ceramic Capacitor



    16MHZ Crystal




    220 ohm


    AtMega 328P



    28 DIP Socket

    28 pin


    Momentary Push Buttons



    Red, LED




    150 ohm


    Four pin header



    5110 LCD


    Parts placement is up to you, but I put the crystal and two caps under the screen, but you can put them where ever you want.

    HalfByteHandheld2_schemI would start by placing the 28 pin socket and header on the board first. Solder them in place, use ample solder because you will have to solder wire to the socket and header. Use tape to hold them on the board while you solder them in place.

    The LED is the only part that could be soldered in wrong because the key is hard to see. It is the flat side of the LED that is soldered to the resistor.

    WP_20151109_22_44_49_Rich_LIOnce everything is soldered in place, insert your 328 controller chip and apply power.  If the 328 contains the standard Arduino boot loader, the pin 13 LED should blink.  If it does, congratulations! You now have a fully functional computer in your hand.

    Some things I plan to add are sound and, perhaps, two more buttons.  I may add a video out option, but this is meant to be a handheld, so the video may not happen.

    Stay tuned for part two, the software.



    Short Video

    Half-Byte’s handheld and more

    Windows Phone 038In previous posts, I’ve written about developing a handheld gaming console.  While it is not yet complete, the console now has a case and a controller.  Finishing touches to the hardware will include a new bezel, battery compartment and screen mount.  I used an original Gameboy case from 1989. Don’t worry, nothing has been cut and I kept the electronics.  I got it off of eBay for about four dollars. It was as a broken unit, though the seller says it did work ‘once in a while.’ I purposefully bought a broken unit as I could not bring myself to rip apart a working Gameboy.

    When the unit arrived, it was well worn, so I cleaned it up, dismantled it and painted it metallic black.  Finding Testors model car paint locally was as hard as finding the micro female HDMI connector for my Raspberry PI Laptop. I also clear coated the case once the paint had dried.Windows Phone 008

    Fitting the handheld in the unit was a bit tricky, but it does fit, although I have to do some work with the screen mounting.   I was also able to use the d-pad and one of the two red buttons. The other three buttons will be either for expansion or, likely, I’ll just fix them in place for looks. Not sure yet.

    The result is going to be pretty nice, albeit large for today.  I knew the old Gameboy was huge, but I forgot just how big they were. The main board uses surface mount parts, which kind of surprised me. I know the original device was based on the Zilog Z-80, but, looking at the board, there is a custom Nintendo CPU chip. I’m guessing it has a complete Z-80 as well as whatever custom pieces parts that Nintendo put in. At any rate, it is the perfect size for the somewhat retro handheld that is going in the case.

    WP_20131219_001The specs for the handheld are, indeed, retro: 2K of RAM, 8K of ROM, 84 by 48 monochrome graphics, a vintage ‘90s cell phone screen, vintage ‘80s case…Mario style side scroller game.

    When test fitting the two boards in the case, I realized that my custom controller almost fit the button layout. Only one button needed to be moved and that was the action button. So, rather than desoldering the existing button, I cheated and added a separate button and mounted it so it was under the ‘A’ button. I reused the speaker that came with the Gameboy, since it fits perfectly. I have added a power switch and a reset button that is accessible through one of the small holes on the side of the case. Now, since the handheld will not have every connector and switch that the Gameboy had, there will be a few open holes on the side and bottom of the case. I may fill them but, will probably just leave them alone for now.  I do plan to upgrade the screen at some point, so I may revisit the holes then.

    This project has inspired me to go a bit further and design something from scratch.  I have a PC Board designed and am building the prototype from that design. The board is a bare bones Arduino UNO without the expansion connectors. It will feature audio and video connectors, a Wii Nunchuk/Classic Controller connector, optional PS/2 keyboard connector and be based on the same Atmel328 processor that the UNO uses. The design is super simple and is designed for games and learning to program.  I am also considering the same treatment for the handheld. I have modified the Tiny Basic code to include things like primitive string handling, limited graphics and memory saving shortcuts for several statements and functions. There is also a beginner’s guide in the works.

    Stay tuned for more on this.