So after publishing my blog post on my RetroPie handheld I thought I would do a build guild and a more detailed parts list
- ili9341 2.4″ screen with 18 pin ribbon cable x1
- SMD soft touch button x 12
- Peizo SMD speaker x 1
- Raspberry pi female header
- 18 mm M3 nylon standoffs x4
- M3 nylon bolts 10mm x8
- Power bank board
- Micro USB Female port SMD x1
- Push button x1
- 2000 mAh battery 103450 50x34x10mm x1
- Long male headers 2.54 pitch 20mm length x4
- 3 pin on/off switch x1
- 10ohm resistor 1206
- JST 2.0 female socket and male lead x1
- 10mm 3M foam tape
Once you have all your parts you will need to order your PCB’s. I went with JLCPCB because they are cheap and relatively fast (10 days from ordering to my door (UK)). You will need to download the 2 zip files from this github link HERE. You need to make an account on JLCPCB then upload your Gerber files. I designed them to be within 100mm x 100mm to be as cheap as possible
These are the tools you will need for this build
- Soldering iron
- Screw driver
First things first you need to solder on the screen. You need to line up the screen pin numbers with the PCB silkscreen numbers like below
Tin the PCB screen pads and also the screen ribbon cable its self. Next line up the pins with the ribbon but only cover half of the pin length with the ribbon cable, We do this so we can test the screen once its soldered.
Now genitally drag the soldering iron starting on the ribbon cable towards the PCB, Do this all the way along the ribbon cable. Next we need to test the pins, To do this put your multimeter into continuity mode. Start at pin 1 with one lead on the ribbon and the other on the PCB pads, If you get a beep move the PCB lead from pin 1 to pin 2 but leave the other lead on pin 1. This will check to see if we have any shorts between the 2 pins, Carry on down the ribbon cable but don’t forget that the LED pins are all joined and the 2 VCC pins are joined too as shown on the silkscreen.
If you are not getting any shorts you can stick the screen down with some tape. But if you are getting shorts I find that if you go over the ribbon again with the soldering iron starting on the ribbon pushing the solder towards the PCB, This might not work but if it doesn’t you will need to remove the screen and start again. I found the easies way is to use a hot air station set to 250C and the weight of the PCB will help pull it off.
Female header and the screen resistor
So you have your screen soldered down without any shorts between the pins you can temporarily stick the screen down to the PCB with some tape. You can get SMD 20×2 raspberry pi female headers but they are hard to find and expensive, I’m going to show you how to make your own. First you will need a standard through hole 20×2 female header. Start by bending the pins over 90 degrees with a pair of pliers, Once you have done that you can use long nose pliers and straighten them out flat.
Once you are happy they are flat enough line it up with the footprint, Solder down one pin then check to see if its still lined up and if your happy solder down another pin on the other end of the header.
Double check that its still lines up then solder down the rest of the pins. Next we need to solder down the resistor. I used a 1206 sized footprint but you can just bend over the leads on a through hole resistor and solder that down. If you are using a 1206 SMD resistor, add some solder to one of the pins then using tweezers hold down the resistor and apply the soldering iron to melt the solder. add solder to the other side of the resistor. Now we are ready to test out the screen with the raspberry pi.
Download the latest retropie image from HERE make sure you download the one for raspberry pi zero/1. I find it easier if you SSH into execute the commands.
The pins I’m using for the screen are
- Reset – BCM 27
- DC – BCM 25
- LED – GND with 10ohm resistor
- CS – BCM 08
- SCK – BCM 11
- MOSI – BCM 10
Before we get started we need to go into raspi-config and turn on SPI. To do this run
Then go down to option 5 “Interfacing Options”.
Then select P4 “SPI” and enable it.
After that just exit by selecting finished at the bottom.
First you will need to open the file below in your favorite text editor
Then add the text below to the file then save and close
Next open up file below
Add the text below to the file then save and exit
options fbtft_device name=fb_ili9341 gpios=reset:27,dc:25 speed=60000000 bgr=1 rotate=90 custom=1 fps=60
Once that’s all done, reboot. You should see the screen will reset and go black. This will let you know that you have the screen wired up correctly.
Now all we need to do is install the software that will mirror the HDMI output to the SPI screen. Use the commands below. The are taken from HERE
sudo apt-get install cmake git clone https://github.com/tasanakorn/rpi-fbcp cd rpi-fbcp/ mkdir build cd build/ cmake .. make sudo install fbcp /usr/local/bin/fbcp
Once that’s installed you will want it to start at boot up.
Open up the file below
Then you will need to add the text below, You will need to paste it before “exit 0” or it wont work
That’s it, Reboot and should see the config controller screen. Now would be a good time to stick down the screen with double sided foam tape
Front Buttons, speaker and female header
So after you have the screen sorted and the software installed, we can start soldering the front buttons and speaker. These buttons are SMD buttons so lets start with tinning just one side of the each button pads. Hold the button with tweezers over the tinned pad and apply heat with the soldering iron until it melts the solder and the button is soldered down on the one side. If you are happy with the position you can apply solder to the other pad for the button. You need to repeat this for all the other buttons.
Because of an error in my board design you can only use the right hand speaker. So to solder the speaker the same method can be used, Tin one side then hold the speaker in place over the pad apply heat until it melts and soldered in place. Again if you are happy with the placement solder the other pad.
Last thing to do is solder the 4×1 female header on the back of the front board. solder one pin of the header then check to see if its at a right angle to the board if not just apply some heat to the pin and adjust it.
Micro usb charge port
So with the front board done we can move onto the back board. First thing to do is to solder the micro usb charge port on. This is best done with a hot air station but can be done with a normal iron.
To do it with a hot air station first tin the pads but don’t get any solder in the anchor holes, Use a solder sucker to remove it if this happens.
I set my hot air station to 250c and fan speed on full, Hold the micro usb port with tweezers over the pads and apply heat with the hot air station until you feel the port seat down onto the board. Wait till it cools then you will need to test the port is soldered correctly. Connect a micro usb cable next set your multimeter to volt mode and connect to leads to the bottom 2 pads on the powerbank footprint like shown below. You should see 5 volts, If you do then you should solder the anchor pins to the board. If not you will need to ether take the micro usb port off and re tin the pads or just reheat it with the hot air station to re-flow the solder and re-test.
If you haven’t got a hot air station then you can still solder the micro USB port but its going to be harder. Start with tinning the micro USB port pads but only to the 5 small pads not the 2 big pads. hold the port with tweezers then apply heat with a soldering iron to the most outer pads of the 5 you just tinned, Now onto testing the connection. Connect a micro USB cable next set your multimeter to volt mode and connect to leads to the bottom 2 pads on the powerbank footprint like shown below. You should see 5 volts, If you do then you should solder the anchor pins to the board. If not you will need to ether take the micro USB port off and re tin the pads or just reheat the 2 pins again.
Power bank board
You will need 2 pins to align this board but before getting them you will need to fill the holes of the power bank board on the underside with solder just leaving 2 free for the pins to go into. Put the board into place and insert the 2 pins to keep it aligned while we solder it, Just apply heat to the top of each pin hole that you applied solder to and wait a second before moving onto the next one. Once they are all done you can remove the pins and fill these holes with solder. Next put your multimeter into continuity mode and put one of the leads on the back of the board then the other on the front of the power bank board. You should get a beep but if you don’t just reapply heat to that pin and recheck.
JST battery connector
So this was a bit of a mistake while designing the board. I didn’t realize that the JST connector with the connector attached wouldn’t fit. Luckily I found that if you bend the pins over 90 degrees it fits like below. It should be facing toward the button of the board when soldered in place
Buttons and switch
With the power bank board were using it has a pin so you can connect a button that when pressed will let you check the battery level without having to turn on the RetroZero, To install this button you can do one of two things. Option one is to solder the button in then clip the leads afterwards, This doesn’t look as clean but its the easies option. Option two is the pre cut the button leads then solders it in place, This looks much cleaner but its tricky to get the button leads short enough but not too short. The same can be done with the switch.
So thats it all there is to do is solder the long male headers. As before just solder one pin then check to see if its square to the board, If it is then solder the rest if it isn’t apply heat to the pin and adjust until it is.
We need to stick the battery down and connect it up. Also we need to install the screws and female standoffs. Give it a quick charge and your ready to play