Put a Raspberry Pi 3 Model B in a Mini Tower Case

I love my Raspberry Pi 3 both as a Linux desktop machine and as a Commodore Amiga Emulator (especially classic games like “The Secret of Monkey Island”) but I’ve always found it a bit annoying to have it sliding around my desk every time I move a cable. When I saw a Rosewill mini tower case with 2 fans (one sporting blue LEDs) for $20 delivered via Amazon Prime, I decided to put my Pi in it. Read the article or watch the video…

The Challenge

While that might seem simple…just drill some holes and screw it in…it’s a bit more of a challenge if you want all of the case switches (power, reset), lights (power, HDD/SD card activity), fans, and connectors (USB, headset jack) to perform their intended functions. Also, I didn’t want to have a bunch of cables for the monitor and speaker just hanging out of holes in the back. That was the challenge I set for myself. Follow along and find out how it turned out.

The Finished Product

Here’s a look at the finished case both inside and out.
The Pi installed in the case – I still need to do some cable management
The power switch operates as a normal soft power switch. It both wakes up and initiates a normal showdown for the Raspberry Pi. The reset button performs a hard reset. The power light indicates the on/off state of the Raspberry Pi. The HDD light shows SD card activity. The 12V fans, there are two of them, are controlled by a homemade MOSFET controller and are switched on and off by the Raspberry Pi. Audio output is available at both the front headphone jack and a rear 3.5mm jack. The Pi’s USB ports are each connected independently to the case front USB ports. In addition, there’s a third independent USB port on the rear of the case along with an HDMI port. I mounted the rear USB port, HDMI port, and audio jack to a custom rear panel located where the ATX power supply would normally fit.

How To Do It, Step By Step

These instructions are for the Raspberry Pi 3 Model B and Model B+. The “config.txt” file edits shown below won’t work on the Raspberry Pi 2 because it uses different  commands and syntax. However, a Google search should turn up the correct commands to make it work with an earlier version of the Raspberry Pi.

Powering the Raspberry Pi 3 and Fans

The Raspberry Pi requires a 5V 2.5A power supply that connects to the circuit board with a micro-USB connector. That’s what usually ships with the Pi if you buy it as part of a kit. To make sure there was enough power for all 4 USB ports as well as any additional peripherals that I may add in the future, I purchased a 5V 3A wall supply with a micro-USB connector that plugs into the Pi’s power port. The fans require 12V and about 100mA each, including the LEDs. I purchased a 12V 1A wall supply (actually I got 6 of them on Amazon for about $14 delivered) that provides more  power than needed with room for future growth – and I’ve got a bunch of 12V supplies leftover for future projects. I could have skipped the 12V supply by installing 5V fans but since the power supply was much cheaper than replacing the fans I opted to go this route. If you do go with 5V fans you’ll still need to build a fan controller as the Raspberry Pi GPIO pins only output 3.3V and fairly low current. I drilled a few holes inside the case where the motherboard goes and installed a power strip with the cord exiting where the motherboards I/O panel would normally be installed. This makes it convenient to reach the power strip’s on/off switch if I ever want to completely kill power (other than by unplugging it). Both of the wall plugs (5V and 12V) are plugged into this strip.
The power strip and wall plugs

The Soft Power Switch

The case itself is equipped with a soft power switch on the front. Electrically, this is a normally open momentary switch that closes when pressed and then opens again when released. It’s not well known but the Raspberry Pi can be commanded to automatically start up or shutdown when physical pins 5 and 6, which correspond to GPIO 03 and ground, are shorted together.
Here’s where to connect the power switch
You just need to connect the switch between these two pins and edit the “config.txt” file. This file runs automatically when the Pi boots. The file is found in the boot directory and can be edited using the “nano” text editor.
The config file is in the boot directory – edit it by typing the command “sudo nano config.txt” from within the boot directory
Here’s the code to add to the file, including my comments.

The Power LED

Getting the power LED to work is a simple matter of connecting the anode to a GPIO pin, I used GPIO 27 (physical pin 13) and the cathode to a ground pin. I chose the pin directly across the connector (physical pin 14) to make hookup easier.
Here’s where to connect the power LED
Then just edit the “config.txt” file to set the connected GPIO pin as an output and then set it’s state to HIGH. This happens automatically when the Pi boots up. Here’s the code based on the GPIO pin that I used.
There’s no need to set it low since it turns off by itself on shutdown.

The Reset Switch

Getting the reset switch to work is fairly easy as long as you’re comfortable with soldering on your Raspberry Pi board. The Raspberry Pi 3 Model B has the reset lines brought out to a specific set of holes on the board. You just need to solder a 2 pin header (or a few wires) to the board and then connect the front panel reset switch to the header.
Here’s where to solder the header for the reset switch
Just remember, this performs a hard reset which is the same as if you unplugged and replugged in the Pi. Use it only if the Pi is locked up as there’s the same danger of data corruption you’d get from pulling the plug.

The HDD/SD Access Light

Believe it or not, you can tell the Raspberry Pi to redirect it’s own onboard data access light (the one that flashes green when the SD card is being accessed) to a specified GPIO pin by, you guessed it, editing the “config.txt” file. You just need to select a GPIO pin to connect to the HDD LED‘s anode and a ground pin to connect to the cathode. I used GPIO 13 (physical pin 33) and the ground pin directly across from it (physical pin 34).
Here’s where to connect the front panel HDD LED
Here‘s the code for redirecting the SD access light.

Bringing Out the Front USB Ports

To connect the front USB ports I cut the ends off of a few old USB cables I had laying around and spliced them to the cable that would normally connect the front panel USB ports to a motherboard. There are two front ports and each one was wired independently (4 wires: V+, Data In, Data Out, Gnd) within a common 8-wire cable. I connected one USB plug to each 4 wire set. I kept everything nice and neat with heat shrink tubing. These get plugged into two of the Raspberry Pi’s USB ports.
USB port wiring diagram

The Front Headset Jack

The Rosewill tower case included an AC97 audio connector that offered access to both the front panel headset and microphone jacks. I was only concerned with the headset jack and not the microphone jack for this project. I cut the end off of an old 3.5mm male audio jack along with an extra length of cable to wire up the rear female jack and spliced it to the existing case audio cable. This would eventually get plugged in to the Raspberry Pi’s onboard audio connector.
AC97 audio connector pinout

Fan Control

To control the 2 fans, I built a custom controller that switches the required 12V on and off according to the state of a GPIO pin. I built a circuit that takes the 3.3V from the GPIO and switches on the 12V fans using a MOSFET and a couple of resistors. Here’s the schematic.
Circuit to control 12V fans from a GPIO pin
And here’s a picture of the completed board installed in the case.
I selected GPIO 05, which is physical pin 29 as the input for the fan controller and the ground pin directly across from it, physical pin 30.
Here’s where to connect the custom fan controller
To turn the fans on and off I used the same code as for the power LED just substituting the appropriate GPIO number. Here’s the code from the “config.txt“ file.
The fans, and the associated blue LED, turn on when the Raspberry Pi boots and shut off when it powers down.

The Rear Panel Connectors

I measured and cut a piece of 1/8 inch plastic sheet to fit in the opening where the ATX power supply would normally mount. This particular computer case has the power supply at the top which suited my needs perfectly. I ordered a combination USB and HDMI female connector from Amazon for about $12 that looked like it would be easy to mount and provide a neat, professional appearance. I also ordered a female 3.5mm audio jack that I could panel mount. I drilled a 1 inch hole for the USB/HDMI connector and a 1/4 inch hole for the audio jack. I also drilled mounting holes to bolt the panel into the case opening.
The rear panel with USB, HDMI & audio connectors

Putting it All Together

Finally, I drilled holes to mount both the Raspberry Pi and the fan controller, installed the standoffs that came with the case, and mounted the two circuit boards. Then I hooked up all of the connections, installed a wireless keyboard/mouse dongle in the remaining USB port on the Pi, hooked up an HDMI monitor, and powered it up. It works like a charm and now occupies a space under my desk next to my window’s machine. It even shares screen real estate with my PC via a second HDMI input on my main monitor. The whole project, minus the Raspberry Pi, cost about $50 including tax and shipping (thanks to my Amazon Prime membership) and only took a few evenings to complete. I hope you enjoyed this installment and will install your own Raspberry Pi in a mini tower case. Please like, share, and subscribe so you don’t miss any new content. And until next time… Cheers Dominick
Please follow and like us: