Introduction: Portable Gaming Laptop Using Raspberry Pi
Hello Guys , In this instructable , we will learn to build a Portable Gaming Laptop using Raspberry Pi .When I say gaming Laptop I don’t mean the High End Laptop which are sold in the market . You won’t be able to play windows games on this laptop anyway. But you would be able to play all Retro Games . So you guessed it right I will be using Retropie image for this project.Before you start reading this instructable I suggest you to watch the youtube video I made for this project.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Parts and Software Needed for This Project
So for building this project you will Portable TV / DVD player which you may find lying down in your house or you could borrow from your generous friend .Then you will need raspberry pi ,obviously , any raspberry pi will do , but I will be using raspberry pi zero w . Now if you will be using raspberry zero like me you will also need to make an additional circuit board for audio since it doesn’t have the audio jack like the raspberry pi 3.
For the audio board you will require these components:
- Two 270 ohms resistor
- Two 150 ohms resistor
- Two 33 nF ceramic capacitor
- Two 10 uF electrolytic capacitor
Apart from these you will also need some male and female header pins. Some wires and a prototyping PCB.
You will also need to download the retropie image from here : https://retropie.org.uk/
To load the image on the SD-CARD you will need Win32 Disk Imager or even Etcher will do the job.
Download Win32 Disk Imager from here : https://sourceforge.net/projects/win32diskimager/
and Etcher from here : https://etcher.io/
Step 2: Hacking the Portable TV / DVD Player
This is step is not needed if your portable DVD player has AV video input , then your life is a bit easier and you can skip this step.
This part can be difficult for some people but, you are sure to find a way if you try . You have to find a wire / path through which the processor transmits the video signal to the display IC. The processor is often the largest chip that you can find and has more number of pins. Some portable DVD player have separate circuit board for the display (like mine). Then you just need to hack the cable connecting the main board to the display board. In my case the pinout of the connector cable was printed on the circuit board . But if it isn’t in your case then you can just Google the pinout for the Display IC.
As you can see in the picture above the pinouts of my connector cable are given on the display board. I found three pins interesting and they are TV/AV , TV , Y (see in the pictures above) . The TV/AV is used to change the mode between TV and DVD mode. The TV is the TV video input and Y is the DVD video input. In my case I choose the TV input since it gave better quality display. So I just cut the TV wire and replaced it with raspberry pi‘s output.
If you successfully completed this step then congratulation since this was the most difficult step and the subsequent steps are very easy.
Step 3: Making the Sound Filter
For this I referred to adafruit website : https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/overview/
This step is needed only if you use raspberry pi zero since the raspberry pi zero doesn't have a inbuilt audio filter.
The circuit uses both gpio 13 and gpio 18 for stereo output. but I have only used gpio 18 , Since I don’t mind a mono audio output. I connected the output of this filter to the on board audio amplifier of my Portable DVD player . Please note you need a audio amplifier if you can’t use the onboard amplifier then you will need to make an audio amplifier. You can’t connect the output of the audio filter directly to the speaker.
Step 4: Setting Up the Software Needed for This Project
Now its time to test to see if our audio is working , But before that we need to flash the Retropie image to the sdcard card , You can download this image from the Retropie official website from here ( https://retropie.org.uk/ ) For flashing I used Win32 Disk Imager but you can also use Etcher to do the job.
You need to open Win32 Disk Imager in administrator mode , select the Retropie image file . Choose your SD-CARD drive letter from the drop down box and then click on the write button.
Now you need to connect your raspberry pi zero to your network and enable SSH on it . This way to do it heedlessly without a monitor , just follow this steps. You need to create two files wpa_supplicant.conf and ssh in the boot directrory of the memory card .Or just download them from below . You will need to modify wpa_supplicant.conf by entering your country code , wifi name and password. Then copy these two files to the boot directory . Then put your SD-card into your raspberry pi and it should automatically connect to your wifi network .
Then find your raspberry pi IP address , I use Advanced IP Scanner ( https://www.advanced-ip-scanner.com/ ) for this purpose.
Its time to SSH into the raspberry pi. For Windows Users I recommend a software called Putty ( https://www.putty.org/ ) . For Linux Users you can use the terminal by typing this command
For example , If my Raspberry pi's IP address is 192.168.8.102 then I will have to use this command ssh firstname.lastname@example.org
The default login user is pi and the default password is raspberry .
Step 5: Configuring the Audio for Rapberry Pi Zero
To save you from all this software hassle I created a image of my pre-configured SD-CARD .Just download ( https://drive.google.com/file/d/1uBkISlCsInqCkeoxKhDdvfD1C9_mzKkE/view?usp=sharing/ ) and flash the image in your SD-CARD ,then you may skip this step and the next step of this instructable. But if you want to learn something then I encourage you to read this step.
For this step I am entirely referring to this adafruit tutorial ( https://learn.adafruit.com/adding-basic-audio-oup... ) .
So the idea here is that the original raspberry pi one and the raspberry pi zero uses a similar processor , But the original raspberry pi had the audio output , so since they have a similar processor then raspberry pi zero must have an audio output but the problem being we don’t have pins PWM0 (pin #40) and PWM1 (pin #45) [ This are the pins which are used for audio on the Raspberry Pi One ] exposed for raspberry pi zero , but there is a way to re-route those signals to GPIO 18 and GPIO 13 on the raspberry pi zero.
Once we are connected using SSH, Type the following commands
sudo apt-get update
sudo apt-get install raspi-gpio wiringpi
then type gpio readall
If this doesn’t work , you need to build raspi-gpio yourself please refer to the next step .
gpio readall command will give you the pin mode and state for every pin . The pins we are interested are GPIO 13 and GPIO 18 .The default mode will be set to IN we need to set this mode to ALT0 and ALT5 .
For this we need a software called gpio_alt . To save your time I have already compiled it for you . Just download the zip file extract it and copy it to raspberry pi home folder. ( In the pictures above I have shown how to compile this gpio_alt.c using gcc -o gpio_alt gpio_alt.c )
Then type this commands :
sudo chown root:root gpio_alt
sudo chmod u+s gpio_alt
sudo mv gpio_alt /usr/local/bin/
gpio_alt -p 13 -f 0
gpio_alt -p 18 -f 5
Now type gpio readall ,and you will find that GPIO 13 and GPIO 18 pin mode is changed to ALT0 and ALT5.
then type sudo raspi-config
go to advanced options .then go to audio and select Force 3.5mm (‘Headphone’) jack option.
Type alsamixer and increase the volume by pressing the arrow up key .Then you can hot Esc to save and quit
Now to automate this process every time raspberry pi boots up
Type sudo nano /root/pwmaudio.sh
Copy this into it:
/usr/local/bin/gpio_alt -p 13 -f 0
/usr/local/bin/gpio_alt -p 18 -f 5
Press ctrl+o to save and then ctrl+x to exit.
run sudo chmod +x /root/pwmaudio.sh and then create another script with sudo nano /lib/systemd/system/pwmaudio.service
and stick this in it
Description=PWM Audio Service
Save the file by typing ctrl+o . Once This is done start this service by typing this command.
sudo systemctl enable pwmaudio.service
sudo systemctl start pwmaudio.service
then do sudo reboot and we are done configuring the software.
Step 6: If Gpio Readall Command Dosen't Work
There is a possibility that gpio readall command might not work for some people so in this step we will be building the gpio package ourselves .
First we need to download the latest snapshot from the wiringPi Git repo : ( https://git.drogon.net/?p=wiringPi;a=summary ). The version I have is wiringPi-8d188fa.tar.gz .
We need to copy this file to our raspberry pi .I use this convenient method ,First open your file explorer ,Then in the address column type : \\ip_address ,where ip_address refers to the IP address of your raspberry pi .Just copy the wiringPi-8d188fa.tar.gz file into the BIOS folder.
Then SSH into raspberry pi and type:
With this you will able to see wiringPi-8d188fa.tar.gz file.
mv ./RetroPie/BIOS/wiringPi-8d188fa.tar.gz ./
Extract the file with these commands:
tar -xvf wiringPi-8d188fa.tar
Then go into thewiringPi-8d188fa directory and install the software:
and type gpio readall ,and it is going to work.
Step 7: Loading Game Into This Laptop
Now to load a game into this laptop open file explorer , Click on the address column ,and type \\ followed by the IP address of raspberry pi .
for example if my IP address is 192.168.8.102 ,Then I have to type \\192.168.8.102 in the address column
,then open ROM folder and then copy paste your game here since the game I have is of the type snes I copied it to the snes folder.
Step 8: Conclusion and Further Ideas for This Project
Finally I connected this usb keyboard to the rasberry pi and after doing the keyboard configuration I rebooted the raspberry pi. It turned to be a good project, after watching my little brother play with it .
I had many ideas when doing this project most of which I could not implement since the backlight inverter of the Portable DVD player stopped working.
One idea was to use the existing buttons of the portable DVD player instead of a keyboard. For the second idea I had an Infra-Red gaming joystick , which I wanted to link with Retropie. I used the existing IR receiver of the Portable DVD player and I was able to get keyboard presses from the controller using LIRC (Linux Infrared Remote Control) ( http://www.lirc.org/ ) software and little more modification could allow me to use this IR joystick with Retropie.
I will definitely make a video and an instructable of this once I get the new backlight inverter , so please don't forget to subscribe my youTube channel Jovi Tech.
Participated in the
Game Life Contest