Friday, July 26, 2013

BeagleBone GamingCape


TEAM MEMBERS

Max Thrun

PROJECT DESCRIPTION

Older brother of the LaunchPad GamingPack, the BeagleBone GamingCape transforms your BeagleBone into a full fledged hand-held gaming console capable of playing all the classics such as NES, Gameboy, Sega GameGear, and even Doom. Just drop in 4 AAA batteries and you'll be playing your favourite games discretely at work in no time.

PROJECT FEATURES

- 320x240 16Bit Color TFT LCD
- Analog joystick + 2 Thumb Buttons
- 3D Gyro, 3D Accelerometer, 3D Magnetometer
- Headphone Out + Mic In
- Supports:
  • NES
  • GameBoy
  • GameBoy Color
  • GameBoy Advance
  • Sega Master System
  • Sega Game Gear
  • Doom


Video




http://www.youtube.com/watch?v=wj1T84orbeY

Cape Design



The GamingCape is a conglomerate of existing, open source, BeagleBone capes all brought together in a handheld game console form factor inspired by the original Nintendo Gameboy. The four designs that I primarily leveraged are the LCD3, Audio , and Battery capes from CircuitCo and Interacto by Chris Clark.





Doing the layout was a little tricky because I had to be aware of all the areas where the case would touch the PCB. This led to some tight layouts such as the 5V power supply stuff (top layer, right below the switch). I also had to completely re-layout the 3D gyro and accelerometer components once because I had the keep-out layers disabled and didn't realize the space I was in was going to be hit.







The schematic capture and PCB layout were done in CadSoft EAGLE and the PCBs were fabricated by Silver Circuits

Schematics, layout, and CadSoft EAGLE file can be found here and the bill of materials can be found here.

Case Design



The whole system was completely modelled in Autodesk Inventor before most of the PCB layout was even started. This was necessary as parts of the case sit directly on the PCB and their dimensions needed to be known in order to keep out of those areas while doing the layout. Rodney Hill of Logic Supply was kind enough to provide me with a great, accurate, model of the BeagleBone Black which was an enormous help.

The case is designed as a stack-up of 11 laser cut pieces of Delrin. I chose Delrin over ABS because of the two sample pieces I ordered from McMaster the Delrin seemed to be "more black".


An exploded view of the stack up:


The case is locked together by screws on either side which thread into a hex standoffs. The standoffs are locked into place and prevented from spinning by hex cutouts in the first 4 plates under the PCB.

I was fortunate enough to have access to a 3D printer and was able to print the whole case and ensure all of my dimensions were 'close enough' before I paid for it to be laser cut.



In order to reduce fabrication costs it was important to use as few different thicknesses as possible. All pieces in my design are cut from 1/8" and 1/32" sheets. The layouts that I sent to get cut are for 24"x12" sheets and yield enough pieces to build two cases:




All the layers required for one case:








All of the 3D design files can be found here: https://github.com/bear24rw/gamingcape/tree/master/3D

Games



Getting the emulators up and running on the BeagleBone proved to be a little challenging. It seems that a lot of the Linux emulators aren't actively maintained and wont even compile. Lucky, Gentoo maintains patches for a few of them and I was able to use portage to fetch a patched source tree.

For the NES emulator, fceux, I was able to fetch, unpack, and patch the source on my Gentoo host and then send it to the BeagleBone where I compiled it natively. Fceux seems to work fine although I did have to patch it to center the screen:
https://github.com/bear24rw/gamingcape_fceu/commit/ac1555d7d562ee15479374c4be103a994670e4ab

For the Gameboy emulators it seemed that VisualBoyAdvance was the go-to. Again I got a patched version from portage and tried to compile it on the BeagleBone but it not only took ages but also ate up an enormous amount of RAM. At one point I was using a USB flash drive as swap space. Needless to say it failed to compile. I ended up just cross compiling it which seemed to work okay even though I didn't really setup a proper environment and was using my hosts systems header files.

For Doom I was lucky enough to find a SDL port that pretty much "just worked" which was refreshing after I tried half a dozen others which wouldn't even build.

For Osmose I found a forum post where someone had gotten it to run on a Raspberry PI. It pretty much "just worked" too.

The common issue that all the emulators share is that they are using SDL to render and the BeagleBone doesn't really support OpenGL. This means that it's really expensive to scale the screen up in non-integer units. You'll notice in my video that all the emulators were running at the original systems native resolution.

All the emulators that I patched and got working are hosted on my github:

https://github.com/bear24rw/gamingcape_osmose
https://github.com/bear24rw/gamingcape_vba
https://github.com/bear24rw/gamingcape_fceu
https://github.com/bear24rw/gamingcape_doom

Resources


https://github.com/bear24rw/gamingcape
http://hipstercircuits.com/enable-serialuarttty-on-beaglebone-black/
http://azkeller.com/blog/?p=62
http://wiki.beyondlogic.org/index.php/BeagleBoneBlack_Building_Kernel
http://www.armhf.com/index.php/using-beaglebone-black-gpios/
http://beaglebone.cameon.net/home/reading-the-analog-inputs-adc
https://github.com/beagleboard/kernel/tree/3.8
http://www.eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-InstallBootloaders

82 comments:

  1. Hey Max, just great.

    I too am playing with the BeagleBone Black: http://ao2.it/93

    Not as ambitious as your project tho :)
    Keep up the good work.

    Ciao,
    Antonio

    ReplyDelete
    Replies
    1. Hey Antonio! Thought your name looked familiar, it's been a while since the PS3 webcam stuff.Pico projectors are pretty cool, you have any big plans for it?

      Delete
    2. Pico-projectors are fun indeed :) I've got a couple of ideas for some pet-projects, the first easy one should be ready in a few weeks.

      It'd be also cool to use the BBB, the PS3 Eye and the pico-projector for some Computer-Vision/Augmented-Reality stuff but that'll take a lot more time.

      Delete
  2. Firstly, I think this project is amazing, but I do see some potential headaches. How are you handling the need for start and select buttons for NES/Gameboy/Gameboy Color? How are you handling the Left and Right bumpers for GameBoy Advance? How are you handling the third button (or the six button controller inputs) for Sega/Gamegear games?

    ReplyDelete
    Replies
    1. The start and select buttons are handled with Up+A+B=Start and Down+A+B=Select which works okay. The other buttons for other systems are not being handled. The lack of start and select are both a result of oversight and lack of room to fit them. I originally only planned on playing gameboy + nes on this so the other systems are just extra. This project was totally designed and built in 6 weeks so there wasn't a whole lot of design time up front. If I were to ever try to actually make a product out of this I would definitely add a dedicated start and select and maybe even shoulder buttons up top.

      Delete
  3. Amazing are you selling boards ?????

    Amazing engineer my i ask your age ?

    ReplyDelete
    Replies
    1. No plans to sell it at the moment sorry. I'm 23.

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Hey Max,

    brilliant project you have going here, definitely something that you could release to the community,
    I've taken a look at your current provider for your PCB's and reckon you should take a look at our community based platform for providing PCB's at a much cheaper rate

    we offer a great service to our community and pride ourself on our customer satisfaction!

    Check us out at ragworm.eu

    ReplyDelete
    Replies
    1. Hi Connor,

      The ragworm service looks pretty good, I'll definitely consider using it for the next board I make.

      Max

      Delete
    2. guys at http://oshpark.com/ are offering 1 square inch for 5$ and you get 3 boards and the boards are made in US but the lead time its not 10 days and shipping from US can take a bit of time

      but ragworm.eu looks good too i will give them a try :P

      Delete
  6. Very impressive work! I'm curious though, why do you need to buffer the LCD data lines?

    ReplyDelete
    Replies
    1. Check out this discussion here:

      https://groups.google.com/forum/#!searchin/beagleboard/lcd$20buffer|sort:date/beagleboard/XUd71RQKL7c/5TIsUDS97uYJ

      Delete
  7. This is great! Amazing design and ability to play multiple games? Any chance you could make the parts available on a website and people could build their own version of it?

    ReplyDelete
  8. Amazing job and fully documented.
    I've got two questions:
    - which linux on the BB ? Angstrom ?
    - How long (roughly) the battery last ? (just to give an idea, I imagine it's not optimized and all..)

    Thanks and well done again.

    ReplyDelete
    Replies
    1. Yeah it is Angstrom, I am running the latest 3.8 kernel from the beagleboard github though. Someone on the beagleboard googlegroup said they got a couple hours out of the circuitco battery cape so I imagine I'm in the 1-2 hour range. I haven't done any real tests to see though.

      Delete
  9. Amazing work Max!
    Thanks for sharing, good luck for the rest of your project.

    ReplyDelete
  10. Nice job,
    How much time did you spend to do that?

    ReplyDelete
  11. It was designed and built in 6 weeks. I don't want to even try and count the hours spent in those 6 weeks though haha

    ReplyDelete
    Replies
    1. How can i get one of those do u sell them?

      Delete
    2. No immediate plans to see it, sorry.

      Delete
  12. This is amazing, excellent design and work. I envy your prowess.

    ReplyDelete
  13. I agree with every encouraging and positive comment! Really great work Max! I look forward to following you future contributions.

    ReplyDelete
  14. i was thoroughly entertained by the video.
    very impressive work!

    ReplyDelete
  15. Wow, well done buddy! Just a bit painful replacing the batteries when they are dead. Should have put in a LiPo for rechargeable greatness. Don't take that as criticism though! I am in awe of your skillz!

    ReplyDelete
    Replies
    1. I did consider using a LiPo but ended up deciding against it since it was more expensive and would require additional circuitry (for charging and what not). It's also way faster to just swap the batteries out than wait for a LiPo to charge.

      Delete
  16. HAHAHA! This is so awesome and so legit!

    ReplyDelete
  17. Wow Max! That is super cool! The video is great; I dig all the detail on how you packaged it. Very clever! Seems you're an amazing solderer as well. I've done some surface mount hand assembly. You can make a mess of things pretty quick. Are there any apps that feature the nifty sensors?

    ReplyDelete
  18. Hi! I need some quick help. I'm replicating your gaming cape and have everything ordered except the 10V 10UF 0603 X6S SMD caps. For some bizarre reason, that temperature rating is out of stock everywhere. The 85c components are in stock. Not the 105c. Is it a big deal to downgrade the component to 85c?

    Also, with your laser cut plastic, did you send out to do that? If so, where did you send it? What file format did you send them as a template? I've never ordered laser cut plastic before.

    FINALLY what are the screw and standoff dimensions? I didn't see any reference to the fasteners.

    THANKS SO MUCH for your time! Your design is incredibly nice. I wish some over seas fabrication company would pick up this design and sell it as a kit. Oh well! Have to do it the hard way :D.


    ReplyDelete
    Replies
    1. The temp rating (and tolerance) doesn't matter for any of the components.

      Just a heads up, the footprint for the audio oscillator is mirrored and I never got the audio chip working. It draws 200mA which is totally wrong. I'm not sure if it is a layout issue or I just wasn't soldering it down correctly.

      I got my plastic laser cut from pololu.com. I just sent them DWG files.

      Also, if you are using my layout I'd suggest increasing the annular ring for the the battery pack through holes. They are way too small and I was barely able to solder the battery packs in.

      Definitely keep me updated on your project!

      Delete
    2. Thanks for the update. I'll manually verify the layout for the audio chip to see if there is a glitch somewhere. You could have a dead chip as well. Shorted due to ESD or something like that.

      Do you remember the specs for the fasteners? thread pitch, standoff length, etc?

      Thanks again!

      Delete
    3. ALSO...what's the exact part number or description for the male SMD headers to connect the Beaglebone to the gaming cape? I've figured out it's the 0.1" pitch. But, frankly, buying connectors has always confused me :D There are so many variants.

      Delete
    4. The standoffs and screws are part numbers 91780A017 and 91249A058 from mcmaster.com

      The SMD headers are TSM series headers from samtec:

      http://www.samtec.com/technical-specifications/default.aspx?SeriesMaster=TSM

      Delete
    5. Thanks for getting back. I settled on this from Digikey: 1212-1226-1-ND. Downside is they only come in 16 pin blocks. I looked for Samtec actually but didn't see any in stock.

      All my parts and fabbed boards (minimum qty 4 ordered) are coming in in a week or so. I'll post back with my success/failure story :D

      Delete
    6. I actually sampled them from Samtec. Not sure if they'll approve your sample request if you don't have a corporate or edu email address but it's worth a try.

      Delete
  19. OK! Got my prototypes from Silver Circuits. BRAVO to that company. Nice job! I had to buy QTY 4 as a minimum purchase and they sent 5! Nicely silkscreened, slotted, drilled, and pre-tinned.

    Anyone need a board to play with?

    OK, I got my Digikey parts in and inventoried the massive lot. While I was doing so, I realized I forgot to ask you where you get the cool red button covers for the game pad button? Did you buy those or have them fabricated?

    ReplyDelete
    Replies
    1. Awesome! What soldermask color did you get? Silver circuits always does a great job, I've used them for 4 projects now and they've always been perfect.

      Sorry I forgot to put the button caps on the BOM. Here are the digikey part numbers for all different color ones:

      401-1247-ND
      401-1250-ND
      401-1246-ND
      401-1251-ND
      401-1253-ND
      401-1248-ND
      401-1252-ND
      401-1249-ND

      Also, for the one button that goes over the 0402 resistors you might have to trim the plastic on the cap a little to get full travel.

      Keep me posted on your progress!

      Delete
    2. I didn't specify the color. They used white for the screen.

      I'm going to have to break out my stereo microscope for this soldering job. Everything is so tiny.

      Thanks for the part numbers!

      Delete
    3. I didn't know you could NOT specify a color. Would love to see pictures of the PCBs if could post some.

      Yeah there are some small components! Make sure you get all the 0402s down. I struggled for a while trying to figure out why the LCD wasn't working. It turned out a couple of the 0402s weren't soldered down 100%

      Delete
    4. I see what you mean by mirrored oscillator.

      I looked at the schematic to check the audio codec and I can't see anything that stands out. Maybe you didn't solder the heat sink properly? IDK. I thought at first the auxiliary input lines should be grounded so they won't float, but the white paper says they are internally disabled via register settings.

      Here is a picture of your baby: http://img841.imageshack.us/img841/3383/4dbt.jpg

      Delete
    5. Thanks for the picture! Yeah, I'm not sure what's wrong with the audio. Let me know if you get it working!

      Delete
    6. NEXT question :D How did you map the GPIO and analog inputs to the games? Is that config just part of the emulator patching process or did you write some sort of I/O shim?

      Delete
    7. I patched all the emulators. For instance the NES emulator:

      https://github.com/bear24rw/gamingcape_fceu

      This file does all the IO stuff:

      https://github.com/bear24rw/gamingcape_fceu/blob/master/src/drivers/sdl/beagleboy.cpp

      And this is where is gets actually 'patched' in:

      https://github.com/bear24rw/gamingcape_fceu/blob/master/src/drivers/sdl/input.cpp#L935

      Honestly this is a pretty crude way of doing it. A better/more universal way would be write a separate program that runs in the background monitoring the buttons and joysticks and then translates them to keyboard key presses and sends the to X11.

      Delete
    8. Hey I just noticed from your picture that you didn't fix the audio oscillator footprint. You'll have to deadbug the oscillator like this:

      http://imgur.com/6lNxQwf

      Delete
    9. This comment has been removed by the author.

      Delete
    10. I'll be kludging a few things on the board. For instance I'll be adding a small bank of buttons for start/select/aux functions. Not a big deal. I may have to kluge something on the audio codec, who knows.

      Delete
    11. Re keypress emulators. I'm SURE someone has already written a GPIO keyboard wedge. I'll post the data when I find it.

      Delete
  20. max please can you tell me wath's diffrence in you bom digikey quantity and board quantity can you send me the order you made or the list of the exact componenet i need

    ReplyDelete
  21. and for case screw and pcb wich file i need to send to silvercircuit and mc mcmsater

    ReplyDelete
  22. hi frank pc i need board how much i need please respond quickly i'm on go to do the all job

    ReplyDelete
  23. Thanks for sharing this post. With the growing number of gamers out there, post like this is indeed informative.

    ReplyDelete
  24. Hi, I'm trying to get visualboy to run on my beaglebone black with angstrom 3.8.13 using the provided binary. However, when i try to run it i get this error:
    ./VisualBoyAdvance: error while loading shared libraries: libminizip.so.1: cannot open shared object file: No such file or directory
    I've tried finding the library that contains this but have had no luck so far. Do you have any advice?

    Thanks,
    Ian

    ReplyDelete
    Replies
    1. Hm. I don't remember having to do anything special for minizip (could have though, I can't remember honestly). libminizip.so is part of the "zlib" package (at least on Gentoo). You could use the "opkg" package manager in Angstrom to see if you can install it with that. If you cant get it through 'opkg' you can download the source from here: http://www.zlib.net/ and try to compile and install it manually.

      Delete
    2. If you can't get minizip still here's all I did and I haven't had a problem. There is an older version, 1.2.7, which was suppose to be the last to support minizip, but I've been able to get it to work with 1.2.8 with the download from the zlib sourceforge repository. I just did the following and haven't had a problem with minizip.

      tar -xzf zlib-1.2.8.tar.gz
      cd zlib-1.2.8
      ./configure; make; make install

      I had already done the same for sdl 1.2.15 and libpng 1.6.7, I think zlib was my last build/install.

      -Jeff

      Delete
  25. Hi, I have been trying to replicate part of this project and I have run into a slight problem. I am trying to run the osmose emulator on the beaglebone black. I have successfully managed to launch a game but it does not seem to want to accept the keyboard inputs for the actual game controls. The function keys and escape work perfectly fine but the a,b and direction controls don't seem to do anything.
    Thank you for your time,
    David

    ReplyDelete
  26. I told you in my last post before if someone have any boards to sell but no one acccept to respond me

    ReplyDelete
  27. Is the analog stick input the mouse input? What about the buttons?

    ReplyDelete
    Replies
    1. It could be mapped to the mouse if you wanted. Currently, I just modified all the emulators to read the ADC values directly.

      Delete
  28. Anyone interested in a free board? I have a spare.

    ReplyDelete
    Replies
    1. yes me but all are responding when they want are racist or what i need end my project i need boards

      Delete
  29. Hey Great work!

    I'm trying to figure what configurations you have used to compile Kernel ?!
    I will assume that you have integrate same fixes that involve disabling HDMI that are related to Audio cape.

    Anyways i would appreciate if you can make kernel config file available or point to the information that i should start from. Purpose will be to learn and understand how does linux works with hardware.

    Thank you.

    ReplyDelete
    Replies
    1. Hey,

      I just recompiled the kernel with the default config:

      https://github.com/beagleboard/kernel/tree/3.8

      I disabled the HDMI via a kernel option which you can see here:

      https://github.com/bear24rw/gamingcape/blob/master/software/install.sh

      Delete
    2. Thank you for reply , i'm new in Linux and how it works with hardware.

      I'd like to ask another question, If i want to skip eeprom based configuration what where can i reed more about that ?

      eg. if i have board with TLV320AIC3106 only and i want to enable.

      any suggestions helps

      Thank you

      Delete
    3. If you don't want to use the eeprom to do the configuration you can manually load the dtbo file by echoing the name of it into a /sys file like I do here:

      https://github.com/bear24rw/gamingcape/blob/master/software/init_gamingcape.sh#L2

      Delete
  30. This comment has been removed by the author.

    ReplyDelete
  31. Max,

    Wow. I got a Beaglebone Black for Christmas and my mind is going crazy thinking of all the things I want to do with it. Your project really stands out and I'm super impressed. Anyway, quick question(s): what would be needed to get the BBB to output video to an old arcade monitor that only really wants to display 320x240 RGB video at 15Khz?

    ReplyDelete
    Replies
    1. Does the arcade monitor accept VGA? If so easiest way would probably be to find some kind of HDMI -> VGA adaptor.

      Delete
  32. Unfortunately, not really. Old monitors like that use analog RGB plus a sync signal. Was hoping by some miracle there may be something with the LCD connection that the BBB dumbed down to analog considering the LCD cape does 320x240. Guess my first project is to build a cape that converts the HDMI signal into something usable and still small form factor.

    Phil

    ReplyDelete
    Replies
    1. Hm. If you are going to build your own converter it would be much easier to tap off the LCD lines than the HDMI

      Delete
  33. Great job! I don't see part ID of male surface mount pin headers in material list. Did I miss it?

    ReplyDelete
    Replies
    1. No you didn't miss it, I forgot to include them in the BOM sorry.

      They are TSM series headers from samtec:

      http://www.samtec.com/technical-specifications/default.aspx?SeriesMaster=TSM

      The part number is either "TSM-123-01-L-DV" or "TSM-102-01-L-DV". I don't remember which one.

      Delete
    2. It looks like none of them.

      Delete
    3. Don't go by the render on the site. The DV at the end of the part numbers I listed stands for (D)ual row (V)ertical.

      Delete
  34. Tour de force. I am blown away. Excellent!

    ReplyDelete
  35. Hey, I was wondering if these are available for purchase? email me at totehro@gmail.com . Thanks!

    ReplyDelete
    Replies
    1. Also forgot to mention... I'm 14 so I really can't do anything with this (hardware wise) other than supply the batteries xP. But I am able to load the software and stuff. So for this whole thing to be preassebled, how much would that cost?

      Delete
    2. Hey Ashton, unfortunately I have no plans to sell these.

      Delete
    3. Oh, ok. I'll see if I can get someone to build one for me. BTW, this is the most wonderful product I have ever seen like this. Thank you very much for using your brain for the better of mankind!

      Delete
    4. Also this link does not work, the 3d design one : https://github.com/bear24rw/gamingcape/tree/master/3D

      Delete