Introduction: PiStation 2: Raspberry Pi 4 Inside Playstation 2

About: I am a hobbyist / maker. I enjoy designing and building circuits and PCBs, robots, woodworking, and anything to do with LED lights.

For quite some time I've wanted to put a Raspberry Pi inside of a Playstation 2 housing with the goal of being able to use it as a retro gaming system as well as the option to use it as a Linux computer via the Raspberry Pi desktop. One of the main goals of the project is to make it look as close to a "stock" PS2 as possible while still being able to easily connect peripherals via the USB 2.0, USB 3.0, HDMI, and ethernet ports on the Raspberry Pi. I've seen where people have used the expansion bay as a panel for mounting the Raspberry Pi while still having access to most of the ports, but I wanted to also be able to connect internally to other devices via the USB, and I also wanted to be able to position the Pi near the PS2 fan to be able to use it as additional cooling. Internally, I wanted to use a USB 3.0 port to connect a SATA hard drive for extra storage capacity for media, ROMs, and other programs.

Additional features that really round the project out are full integration and functionality of the Playstation's front panel power and eject buttons as well as the LEDs on the buttons, PWM controlled PS2 fan speed based on CPU Temperature, and RGB LED lighting to add some visual flair.

It was a struggle at times to get everything to come together and work properly. I reached out on various forums about the programing side of things as I am not very strong in coding and most of my experience has been with Arduino or ESP type microcontrollers. I have "borrowed" some code from other instructables and forum posts and I will list and link all references. That being said, I hope to make this easy to follow along and I think that anyone can make this project, regardless of skill level.

Supplies

There are a few supplies that are necessary for this project. I will list the mandatory and the optional supplies. Optional supplies are broken out by the use-case. If you don't want to integrate the buttons on the front of the PS2, then you wont need to make the custom PCB and therefore do not need the components associated with that. If you don't want to add an internal hard drive, then you will not need to purchase the drive or the adapter cable for it. If you don't want super-cool LEDs inside your playstation, then you don't need those either. But lets face it; Why even go through with this if not to fully integrate it and make it look great too?

Mandatory Supplies:

1. Playstation 2 (Not required to be working, although we will reuse the power supply inside)

2. Raspberry Pi 4 (4GB or 8GB would work. I used a 4 GB) Amazon

3. Micro SD Card (8GB or larger)

4. Short (1 ft) CAT6 ethernet patch cable Amazon

5. Short (1 or 1.5 ft) USB 3.0 male x male cable (2x) Amazon

6. Short (1 or 1.5 ft) Micro HDMI male (Type D) x HDMI male (Type A) cable (2x) Amazon

7. Short (1 ft or less) USB 2.0 male cable (will be cut in half) (2x) Amazon

7. 3D Printed expansion bay panel downloaded from my GrabCAD here

8. HDMI keystone jacks (2x) Amazon

9. USB 3.0 keystone jacks (2x) Amazon

10. Ethernet keystone jack (1x) Amazon

11. 5V 5A Buck Converter PCB module

12. Various lengths of wire

13. Dupont jumper cables (or the ability to make your own Dupont cables)

Optional Supplies

For integration of the buttons:

1. prototype PCB board

2. 2N3904 transistors (3x) Amazon

3. PN2222A transistor Amazon

4. 1/4W 1K ohm carbon film resistor (Purchase something like this kit from Amazon for all resistors)

5. 1/4W 10K ohm carbon film resistor

6. 1/4W 22K ohm carbon film resistor (2x)

7. JST-XH 2-pin connector housing (I have a kit of JST-XH connectors similar to this one on Amazon)

8. 3-position screw terminal Amazon

9. 1N4001 diode Amazon

10. 1x5 male Dupont connector pin row

11. 1x7 male Dupont connector pin row

12. strip of WS2812B LEDs, 60 LED/m density, 12 LEDs in length Amazon

For adding an optional internal SSHD hard drive

1. Internal SSHD 2.5" drive (I used Seagate FireCuda ST1000LX015) Amazon

2. USB 3.0 to SATA adapter

Tools:

Soldering station / soldering Iron and solder Amazon

Dremel with cut-off wheel Amazon

Screwdrivers of various sizes (phillips and flat)

Electrical tape

3D printer (or access to one) Amazon

Pliers (multiple varieties)

Step 1: Opening Up and Tearing Down the Playstation 2

OK so now that we have our supplies and all of our tools we can get started. The first step is to open up the playstation 2 and prepare it for its transformation.

First, we want to remove the expansion bay from the back of the unit. It should come off pretty easily by hand. If you are not able to pry it out with your fingernails, a small screwdriver will slide right in behind the small tapered cut out on the top and allow you to pop it off.

Once you have the expansion bay door off, you can flip the PS2 upside down and look for the 8 screws that hold it together. They are located behind the padded feet and small screw covers. These just pop off easily with either your fingernails or a small screwdriver. Be careful not to scratch the plastic when prying them out. Behind these are 8 phillips screws that need to be removed.

Lastly, there is a piece of tape on the back of the PS2 that needs to be removed or cut. WARNING: this will void your warranty. If you are concerned in any way about the warranty on your 20 year old last last last generation console, just stop right now. Put the screws back and walk away. This is not for you. Otherwise, go ahead and remove or cut the tape with a utility knife along the seam.

After you remove the screws, flip the PS2 back over to its right-side-up position and carefully lift the top off. You may need to work it and angle it forward as you lift to get it around the CD tray front panel. Also, be careful of the ribbon cable connected to the button assembly. This ribbon assembly should be removed from the PCB end. The other end should stay connected to the button assembly.

Once you have the top case off, you can remove any screws holding down the main PS2 PCB, the screws on the controller and memory card module, and the screws holding the fan and mains power switch. You should now be able to pull the controller and memory card module off the frame and disconnect the ribbon cable connected to it. Set this module aside for now, we will come back to it later.

Next flip the entire unit over and remove the 4 screws on the back side holding the power supply (PSU) control board on to the frame. Pull the PSU off and set it aside (you will need to disconnect the 2 wire connector coming from the power inlet). We will be reusing this. There is also a piece of plastic protecting the PSU from the metal of the frame. We will remove and save this as well. With the PSU and clear plastic shroud out of the way, we can now remove the rest of the screws holding the main mother board on. Once you have removed all these screws, the main motherboard should come off the frame along with the heatsink panel. Set this all aside for now.

Lastly, we will remove the CD-ROM drive and remove the "guts" from it. With the PS2 right-side-up, we can remove the CD-ROM drive by prying outward on the tab on the front side of the unit that holds it in place. There are also 2 tabs on the back side that hold it in from behind. It should be easier to pry the front tab while lifting the front of the drive up. Once it clears the tab, it should lift up and out. Next we can remove the internals of the CD-Rom drive by unscrewing the screws that fasten it in. Once the drive is removed from the plastic housing, you will be left with the housing and tray along with the gears and sliding mechanism that still allow the tray to open and close by pulling or pushing the tray. Be careful not to break the tabs that hold the front of the drawer with the PS2 logo (like it did). they break very easily.

At this point you should have everything torn down to the bare metal frame. Now it starts to get interesting. Lets move on and get our hands dirty...

Step 2: Hacking Things Up a Bit

There are a few internal modifications that need to be done in order to make room for the components that we will be installing. The cables and wires actually take up most of the space inside, but we are adding a hard drive, a small PCB, a buck converter module, and of course the Raspberry Pi.

The first thing that we will do is to cut an opening above the expansion bay so that the wires can be easily fed from the upper section down to the expansion bay area where our back panel and hard drive will be located. The lower expansion bay section can be removed to make it easier to work with at this step. I marked the rough opening with a marker and then cut it out with a dremel with a cutting wheel attachment. After cutting the opening, I filed it with a metal file to smooth out any sharp edges. I decided that this still wasn't smooth enough for wires to be routed through, so I also taped all the edges with electrical tape. This may be overkill, but I didn't want to cause any issues in the future.

The next thing that I needed to cut apart is the main PS2 motherboard. I debated whether or not to actually cut this apart or sell it on Ebay for $20, but in the end I decided to cut it up because I wanted to reuse the front USB ports and the rear A/V ports. The rear AV ports wont be used for anything in this project, but it is needed to keep the stock look and fill the hole in the housing. So, we cut the USB and rear AV ports off of the motherboard with the same dremel tool, being careful to cut it so that the mounting holes are able to be utilised to hold it in place. Once these are cut off they can be set aside for use later when we put everything back together. The picture of the USB ports shows the soldered USB cables that we will cover in the next step. I didn't take a picture of the USB ports after i cut them and before I soldered the cables. Finally, I desoldered the 4-pin connector from the motherboard where it connects into the PSU. We will reuse this connector to make the power connections later. The rest of the motherboard can be dropped off at your local e-waste recycling center.

The last bit of demolition that we will need to do is to the side of the CD-ROM housing. In the last step, we removed the "guts" of the CD-ROM drive, and now we need to make a cutout in the plastic to allow for the cables to easily pass from the expansion bay slot into the main area where we will have the raspberry pi. Also, if you are adding an external hard drive, you will need to allow for some clearance for the drive as well. Looking at the front of the CD-ROM drive, we will need to cut the left side to allow for the clearance that we need. I made the cuts with a dremel with a cut off wheel and then filed the cutout a little to remove plastic burrs and other debris. Make sure to slide the drive tray out fully when you make the cuts to ensure that you don't damage the tray. The tray is not used in my project, but you may want to use it for something in yours. I just kept it so that I had something to keep the drive tray front with the PS2 logo attached to.

At this point, everything is torn down and hacked up as much as we need and we are ready to begin Frankensteining this bad boy back together.

Step 3: Reinstalling the Power Supply Board and Frame Into the Housing

Once you have everything cut in the previous step, you can put the PSU back on the bottom. First put the clear plastic shroud back in place, and then screw the PSU back in place with the 4 screws (one in each corner). Don't forget to reattach the wires to the mains power input switch. Next flip the frame over so the power supply is on the bottom and set it back into the bottom housing shell. At this point, you can put the back panel that houses the fan and mains power switch back in place, as well as fitting the switch into its slot and setting the fan in place. Put the piece that you cut off the motherboard with the video output back onto the frame so that it lines up with the cutouts in the housing, and secure it with a screw.

Step 4: Preparing and Installing the Front Panel USB Ports

In order to use the front panel USB ports on the PS2, we will be connecting them to the Raspberry Pi's USB 2.0 ports. In order to reuse the piece that we cut off of the motherboard, we have to also remove any components from the small piece of PCB that we cut so that they don't affect the circuit at all. I heated the small resistors and capacitors with a soldering iron and pulled them off with pliers. I'm not sure if this is entirely necessary, but I did it as a precaution.

Next we need to solder USB cables to the pins on the top of the PCB that we cut off the motherboard. I just took 2 old USB cables that I had laying around and cut them with about 4-6 inches of wire from the USB type-A end. If you are looking at the USB ports from the front with the PCB on top, the order of the wire colors to be soldered should be (from left to right) red, white, green, and black. If you want to verify this, you can connect your cut USB cable into the USB port on the PCB and check continuity with a multimeter from the cut end of the wires to the solder pins on the top of the PCB. This will let you know where the wires need to get soldered (or you can just reference the previous paragraph and the pictures). In order to protect the (very sloppy) soldering job, I covered the PCB with electrical tape both below the wires and then again over top after the solder had cooled. Your finished USB assembly should look like the second picture and can now be placed back into the housing on the frame. There is a little tab on the frame that slides into the bottom (opposite side as the PCB) of the USB stack. You may have to lift the frame out of the shell a little to slide this in place. Then set the frame with the USB assembly back down into the housing while holding the USB assembly in place. The screw hole is actually held in place by one of the outer shell screws that we removed from the bottom of the housing shell and will not get put back in until everything else is done. For now, the USB assembly just sits in place.

Step 5: Custom Interface Board (optional)

This step is optional for those not comfortable with soldering. I designed a custom interface board that serves multiple functions. Full integration of the buttons on the PS2 front panel (power and eject) was a project requirement. However, I didn't want to only integrate the button function, but also incorporate the LEDs in the buttons themselves. The power button has a red and a green LED and the requirement of the project was for that LED to be red (signaling standby) as soon as the mains power switch was activated on the back of the PS2, and then to turn green when the raspberry pi was turned on. Then it should also again turn red when the raspberry pi was shutdown. The button should also function as a power button and turn the pi on and off, but to properly shutdown the pi it has to also run a safe shutdown script. The eject button also will have a function. There is a strip of WS2812b RGB LED lights in the front of the PS2 that will be controlled by the eject button. The default LED strip will be off at startup, and the purple LED in the eject button will be off. Upon pressing the eject button, the LED in the button will come on and the LED strip will light up red. Each press of the button will cycle through one of 4 preset colors, and on the 5th press, the LEDs will be off again as will the led in the eject button. This of course can be changed easily and custom animations or different colors can be (and most likely will be in the near future) easily programmed. The last function of this custom board is to control the PWM signal for the fan so that the PS2 case fan can be controlled with PWM based on CPU temp. There is a small 2-pin JST connector for the case fan on the board.

Attached is a schematic of the control board and the components used. I will explain how each section works briefly.

The section in the box marked "LED Logic Circuit" consists of 3 NPN Bipolar Junction Transistors (BJT) and 3 resistors. when the mains power is turned on and the 12V PSU comes on, +12V DC power is allowed to flow into the button PCB on the PS2. because of R103 in the schematic acting as a base resistor and allowing current to saturate the base of Q103, it is automatically saturated and turned to an "on" state allowing 12V to flow from the collector to the emitter and out to ground which completes the circuit and turns the red LED on. The base of Q101 is connected to Pin 11 on the Raspberry Pi (through the base resistor R101) which is driven high at startup of the Pi by a script that runs at startup. When this is driven high, it saturates the base of Q101, which allows current to flow from the collector to the emitter of this transistor to ground. This basically takes the current from the base of Q103 so it cannot go into saturation, effectively turning it "off". This makes the red LED turn off. At the same time, the same signal is sent to the base of Q104, saturating it and allowing current to flow through the collector-emitter path of this transistor and turning the green LED on at the exact same time the red LED turns off.

The section marked "PWM Fan Control" is what we are using to make the 3.3V PWM signal from the Raspberry Pi control the 5V fan. PWM Stands for Pulse Width Modulation, and is a method of cycling power on and off at varying speeds to control the speed of the motor (or brightness of an LED, etc.). We are using another NPN BJT here, the PN2222A. The PWM signal from the Raspberry Pi is driving the transistor on and off to regulate the speed of the case fan. There is a diode installed to protect the circuit from voltage spikes when the fan is turned off. This is called a flyback diode. This portion of the control board was borrowed from another instructable written by Aerandir14 in the instructable found here.

The power connections on the board are screw terminals. The other are just Dupont pin headers that I can easily attach ribbon cables with dupont ends to.

There are 2 specific cables that I made for this board. The first is the 5-pin cable with female dupont ends on both sides. One side is a single 1x5 connector and the other side are individual single connectors so that they can easily be connected to the different Raspberry Pi GPIO pins. The second cable is a little different. One end is a 7-pin female dupont connector (1x7 works, but I only had 1x4 and 1x3 connectors so that's how I did it). For the other end, I wanted something that I could easily connect the 7-pin FFC ribbon cable to. I settled on this Molex connector 52806-0710 which i purchased from Digikey. I was able to easily solder to the pins, using heat shrink tubing afterwards to keep everything clean and tidy. The ribbon cable from the button PCB slips right in perfectly.

The final assembly with wires can be seen in the picture above.

Step 6: Prepare and Install the LED Strip (optional)

Next we will prepare and install a strip of 5V WS2812b RGB LEDs (60 LEDs/meter density) that will be visible through the front vent on the PS2. I used a strip of 12 LEDs and cut a piece of rigid scrap plastic that I had to the same size as the LED strip as a rigid backer. Before peeling and sticking the LED strip to the plastic, I first soldered wires to the strip. I used red for +5V, black for ground, and green for signal. I also crimped the end of the signal wire with a female dupont connector so that it can easily be connected to the Pi's GPIO pins. After soldering the wires to the strip, peel the tape off the back and stick it to the rigid plastic strip. I also wrapped the soldered end of the strip with electrical tape to protect it. I used a small piece of double sided tape in the frame to secure the LEDs in place. I also had to cut a small piece of the frame to allow the LEDs to pass through. You can see in the picture where it was cut with the Dremel. You should now have your LED strip mounted in the frame and the wires ready for hook up.

Step 7: Buck Converter and Other Connections

The PSU from the original Playstation outputs 12V DC. There is a connection on the PSU that the motherboard was plugged into that we will utilize to make connections to the PSU and connect it to a buck converter so that we can make 5V DC to power the Pi, the fan, and the LED light strip. In step 2 we desoldered the power connector from the motherboard. Now we will solder 2 red wires to the left 2 pins and 1 black wire to one of the pins on the right side, using heat shrink to protect the connections after they are soldered. The pins are (from right-to-left) +12V, +12V, GND, GND, and can be seen labeled on the board connection in the picture above. One of the red wires will be directly connected to the +12V input on the custom PCB for controlling the LEDs on the power and eject buttons. The other red wire and the black ground wire will be soldered to the input of the buck converter module. Then another red and black wire can be soldered to the output of the buck converter (red for positive, black for negative). The plug end can now be connected back into the main PSU. I attached the buck converter to the frame using one of the mounting screws and mounting holes for the motherboard that we are no longer using. I made sure to lay some electrical tape down on the frame below the buck converter to prevent it from shorting to the frame.I've also loosely routed the USB 3.0, HDMI, and Ethernet cables through the expansion bay and have them laying generally where they will go .

At this point, it is a good idea to check that the PSU and buck converter are working and to set the buck converter to 5V. Plug in the mains power and throw the switch on the back of the Playstation. The LED on the buck converter should light up, signaling that it is connected and receiving power. Using a multimeter connected to the output wires of the buck converter, check the DC output and adjust the set screw on the variable resistor until it reads 5.0 V at the output.

Next I cut a small length off of a USB type-C cable that will be used to power the Pi. I routed this cable through some holes near the front of the frame and brought all the power and ground cables together near the expansion bay in the front. Now i was able to connect them to the screw terminals as shown in the electrical schematic. One +12V wire comes directly from the PSU board through the single wire that we soldered to the connector. Next, the +5V connections are the red wires from the USB type-C cable, the buck converter output, and the LED strip power wire. This will be the 3 +5V red wires. Next, you should have all the black wires tied to the ground terminal. The black wires will be from the USB type-C cable, the buck converter output, and the LED strip. There will be 3 ground cables to connect. For each connection, twist all the wires together and insert them in the screw terminals. Once they are all installed, I put the custom PCB down in the expansion bay as shown in the picture.

Step 8: Prepare the Raspberry Pi

For this project, I purchased a case for the Raspberry Pi with a large aluminum heatsink and dual fans. I knew that I would most likely want to overclock the Pi, so cooling was going to be important. The one I purchased from ebay (link here) is decent, but I think there may be better ones out there. Basically the entire case is an aluminum heatsink, but it doesn't make contact with the CPU or GPU, which would be better for cooling.

After installing the Pi in it's case and connecting the fans to +5V and GND, I prepared and installed Raspberry Pi OS to the micro SD card using the Raspberry Pi Imager and instructions found on the main Raspberry Pi site here. After everything was set up on the SD card, I inserted it into the Raspberry Pi and followed all the prompts to get it all set-up and running. I wont go into all the details on how to set up your Raspberry Pi and connect it to the Wi-Fi as there are plenty of guides out there on this.

The main thing to do at this point is to confirm that the Pi boots and is operational.

Next we will need to make the Pi boot from the USB drive. I purchased a hybrid drive from Seagate. It is the Firecuda Gaming 1TB SSHD. I used this drive because it is a 2.5" drive that only needs 5V to run, and its power consumption is quite low and can be run from the Pi. If you choose a different drive, it may be necessary to use a powered USB hub inside the PS2, which I didn't want to add. The hard drive also has the added bonus of faster speeds as the Pi can access the hard drive over USB 3.0 which is significantly faster than the SD Card. Feel free to skip this part if you do not want/need SSD or HDD storage. One disadvantage is that the hard drive does tie up one USB 3.0 port. I used a USB to SATA adapter from Ebay (link here) to connect the drive to the Pi. I also 3D printed a small "sled" for the drive to sit inside of. STL file attached is for a 2.5" drive.

There is documentation on the Raspberry Pi website about how to get the pi to boot from USB. You need to have the latest bootloader firmware (Sep 3 2020 or later). If your Pi is older, then it might need to be updated first. Detailed instructions can be found on the Raspberry pi site here.I wont get into too many details in this instructable because it is well documented already. Once you have it working, you can remove the SD card.

At this point, it is a good time to test everything so far. You should have the Raspberry pi powered from the 5V buck converter through the USB-C cable and running the OS off of the hard drive. You should also now plug the 2 USB 2.0 cables from the front of the PS2 into the respective USB 2.0 ports on the Raspberry Pi. If you have all of that working properly, give yourself a pat on the back and take yourself out for some ice cream. You deserve it.

Step 9: Finish Up Internal Wiring Connections

Now it's time to finish up all of the internal wiring connections to the Pi. We start with the easy connections. First connect both of the Micro HDMI male (Type D) x HDMI male (Type A) cables to the 2 micro HDMI ports on the pi and route the wires into the expansion bay and out the back. Do the same with the USB 3.0 cables (Only 1 cable if you used one USB 3.0 port for a hard drive) and the short ethernet patch cable. All these cables get routed through the cutout in the frame and out the expansion bay in the back. For now, just leave them hang there.

We also need to connect the rest of the wires to the GPIOs of the pi. The following connections need to be made. From the custom PCB header ribbon cable, the pins are labeled 1 through 5 on the schematic and they connect to the raspberry pi as follows: Pin 1 to Pi pin 11; Pin 2 to Pi pin 40; Pin 3 to Pi pin 13; Pin 4 to Pi pin 5; Pin 5 to Pi pin 7. We also need to connect the data cable from the LED strip. This cable is connected to pin 18 on the Pi. That should take care of all the raspberry pi connections.

Lastly we can reinstall the controller and memory card module that we took out in the beginning. In the picture you can see the module back in place. I forgot to add the screws that hold it in place and had issues later when I tried to put the shell back on with everything lining up in the controller ports. Don't make the same mistake. You can also see some white ribbon cables coming from the controller module and going under the hard drive. These are soldered to the connections of the controller ports and were going to be used with an adapter to be able to use the original PS2 controllers right in the ports on the front of the PS2. I destroyed the adapter that I purchased so I decided to scrap that idea. Just disregard these wires. Maybe some day, I'll get back to finishing the controller functionality.

Step 10: Finish Up Installation: CD Drive and Shell

OK, we're almost there. Now we need to put the CD Rom drive back in. If you made the cut-outs as described earlier, it should fit right back in place. The screw holes line up and there are locking tabs that will snap into place. I found that it was easier to put the back in place first and then lower the front into place. Also, when placing the CD Drive back into place, the ribbon cable out put from the custom PCB that gets attached to the buttons needs to be routed out the right hand side. There is a small cutout for it to fit into that holds it in place nicely. You may remember that the original ribbon cable was routed through here during disassembly.

Next make the connection with the button PCM ribbon cable using the molex connector that we soldered on the end of the ribbon cable that we just routed out from under the CD drive. The ribbon cable will slide right into the connector snugly. You can use the hard blue plastic tab to help push the ribbon in the connector. Once these cables are connected, gently place the PS2 shell cover back in place on the top of the housing.

I should mention that this may be a frustrating time trying to get the PS2 to close up nicely. Make sure that none of the wires are in the way of the screw holes and plastic parts that come together. I found that it is easier to put the lid on from the front first, getting it around the CD drive door and controller ports first and then bringing the back end down and into place. Make sure that everything lines up and fits without pinching any wires or components.

Step 11: Button It Up

Next we need to get everything secured back together. Grab the PS2 so that you are holding both the top and bottom halves together tightly and flip it upside down. Replace the 8 screws that hold the shell together. There are 4 long screws and 4 short screws. Look at the pictures if you are unsure which screws go where. Once you have all 8 screws tightened up, you can install the 8 plastic caps that cover the screw holes. Take a look at the picture to see which ones have the rubber feet. Basically the rubber feet go in the 4 corners of the lower section.

The last thing we need to get together is the I/O panel on the back of the PS2 expansion bay for all of our connections. I designed a panel that can be 3D printed and is available on my Grabcad page here. It is designed to snap right in the expansion bay. It is also designed to accept standard keystone adapters that you can get for standard wall plates. I got keystone adapters for USB, HDMI, and ethernet. They snap in place and lock into the panel. Then the panel can be pushed into the expansion bay slot. In order to make it a little more durable, I drilled holes and secured the panel with 2 screws.

Now all the manual work is done. Connect the HDMI to a monitor, connect a mouse and keyboard to the USB ports at the front of the PS2 and flip the switch on the back. The red light on the power button should light up and the Pi should come on.

At this point you should have a fully functional Raspberry Pi 4 inside of a PS2 case with very little noticeable external indication that it is not a stock PS2. Go get yourself a cookie. You've earned it.

Step 12: Software for PWM Case Fan and Power Button LED

OK, so I am not very good at coding or python and had to borrow a lot of this code from multiple places. I will put all the links below to the different tutorials that I used for inspiration and borrowed code from. I did have to modify the code a bit to fit my use-case and so I have also attached all of the files that are modified so that you can just use these instead of modifying different ones.

I decided to combine the PWM fan control and the LED color of the power button change from red to green as part of the same startup script. I followed the guide by Aerandir14 entitled PWM Regulated Fan Based on CPU Temperature for Raspberry Pi. Here you can follow his steps, but I have modified the scripts a little for the use-case here. Aerandir14's script controls the fan, but I also added control for the LED by turning the LED pin high at startup. This way, the power button LED will be green once the Pi starts up, but will turn red again once the pi shuts down and the script stops running. I also modified the speedSteps value in the code based on the minimum PWM value that I found to work for the PS2 case fan. I found this value by using the calibration method described on his instructable. If you use my file, you may be able to completely skip the calibration step.

I won't go into too much detail on the process because it is well documented on Aerandir14's instructable. However, I am attaching my modified fan_ctrl.py script that you can use in place of his if you want to also control the power button LED. I created a directory and placed the file in /home/pi/scripts. If you are not interested in the LED control, then you can simply follow his instructable and use his fan_ctrl.py script. Also, there are two ways listed on the instructable to run the script at startup. I chose to use Aerandir14's fanctrl.service file and installed it as a service. The file can be downloaded from his instructable and placed in /lib/systemd/system/ directory. Then enable the service by typing:

sudo systemctl enable fanctrl.service

That's it, the fan should startup once the Raspberry Pi is started and will be controlled via PWM based on the CPU temperature. I would suggest reading through Aerandir14's instructable as well as there are some notes on calibrating the fan and how you can adjust min/max fan speeds based on temperature.

Step 13: Adding Power Button Functionality

Next we will install another startup script that will make the power button on the PS2 work with our Pi. However, it isn't good enough that the button be used to just switch on and off the power to the Pi. It is important that we are able to safely shutdown the pi when we press the button. For this step, I used the instructions from a howchoo article that I found here. You can reference this page for detailed instructions on how to make a push button turn your pi on and off. For this step, physical pin 5 (GPIO 3) is connected to the power switch through the custom PCB that we made. Pressing the power button connects this pin to ground, which is how we trigger the shutdown sequence. It also happens that connecting this pin to ground is also how we can wake the Pi when it has been put into a halt state.

In order to get started, you can download the attached script that I have created from the instructions on the howchoo article linked above. If you use my file, place it in the directory /usr/local/bin on the Pi and then we will need to make the file executable by typing the following in a command prompt:

sudo chmod +x /usr/local/bin/listen-for-shutdown.py

Next we need to add another script that will start our service. The script is called listen-for-shutdown.sh, and again I have borrowed this script from the howchoo article linked above. Because it is a .SH file, It cannot be uploaded to Instructables and you will have to create it. Don't worry, its easy. I will list the steps here, but they are also on the article linked above as well.

First, in a terminal window CD to the directory that we will be creating the script:

CD /etc/init.d

Next create the file:

sudo nano listen-for-shutdown.sh

This will open the nano text editor where you can copy/paste the following code:

#! /bin/sh

### BEGIN INIT INFO
# Provides:          listen-for-shutdown.py
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting listen-for-shutdown.py"
    /usr/local/bin/listen-for-shutdown.py &
    ;;
  stop)
    echo "Stopping listen-for-shutdown.py"
    pkill -f /usr/local/bin/listen-for-shutdown.py
    ;;
  *)
    echo "Usage: /etc/init.d/listen-for-shutdown.sh {start|stop}"
    exit 1
    ;;
esac

exit 0<br>

After you have copy/pasted the above code in the nano editor press CTRL+X and then "y" to exit and save the file. When asked for the name just press enter. Now the file is created and needs to be made executable with the following code:

sudo chmod +x /etc/init.d/listen-for-shutdown.sh

Next we will register the script to run on the Raspberry Pi at boot:

sudo update-rc.d listen-for-shutdown.sh defaults

Finally, we can start the service with the following code:

sudo /etc/init.d/listen-for-shutdown.sh start

Now you should have a fully functioning power button that will safely shutdown and wake the pi, as well as a functioning LED that changes to red once the Pi is shutdown and back to green once it is awake.

Step 14: Software for the LED Strip Control

This step is completely optional, but is one of my favorite features of the PiStation2: RGB LED Lighting. In the install, we used a strip of 12 WS2812b RGB LEDs connected to pin 12 (GPIO 18) of the Pi. We will not set it up so that the button presses of the eject button will control the LED strip. I wrote a simple script that listens for a button press, and then cycled through 4 LED colors and finally turns back off. Also while the LED strip is active the LED in the eject button lights up. When you cycle through and get to the off position, the LED in the eject button also turns off.

In order to get the attached code to work, we will first need to install some packages / libraries. You will have to run the 2 commands below in a terminal window:

sudo pip3 install rpi_ws281x adafruit-circuitpython-neopixel
sudo python3 -m pip install --force-reinstall adafruit-blinka

These libraries and more information regarding controlling the LED strips can be found on Adafruit's website.I recommend reading the information at this link and progressing through the 3 pages of details that they have here so that you can understand the code and make changes or create animations if you like.

Once you have these 2 packages installed, you can place the attached eject_button.py file in the /home/pi/scripts folder that we created earlier. once you have it in this folder, then we also need to make it executable with the following command:

sudo chmod +x /home/pi/scripts/eject_button.py

Next we need to create a .service file so that we can run this as a service at startup.In a terminal, you will need to change to the directory where we will create the service file:

cd /lib/systemd/system

Next create the file in this directory:

sudo nano ejectbutton.service

Now we can copy and paste the code below into the nano editor:

import board
import neopixel
import signal
import sys
import RPi.GPIO as GPIO    # Import Raspberry Pi GPIO library
from time import sleep     # Import the sleep function from the time module
GPIO.setwarnings(False)    # Ignore warning for now
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP)    # Set pin 7(GPIO 4) as button
GPIO.setup(27, GPIO.OUT, initial=GPIO.LOW)    # Set pin 13(GPIO 27) to be output for LED
pixels = neopixel.NeoPixel(board.D18, 12)    #Set pin 12 (GPIO 18) as the PWM pin for NeoPixels

#Create a variable for the current button count
BUTTON_CURRENT = 0

#Define a signal handler for <CTRL> + C to exit the code
def signal_handler(sig, frame):
    GPIO.cleanup()
    sys.exit(0)

#Define the button press callback event
def button_pressed_callback(channel):
    print("Button pressed!")
    global BUTTON_CURRENT
    if BUTTON_CURRENT < 4:
        BUTTON_CURRENT = BUTTON_CURRENT + 1
    else:
        BUTTON_CURRENT = 0
    print (BUTTON_CURRENT)

#Determine if the button LED should be lit
    if BUTTON_CURRENT > 0:
        GPIO.output(27, GPIO.HIGH)
    else:
        GPIO.output(27, GPIO.LOW)
#Perform the function of the button selection
    if BUTTON_CURRENT == 1: # Make all LEDs Red
        pixels.fill((255, 0, 0))
    elif BUTTON_CURRENT == 2: # Make all LEDs Green
        pixels.fill((0, 255, 0))
    elif BUTTON_CURRENT == 3: # Make all LEDs Blue
        pixels.fill((0, 0, 255))
    elif BUTTON_CURRENT == 4: # Make all LEDs Purple
        pixels.fill((180, 0, 210))
    else: # Turn all LEDs off
        pixels.fill((0, 0, 0))

#Event to detect the falling edge of the button press
GPIO.add_event_detect(4, GPIO.FALLING, callback=button_pressed_callback, bouncetime=100)

#Signal handler callout for program termination
signal.signal(signal.SIGINT, signal_handler)
signal.pause()

After pasting this into the anno editor, press CTRL+X to exit, choose y to save it, and ENTER to keep the same name.Then enable the service by typing:

sudo systemctl enable ejectbutton.service

Now when the raspberry pi starts up, the default setting for the LED strip is off. For each press of the eject button it will cycle through 3 colors and then back to off. You can play with the code in the eject_button.py script to change the colors, add more steps to the cycle with additional colors, or add animations like scanning or rainbow color. The possibilities are endless.

Step 15: RetroPie, Kodi, and a Startup Menu

For the last bit of software, I wanted to install RetroPie as a retro gaming system. This is, after all, a gaming console modification. I found a really nice guide on Retro Resolution that explains how to install RetroPie and Kodi on top of an existing Raspberry Pi OS, and the nice part is that there is a boot menu that allows you to choose to either boot into emulation station, Kodi, or the Raspberry desktop. This allows you to use your PiStation 2 as a gaming console and a PC.

However, to install RetroPie on top of our Raspberry Pi OS, I followed the instructions directly on the RetroPie website. The instructions start about halfway down the page. Since we already ahve our system up and running, we can skip to the installation of RetroPie and Kodi.

First, from a terminal we need to install git:

sudo apt install git lsb-release

Next, make sure that we are in our home directory:

cd ~

Now we can download the retropie setup script with the following command:

git clone --depth=1 https://github.com/RetroPie/RetroPie-Setup.git

Now we can change to the directory that we just created adn downloaded to:

cd RetroPie-Setup

Next, Make the script executable and then execute it with the following 2 commands:

chmod +x retropie_setup.sh

sudo ./retropie_setup.sh

You will get the main install window and can now select to install RetroPie. You can select the basic installation and once it completes you should reboot your system with the following command:

sudo reboot

If you want to launch emulation station, you need to log out of the Raspberry Pi GUI to the command line and type emulationstation. This will then boot emulationstation. At this point, you have a fully functioning retro arcade. If you have any game roms, you can drop them in the folder that coincides with their system name in the directory /home/pi/RetroPie/roms/. I would suggest that you read up on the documents and information at the RetroPie website section for getting started.

Next, we will install Kodi. If you are not interested, you can skip this part, but I installed it in order to maybe use it some day. We will install it very easily using the RetroPie setup tool that we used earlier to set up RetroPie.

cd /home/pi/RetroPie-Setup
sudo ./retropie_setup.sh

Now when the menu comes up, choose P for manage Packages. Next choose opt for Manage Optional Packages. Then scroll down until you find Kodi (should be number 315). Choose and install Kodi. Now you will have Kodi installed on your Pi and accessible from Emulation Station or from the desktop GUI.

The final think that we have left to do is to install the startup menu so that the Pi will boot directly into our menu allowing us to choose if we want Emulation Station, Desktop, or Kodi. It also has a time-out function that you can set it to default to one option if no choice is made after a chosen time period. In order to accomplish all of this, I followed the tutorial on Retro Resolution. This link is to the 2nd part of the article that is about the menu only. I will not rewrite everything that they have already detailed on that link. If you follow it, you can easily get the same menu installed.

Step 16: Enjoy Your New Multi-purpose Computer

Now that you have everything set up, you can pair a PS4 controller via bluetooth or use a USB controller to play games in EmulationStation, you can connect a keyboard and mouse to use it as a desktop, or you can set up a media library for use in Kodi. Whatever you do, make sure to impress your friends with this "sleeper" PiStation 2 and get ready to wow them when you fire up the LEDs.