본문 바로가기

라즈베리파이(RPI)

[추천][해외] Raspberry Pi로 Gameboy 만들기.

안녕하세요 버섯돌이 유재성입니다.

국내에도 라즈베리 파이를 이용해서 게임기를 만드시는 분들이 몇 분 보이시는데..

아래 해외 글의 경우 제작과정이 상세하게 나와있어서 퍼다 나릅니다.^^

무엇보다 3D 프린팅용 파일이 제공되어서 퍼오지만 그 만큼 제작과정은 상당히 힘들어 보이는군요.^^

유사 작품을 고민중인 분들은 다른 글들도 구글링하시면서 적절히 참고 하시기 바랍니다.

 

출처 : https://learn.adafruit.com/pigrrl-raspberry-pi-gameboy?view=all

 

Overview


gaming_hero-2.jpg
Celebrate the 25th anniversary of that classic gaming device by building your own with 3d printing and DIY electronics from adafruit. In this project we'll use a raspberry pi and TFT touch screen to make an epic DIY gamegirl. 

The 3d printed enclosure will house all the components and can be printed in your favorite color. We'll hack an SNES gaming controller and reuse the printed circuit board, buttons and elastomers.

gaming_parts.jpg
gaming_pigrrl-adabot.jpg

3D Printing

Author Gravatar Image NOE RUIZ
gaming_3d-parts.jpg

Designed to Print

This project is just two pieces! They are optimized to print on any FDM 3d printer with a minim build area of 150mm x 150mm x 100mm. Perfect for printing your Printrbot, TAZ4, RepRap or makerbot. Check out info below for recommended slicer settings.
piboy-top.stl
piboy-bottom.stl
PLA @230
2 shells
10% Infil
0.2 layer height
90/120 speeds
No Raft 
No Support

Snap Fit

The two pieces snap together and are secured with philips screws. The Raspberry Pi, PowerBoost 500 and Micro Lipo charger are mounted to the piboy-bottom.stlpart with #6-32 x 1/2' phillips screws.

Favorite Color

The tolerances are optimized for PLA filament but may work with ABS and other material types. Since the enclosure is only two pieces, it's easy to swap out cases for different colors!

No Support

This design is optimized to print with no support material.

Circuit Diagram

Author Gravatar Image NOE RUIZ
The illustration below is a reference of the power circuit and the game controller buttons. The position of the components are not exact and not to scale.
gaming_circuit-diagram.png

Power Circuitry

We'll be using a large rechargeable battery to power the PiGrrl for a few hours! To keep the battery recharged, use a MicroLipo or MiniLipo board (they're the same basically, just one has a microB jack, the other has a miniB jack)
The good thing about this battery is it's fairly small and dense. But it doesn't have 5V output, it only has aboue 3.7V output. And you really need 5V. So we'll use aPowerBoost500 which can boost the 3.7V up to a nice clean 5V which the Pi likes very much.

When the battery dips too low, a red light on the PowerBoost will light up to warn you its time to recharge!

You can recharge and play at the same time

Keypad Circuitry

In order to make the control pad feel just like the original, we'll 'recycle' a SNES controller. By opening it up and cutting out the PCB we can reuse the rubber elastomers and buttons. 

The way the keypad works is super-simple. Each elastomer has a piece of conductive material on the back. When it presses down onto the PCB, it shorts two golden pads together. One pad is ground, the other pad is the signal. We'll reuse the CupCade GPIO code so that each pad is one RasPi pin. When that pin is shorted to ground, we'll generate a keypress
gaming_keypad.png
Your keypad may be slightly different looking! Don't worry! Just trace out the copper to identify the common ground trace for each set of buttons!
Below is a list of Raspberry Pi connections that will be wired to the corresponding buttons. 1-26 are the number of wires in a Pi cable bundle, with 1 being the white (ground) colored wire. We dont connect to the last 6 pins because those are used for the PiTFT display!
  1. 3v3 - n/c (not connected)
  2. 5v0 - connect to output of PowerBoost500
  3. SDA - LEFT BUTTON
  4. 5v0 - n/c
  5. SCL - RIGHT BUTTON
  6. GND - connect to ground of boost
  7. #4 - DOWN BUTTON
  8. TXD - n/c
  9. GND - connect to ground on Dpad
  10. RXD - n/c
  11. #17 - UP BUTTON
  12. #18 - START BUTTON
  13. #27 - A BUTTON
  14. GND - Select/start ground pad
  15. #22 - B BUTTON
  16. #23 - SELECT BUTTON
  17. 3v3 - n/c
  18. #24 - n/c
  19. MOSI - n/c
  20. GND - AB BUTTON ground pad
  21. n/c
  22. n/c
  23. n/c
  24. n/c
  25. n/c
  26. n/c

PiTFT Mini Kit

Author Gravatar Image NOE RUIZ
gaming_screen-solder-front.jpg

2.8' PiTFT Mini Kit

Our 2.8' touch screen kit includes the goodies you'll need for assembling the screen. You just need to solder the extra tall male and female 2x13 headers to the PCB. Be sure to check out our step-by-step guide by clicking the link below!

Assembly Tip

Here's a quick tip on soldering those headers. If you have any fun-tac, place a bit of tac on sides of the headers to hold them in place while you solder and remove it when you're done.

Power Circuit

Author Gravatar Image NOE RUIZ
gaming_power-circuit.png

Jump 500mAh Mini Lipo

Bridge the 500mAh connection on the micro lipo usb lipoly charger by applying a good amount of solder to the two golden pads.
This will make it so you charge the battery at 500mAh for a fast charge rate
gaming_500mA-jumper.jpg

Set JST Wire

Grab a set of wires with a JST male connector that's about 60mm in length (you probably have the one that came with the miniLipo charger!) Insert the positive and negative wires through the right mounting hole. Strip the wires and place the exposed wire into the GND and BAT pins.
gaming_powerboost-connect-JST.jpg

Solder JST to MiniLipo

Flip the charger over and solder the black wire to GND pin and red wire to BAT
This cable will let you connect to the PowerBoost easily
gaming_powerboost-solder-JST.jpg

Check 5V LED

Plug in the battery with a JST connector to the MiniLipo charger. Plug the JST from the charger to the PowerBoost 500. Check to see if the green LED lights up on the PowerBoost. If it does, it totally works and is Boosting fine!
gaming_test-5V-LED.jpg

On Off switch

The boost converter has true-disconnect capability so we can just tie the ENable pin low to do a complete power shutdown
  • gaming_solder-switch-1.jpg
  • gaming_solder-switch-1.jpg
  • gaming_solder-switch-2.jpg
  • gaming_solder-switch-3.jpg
  • gaming_switch-soldered.jpg

Slide Switch

Secure the slide switch to a third-helping hand. Tin the two terminals of the slide switch. Solder two wires (about 80mm in length) to the slide switch. Solder one wire to an outer most terminal and the other to the middle terminal.

PowerBoost 500 Switch

Secure the PCB to a third-helping hand and position the two wires from the slide switch wire to GND and EN pins.
gaming_switch-enable.jpg

Solder Switch to PowerBoost 500

Flip the PCB over and bend the exposed wires down to secure them while you solder the EN and GND pins.
gaming_solder-enable.jpg
gaming_enabled.jpg

Enabled Switch

With the switch now soldered to the EN pin, it can safety power on and off! Try flipping the switch to see the green LED turn on and off
gaming_13._full_setup.jpg

Power Circuit Setup

With the parts all wired up, you can insert the slide switch into the piboy-bottom.stlpart through the switch hole on the side.
Feel free to take a break after completing this section and play some Mario Kart or have a refreshing drink
gaming_battery-solder.jpg

2200 Lithium Ion Rechargeable Battery

This battery may come with a set of two wires that have a male JST connector. You'll need to trim that wire down to about 6mm and solder it to the set of wires that are soldered to the end of the battery. Be sure to tin the wires and use heat shrink tubing!

Pi Cable

Author Gravatar Image NOE RUIZ
We'll be recycling a GPIO cable for the Raspberry Pi to get to the many wires necessary!
Before chopping off the connector, check to ensure it's the right end.

Cut Connector

Use a pair of wire cutters to snip off the connector.
gaming_cut-end-CHECK-RIGHT-END!!.jpg
gaming_end-cut.jpg

Pull-n-Peel

Separate the Pi cable wires and familiarize yourself with the wiring list outlined in the circuit diagram. Use a wire stripper to strip the ends of the individual wires.
gaming_pull-wires.jpg

Pulled Wires

The wires can be pulled all the way but peeling it half way ensures it stay neat and tidy once its connected to the Raspberry Pi.
gaming_pulled.jpg

Snip Set of Wires

Remove the last 6 wires from the bundle, we won't be needing them in this build. This is the OPPOSITE end from the one with the white wire!
gaming_cut-last-6-wires.jpg

Optimize Wires

Also remove wires #4810171819. We won't be needed these also, so trim them down!
gaming_cut-wires-4_8_10_17_18_19-too.jpg
gaming_connect-pi-cable.jpg

Install Pi Cable

If the PiTFT screen is attached to the Raspberry Pi, remove it and add the Pi Cable in the correct orientation, with the middle sockets lined up and the arrow pointing to the white wire.

Prep Button PCBs

Author Gravatar Image NOE RUIZ

Upcycling the SNES controller

You'll need to gut a SNES gamepad controller and use the buttons, elastomer gaskets and PCBs. Start off by disassembling the controller by removing the screws in the back of the controller.
gaming_controller-board-parts.jpg

Disassemble Gamepad

With the back plate removed, carefully remove the cable from the enclosure followed by the PCB, elastomer gaskets and buttons.
gaming_controller-board-inside.jpg

Unsolder main cable

Secure the gamepad PCB to a panavise jr. or third-helping hand. Heat up your soldering iron and unsolder the 5 small wires from the main cable.
gaming_controller-board-unsolder.jpg

Separate the PCB

We'll need to separate by PCB into three pieces - DPad, A+B , Pause + Select. You have the option to choose your preferred method. We found using a Dremel resulted in a higher quality than using super scissors.
gaming_cut-board.jpg
Be extremely careful when using power tools and sharp tools. Wear protective eyewear. Only in an area with proper ventilation. Consider wearing a dust mask. Use a proper vise to secure PCB while cutting.

Etching Traces

Use an xacto knife or razor blade to expose the needed traces that will wire up to the Pi cable. Follow the photo above and the circuit diagram to reference solder points.
gaming_etch-board.jpg

Tin PCBs

Now that your PCBs are cut and etched, you'll need to tin the pads with a bit of solder. Again, use a panavise jr. or third-helping hand for assisting while you solder. The SNES controllers tend to use phenolic PCBs which do not take extended heat as well as FR4 so work quickly and studiously!
gaming_2._tin.jpg

Wiring Buttons

Author Gravatar Image NOE RUIZ

Left DPad

Solder wire #3 to the left button on the exposed trace of the DPad PCB. There's a small hole you can thread the wire through.
gaming_wire-_3-LEFT.jpg

Right DPad

Solder wire #5 to the right button of the DPad PCB.
gaming_wire-_5-RIGHT.jpg

Down DPad

Solder wire #7 to the down button of the DPad PCB. Tweezer are handy while soldering!
gaming_wire-_7-DOWN-tweezer.jpg

Common DPad

Solder wire #9 to the ground of the DPad.
gaming_wire-_9-is-common-DPAD.jpg

Up DPad

Solder wire #11 to the up button of the DPad.
gaming_wire-_11-UP.jpg

Start Button

Solder wire #12 to the start button on the start+select PCB.
gaming_wire-_12-START.jpg

A Button

Solder wire #13 to the A button on the A+B PCB.
gaming_wire-_13-A.jpg

Common Start + Select

Solder wire #14 to the ground of the start+select PCB.
gaming_wire-14-GND-for-start-select.jpg
gaming_check-your-work.jpg

Check your work

Put the soldering iron down and double check all the wires are soldered to the right buttons.

B Button

Solder wire #15 to the B button on the A+B PCB.
gaming_Wire-_15-B-Button.jpg

Select Button

Solder wire #16 to the Select button on the Start+Select PCB.
gaming_Wire-_16-SELECT.jpg

Common A+B

Solder wire #20 to the common ground of the A+B PCB.
gaming_Wire-_20-AB-ground.jpg

Last Check

Take one last pass at the wiring and reference the list in the circuit diagram. If everything looks good, move onto the next page!
gaming_last-check.jpg

Software

Author Gravatar Image NOE RUIZ
gaming_mario.jpg

Setting Up SD Card

Since we're using the same controller setup at the CupCade we're also going to use the same SD card image! Download this image which has NES support
This is a big file (about 840 megabytes) and will take a while to transfer. 

After downloading, the disk image needs to be installed on an SD card (4GB or larger). If you’re new to this, the process is explained in Adafruit’s Raspberry Pi Lesson 1.

Configuring Pi

Attach a keyboard to the PiTFT+Pi and insert the new CupCade SD card.
The Pi may boot and reboot to finish the configuration (such as expanding the image)
Once you boot the Cupcade you'll notice that the display is vertical. You'll have to rotate the screen!

Press Alt-F3 to drop out of the GAMERA software and to the shell. Log in with pi/raspberry and edit /etc/modprobe.d/adafruit.conf with sudo nano /etc/modprobe.d/adafruit.conf
and change the fbtft line to this:
Copy Code
<ol class="linenums" style="box-sizing: border-box; margin: 0px; padding: 0px;"><li class="L0" style="box-sizing: border-box;">options fbtft_device name=adafruitts frequency=80000000 fps=60 rotate=270</li></ol>
Then sudo reboot to have the new rotation activate!

You can always nicely shutdown with a keyboard attached by typing ESC which will quit the emulator/GAMERA

Upload ROMs

Your PiGrrl can run MAME ROMs as well as NES! We have documenation on how to install ROMs over on the cupcade tutorial page
For MAME ROMs, you'll only be able to play 'horizontal/landscape' style ones!

First Test

Author Gravatar Image NOE RUIZ

Connect Pi Cable

Insert the Pi cable into the back of the Pi TFT in the correct orientation.
gaming_plug-cable-into-PiTFT.jpg

Keyboard + Power

Test the circuit with a USB micro cable connected to the micro USB port on the Raspberry Pi. Connect a USB keyboard to the side of the Pi for input.
gaming_keyboard-and-power.jpg

Check Boot

The PiTFT should boot up into the Game ROM Aggregator

Remember you have to set up the screen rotation to be 270 so check the previous step if you haven't done that yet!
gaming_check-boots.jpg

PDad Test

Lay the PDad elastomer gasket over the PCB and place the plastic part on top. Press the PDad up and down to test for a solid connection.
gaming_test-D-pad-nav-GAMERA.jpg

More Buttons!

Add the rest of the elastomer gaskets and select a game to play test.
gaming_put-more-pads-on.jpg

Play Test

Run Mario or something similar to test out the latency. It may be a little difficult to play like this but will feel more natural with the top part on.
gaming_super-mario-or-similar-for-testing-buttons.jpg

Final Assembly

Author Gravatar Image NOE RUIZ

Mounting Raspberry Pi

The Raspberry Pi is mounted to the piboy-bottom.stl part with 2 #6-32 x 1/2' Phillips screws. Position the Pi into the bottom enclosure and hold it in place while you fasten the two screws.
gaming_screws.jpg

The Last Two Wires

Solder wire #2 to the Positive+ pin and #6 to Negative- pin on the PowerBoost 500.
gaming_wire-_2-to_on-boost.jpg

Solder Negative

Solder wire #6 to the negative- pin on the PowerBoost 500.
gaming_wire-_6-neg-on-boost.jpg

Mounting LiPoly Charger

The MiniLipo charger is mounted to the piboy-bottom.stl part with 2 #4 x 3/8' flat Phillips screws. Position the charger near the bottom right of the enclosure with the USB port facing the hole.
gaming_attach-lipo-charger-two-front-screws.jpg

Mounting PowerBoost 500

PowerBoost 500 is mounted to the piboy-bottom.stl part with 2 #4 x 3/8' flat phillips screws. Lay the PCB in the center of the part, just below the Pi with the JST facing towards the bottom. Hold it place while you fasten the screws.
gaming_tuck-powerboost-and-attach-with-2-screws.jpg

Mounting Battery

Position the 2200mAh lithium battery to the bottom of piboy-bottom.stl with the wires facing up. Press it into the clips to snap it into place.
gaming_add-battery.jpg

Installing Gamepad PCBs

Grab a chunk of fun-tac or putty and separate it into three pieces. Roll these pieces into strands and carefully tac them to the surface of the three pillars in the center of the piboy-bottom.stl part.
gaming_parts-inside-case.jpg

Position the three PCB over the corresponding platform and press it down to hold it into place. Lay the piboy-top.stl part over and check to see if the traces line up with the button cut outs. Keep adjusting and checking the position of the races to get consistent alignment.

gaming_tacked.jpg

Once you have good alignment, hold the piboy-top.stl part with the inside face up. Place the buttons and elastomer gaskets into the enclosure. Still holding the top part, grab the piboy-bottom.stl (containing all ze electronics) and place it top ofpiboy-top.stl and snap them together.

gaming_align-buttons.jpg
gaming_elastomers-on.jpg

Closing Enclosure

Use 4 #6-32 x 1/2' flat Phillips screws to secure the piboy-bottom to the piboy-top.stl

Trouble Shooting

Author Gravatar Image NOE RUIZ

Buttons aren't working

Make sure the pads align up with the PCB

Buttons too hard to press

Elastomers might have slipped when closing the case. Make sure the wires aren't obstructing any of the pillars.

Power randomly shuts down

Make sure the solder points on the charger and PowerBoost aren't loose.

Takes too long to fully charge battery

Make sure the lipo charger is shorted to charge at .5A

Enclosure won't close

Check that the wires aren't in the way of any of the pillars or buttons.