Turn a $35 Raspberry Pi into a laptop computer with a PiTFT display and miniature keyboard
The Raspberry Pi’s size and relative power enables it to be both a useful desktop computer, and one that you can slip in your pocket (if you really wanted to)
Picking up your Pi when you head out of the door is one thing; hooking it up to a monitor and keyboard and such is quite another. What if you could pick up your Pi and this was all attached? That would be a Pi laptop.
Here’s how to install Raspbian on the Raspberry Pi. A Raspberry Pi and basic peripherals (a mouse, keyboard, screen, and power source). This isn’t the only method for installing Raspbian (more on that in a moment), but it’s a useful technique to learn because it can also be used to install so many other operating systems on the. Matchbox Keyboard - Raspberry Pi Touchscreen Keyboard Written by ModMyPi LTD in Tutorials on Sep 03, 2015. So you’ve got a shiny new touchscreen for your raspberry pi but are a little miffed that you still need to plug a keyboard in to be able to type. How to install Raspbian on a Raspberry Pi (lite or desktop). Then start the Raspberry Pi, with a screen and a keyboard. Desktop version. When you start on the desktop version for the first time, there is nothing to do The system automatically logs in and introduces you to a welcome wizard. Install the Software. Before going any further, get your operating system ready to go. Raspbian can’t talk to the PiTFT by default, so connect a screen, keyboard and mouse, prep your microSD card with the latest version of Raspbian, and use the Terminal commands listed at magpi.cc/XaeUem to install the necessary software to drive the screen.
There are many ways you can create a Raspberry Pi laptop, such as custom builds, hardware recycling, and even just buying a laptop based on a Pi. Let’s get portable.
Make your own Raspberry Pi laptop
One of the first things people often remark on when seeing a Raspberry Pi is its size, and that goes double for the Pi Zero. Yet, despite their diminutive form factor, Pi boards can be surprisingly complex to convert into a usable laptop, mainly due to their rugged construction and connectors. Here, we’ll overcome some of the obstacles with a bit of clever design and create a useful, portable handheld computer.
You’ll need
- 2000 mAh 3.7 V
- 3D printer (or use a service)
- SPDT switch
- Screws (4-40 and 2-56) and wires
3D print the laptop case
This build is based on an Adafruit project, which provides 3D print files for the enclosure that are downloadable from here. Thingiverse can print them for you, but if you have a 3D printer to hand, you’re set. Expect about an eight-hour print time for all the parts.
Don’t worry about assembling the case just yet, but test everything out. Make sure the hinges fit ‘Lego-style’ to the case and slot together comfortably.
Prepare the PiTFT
The PiTFT features a breakout of many of the Raspberry Pi’s GPIO pins. We can use this to provide power to the Pi. Bend all the breakout pins on the edge of the PiTFT as flat as you can, or snip them off, but not right to the base. Either connect jumpers, or solder wires, to pins 2 (5 V) and 6 (GND). Leave plenty of length.
All the parts for our laptop
Mount the battery
Wrap the battery in some duct tape to keep it safe, then lay it along the Pi, wires away from the USB and Ethernet ports. Now attach the PiTFT to the GPIO header of the Pi. You should end up with a battery ‘sandwich’ with the battery’s wires free of the assembly. Be careful that the battery is safely insulated from the Pi’s components.
Thread the wires and mount the speaker
Install On Screen Keyboard Raspberry Pink
Before you insert the assembly into the printed case, run two wires (one for positive, one negative) between the Pi and the PiTFT. Don’t worry about length: too much is a good idea at this stage. The speaker may need its wires extending to reach the amplifier at the other end of the casing. Once you’re happy, snap the speaker (carefully!) into the mount on the case and screw the PiTFT and Raspberry Pi to the four pillars around the screen aperture.
Hook up the sound
Using the pair of the wires you threaded through the Pi ‘sandwich’, solder them to the ‘Vin’ (positive) and ‘Gnd’ (negative) points on the amplifier. At the other end, following the circuit diagram (Figure 1), solder the same pair to the ground and 5 V lines on the PowerBoost, shortening as required.
Figure 1 There’s no complicated circuitry to assemble here, just power lines between the various components
Next, connect the speaker’s wires to the amplifier’s output. You may need to extend them to fit. Finally, and very carefully, solder two wires from the A+ and A- lines on the amplifier to the Raspberry Pi board, as shown in Figure 1.
Attach the Power
The PowerBoost will deliver power to the whole system from the battery and also manage recharging. We’re powering the Pi through the PiTFT, so using the wires we soldered on to it earlier, connect them to the PowerBoost as shown in Figure 1, having shortened the wires to fit.
Solder two further wires to EN and GND on the PowerBoost. These need to connect to the SPDT switch. Thread the wires through the opening for the switch, solder one to the centre pin and another to one of the sides.
Power to the Raspberry Pi is provided though the PiTFT screen. Either bend the pins back or snip them. Then solder wires to 5 V and GND
Install the Software
Before going any further, get your operating system ready to go. Raspbian can’t talk to the PiTFT by default, so connect a screen, keyboard and mouse, prep your microSD card with the latest version of Raspbian, and use the Terminal commands listed at magpi.cc/XaeUem to install the necessary software to drive the screen. You need to set the screen to rotate 270° and to mirror the HDMI output. Once rebooted, your PiTFT will come to life.
Main body assembly
Carefully secure the amplifier with 4-40 machine screws. Lay the case back alongside the main body and screw in the PowerBoost. Attach the battery (and then switch off if everything comes to life). Insert a USB WiFi adapter (if required) and the USB receiver for the keyboard. Tuck all the wires away carefully, looking out for shorts. Push the switch into the clips provided. Now place the back cover over the main body and secure with 2-56 machine screws.
Final assembly
It’s time to finish everything off. Snap the keyboard into the printed mount. Having checked everything fits and double-checked orientation, glue the hinges to the body and keyboard mount, then allow to dry. Push the hinges together, then secure each with long machine screws.
Check all the ports line up. Turn on the keyboard, flick the power switch, and after a few seconds the screen should come to life. Congratulations, you have a handheld, rechargeable Raspberry Pi.
The Pi, battery, and screen are in place. Make sure the remaining components are connected as the circuit diagram (Figure 1) shows, then secure them to the case
Using your laptop Pi
Although the screen is great for gaming, we wouldn’t recommend writing your next great novel on it. That said, the density of the screen makes it comfortable for a bit of web browsing or using the Terminal. The bonus of audio makes for a cool little radio too.
You can power the system using the usual connector on the Pi, but this will not charge the battery. Instead, connect to the micro USB port at the base on the main unit. Don’t forget, you’ll need to keep the keyboard topped up too.
If you find the Raspberry Pi does not appear to be shutting down correctly, don’t worry. The screen does not refresh correctly on shutdown so appears to freeze. Just wait a few seconds, then switch off.
This question is the basic one that everyone will ask when he wants to reinstall a Raspberry Pi.
This post will also serve as a reference for my other articles, to avoid explaining each time how to install Raspbian
How to install Raspbian on a Raspberry Pi?
Follow these steps:
- Download the image on the official website
- Flash your SD card using Etcher
- Insert the SD card into your Raspberry Pi
- Start your Raspberry Pi
- Perform basic configuration (network, language, ssh)
I will introduce what is Raspbian, and explain in detail each step, whether for the Lite version or the desktop version
If you already master some parts, do not hesitate to use the table of content below
Raspbian introduction
If you are new to Raspberry Pi, I’ll start with a small introduction to Raspbian
Presentation
Raspbian is a Linux distribution based on Debian
It’s the official distribution for Raspberry Pi
Raspbian is following the Debian versions names, so the last available version is Raspbian Buster (Debian 10)
Raspbian is optimized for Raspberry Pi and most of the time you can use this distribution for your projects
Versions
Raspbian is offered in three “versions”:
- Full: Raspbian with desktop and recommended software
- Desktop: Raspbian with desktop
- Lite: Minimal image for Raspbian
As its name suggests, the two firsts offer a graphical environment (LXDE), while the last comes basically without (but it will still be possible to add it later)
If you are new to Linux, I advise you to start with the desktop or full version, so that you can familiarize yourself with the commands
Throughout this article, I will explain how to do for these two main versions of Raspbian
The installation of the Full or Desktop version is absolutely the same process, I will call it “Desktop” only but it’s for both
Whatever your choice, you will know how to do all the steps described
NOOBS
The Raspberry Pi Foundation is pushing a version called “NOOBS” to help beginners to install Raspbian
You can choose this if you want, and refer to the explanations concerning the Desktop version, it will be similar
The installation of Raspbian is relatively simple by following this article, and I don’t think that going through NOOBS is essential nor helpful
Prerequisites
In order to follow this article you will need:
- An Internet connection
- A computer to download and flash Raspbian
- An SD card reader (USB or built-in computer)
If you don’t have one on your computer, you can find a good choice in my recommended products page - A minimum 8 GB SD card (see my recommendations)
- Micro-SD / SD adapter (often provided with the SD card)
- A complete Pi raspberry (with screen and keyboard to install it in the best possible conditions)
Download the Raspbian image
Download
Whatever your choice of version, the download is done on the same page
Go to this page of the official website to download Raspbian
Click on the “Download ZIP” button to get the file
If the direct download is too slow, you should try with the Download Torrent button
Then open the .torrent file in your favorite Torrent client
Extract
Now you need to extract the image from the ZIP file
If you use my recommended software to flash the SD card in the next step, you don’t need to unzip the file,
- Go to your Downloads folder
- Right-click on the ZIP file
- Choose “Uncompress” or “Extract here” depending on your operating system and software
- You should see a .img file in the destination folder
Create your SD card
Etcher
To create my SD cards, I always use Etcher
It is free software, available for all OS
If it does not suit you, there are plenty of others, but Etcher doesexactlywhat you need
Download Etcher
Start by downloading Etcher:
- Go to the website
- Download the installation file (the version corresponding to your OS is proposed automatically)
- Install Etcher like any other software
- Windows: double-click on the .exe file and follow the wizard
- Linux: extract the zip file and run the Appimage file
- MacOS: double-click on the .img file and install it to /Applications
Then the app should be available in your “Applications” menu
Start Etcher
Flash it
The Etcher interface is simple to use.
It is presented in 3 steps:
- Image selection
- SD Card choice
- Flash!
So you have to follow these three steps to create your SD card:
- Browse the files to find the location of the downloaded image just before
- Select the SD Card to use (mostly the default one)
- Click on Flash
After a few minutes, our SD card is ready
If your operating system opens you empty drives or format questions, you must ignore everything.
Etcher will do everything. You have nothing else to do
First boot
Insert the SD card
Get your SD card and insert it into your Raspberry Pi
Then start the Raspberry Pi, with a screen and a keyboard
Desktop version
When you start on the desktop version for the first time, there is nothing to do
The system automatically logs in and introduces you to a welcome wizard
Follow the wizard to configure the basic options:
- Select your country
- Change the password
- Connect to the Wi-Fi network if needed
- Start system updates
Wait for the update to finish and restart the Raspberry Pi
Lite version
On the Lite version, you have nothing to do at first boot
The system will start alone until the login screen
Log on with the default access:
- Login: pi
- Password: raspberry
The keyboard is in QWERTY (en-us) by default
If you have a keyboard with another layout, you have to reverse the letters (rqspberry in AZERTY for example)
We will see later how to adjust this
Raspbian configuration
Keyboard layout
The first thing you need to do is to choose the right layout for your keyboard (if not already set)
Desktop version
Generally if you used the Welcome Wizard, your keyboard must already be configured appropriately
However, if you need to change it. You can do it in:
- Main menu
- Preferences
- Raspberry Pi Configuration
- Localisation tab
- Set keyboard…
The change should apply immediately, restart your apps if needed
Lite version
On the lite version, use the raspi-config tool:
- Start the raspi-config tool
sudo raspi-config
- Go to Localisation Options
- Then Keyboard Layout
- Select the model of your keyboard (leave default if not found)
- Then select the layout of your keyboard (or other to have the choice of other countries, and then the specific layout of your country)
- After that, you will have other options for special keys (alt gr, compose key, etc…).
It’s not the most important because with a Raspbian Lite you will use SSH most of the time (from another computer well configured)
You can keep default values if you are not sure
After saving your changes, verify that your keyboard is typing what you want and continue
Raspi-config is a great tool you can use from your Raspberry Pi directly, but also when connected by SSH
It allows you to configure many system options with a simple interface
Change password
All Raspberry Pi are installed with the password given above
It is therefore essential to change it to keep your device safe
Desktop version
Also, the welcome wizard has already allowed you to do it
If you need to change it again, you can do it this way
- Go to the main menu
- Go to Preferences
- Launch Raspberry Pi Configuration
- In the System tab, click on “Change Password“
Lite version
On the lite version, you can follow these steps:
- Enter the password command :
passwd
- Type the old password (raspberry)
- Enter a new password
- Confirm the same new password
It’s ok. You should get something like that
Network configuration
If you can connect your Raspberry Pi to a network cable with DHCP, the setting will be instantaneous, and you have nothing else to do
In other cases, let’s see what you need to do
Desktop version
Ethernet
If you need to change your IP address, you can right-click on the network icon in the top bar
Then choose “Wireless & Wired Network Settings”
On the new window select your interface (eth0 or wlan0) and fill the form with your network settings
It should be something like this
WiFi
If you don’t have already chosen your WiFi SSID in the welcome wizard, you can connect to it by clicking on the network icon in the top bar
A list of all detected SSID will display, select yours and enter your password
If you need to set a static IP address, you can do it the same way as for the ethernet
Choose wlan0 in the Network Preferences window
Lite version
Ethernet
I will give you two methods
The first one is the one recommended, but in my case, it didn’t work
The second is the one which finally allowed me to have a static IP
The official way to set a static IP:
If you need (or want) to set a static IP address on your network, follow these steps:
- Edit this configuration file
sudo nano /etc/dhcpcd.conf
- Add these lines at the end of the file (don’t forget to replace this with your network settings)
interface eth0 static
ip_address=192.168.1.200/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 - Save the file and exit (CTRL+O, Enter, CTRL+X)
- Reboot the Raspberry Pi for changes to take effect
sudo reboot
After the reboot, your IP should be fixed. Check it with the command ifconfig
Another way to do the same thing:
Follow these steps:
- Uninstall dhcpcd
sudo apt-get remove dhcpcd5
- Edit the /etc/network/interfaces file
sudo nano /etc/network/interfaces
- Paste these lines into
auto eth0
iface eth0 inet static
address 192.168.1.200
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
Don’t forget to edit the values with your network settings (gateway is the router IP, and you can keep these IPs as DNS servers) - Save the file and exit (CTRL+O, Enter, CTRL+X)
- Reboot the Raspberry Pi
sudo reboot
You should get something like this
WiFi
To enable the WiFi in lite mode, you should first set your WiFi country
For this, use the raspi-config tool
- Go to Localisation Options > Change Wi-Fi Country
- Select your Country in the list
- Exit
Once you set the country, you can start raspi-config again to set up your Wifi connection:
- Go to Network Options
- Choose Wi-Fi
- Enter your network SSID
- Enter your passphrase
- Finish
Enable SSH
SSH is a protocol that will allow you to connect to your Raspberry Pi from another computer to be able to launch commands and scripts
Desktop version
Start once
To start SSH server follow these steps:
- Open the Main menu
- Start Preferences > Raspberry Pi Configuration
- In the Interface tab, enable SSH
Auto start
On the Desktop version, SSH server will auto start at each boot until you disable it in this window
Lite version
Start once
On the lite version, you can start the SSH server with this command:
Auto start
Unfortunately, this command starts the service only once, and at the next reboot it will not start automatically
If you want to start it automatically you have to use these commands:
Connection
Once the SSH server is enabled, you can connect from any computer on the local network
You can even open a port in your firewall/box to access it from the Internet
If you don’t know how to use SSH, you will find the information in the first paragraph of this article
Install new packages
The base of your Raspbian system is now in place
You must then install all the software you need
The most basic software are available in Raspbian repositories, let’s see how to do it in both environments
Desktop version
With the Desktop version, a graphical tool allows you to manage packages:
- Open the main menu
- Go to Preferences
- Click on Add / Remove Software
A window opens
This tool allows you to view all packages available for Raspbian, sorted by category
A search engine is also available
Install On Screen Keyboard Raspberry Picture
To install a new package, simply check the corresponding box
Then confirm by clicking OK on the bottom right
When a package is selected, a short description appears in the bottom frame
To remove a package, uncheck the box corresponding to the package you want to uninstall
Lite version
In the Lite version, there is no interface, so you will have to learn some commands
The apt-get and apt-cache commands allow you to manage package installation
Find the exact name of a package:
Here is an example:
There is a lot of optional parameters you can use, for example -n will search only in package names (so no adminer in the results)
Install a package:
Once you get the good name for the package you want to install, use apt-get to install it:
Here is an example:
Hit enter to install the package and its dependencies
Delete a package:
If you want to uninstall a package, use this command:
Here is an example:
As you can see, apt-get will remove the package you ask, but not its dependencies
If you want to remove them, you have to use this command:
Related posts
Before finishing this article, here are some articles that may interest you
These are pretty simple things to set up, and that you may need after installation is complete:
Conclusion
You now know how to install or reinstall Raspbian on a Raspberry Pi, and the first things to do once the installation is complete
Raspbian is the basis of most projects, now you have to choose one and set it up 🙂