Wednesday, November 27, 2024

DIY: Create Your Own (Small) Laptop!

Note: We tested and updated this project, available on Smallest Raspberry Pi Laptop.

In this age of flexible working, the usage of laptops anywhere and everywhere has become a norm. Fast computing machines, especially for programming-related tasks, are essential.

- Advertisement -

Tasks including network penetration and testing the potency of malware and virus is often performed in spying and ethical hacking. The user is required to work on a computer that’s small in size and can’t be easily noticed. And despite the size, the laptop should have excellent specifications, on par with other high spec laptops.

So today, you will learn to design the world’s smallest hacking laptop that has a full touch keyboard. Excited?? Let’s begin. But you will first need to decide the specs of your laptop so that the appropriate hardware parts and OS can be selected.

- Advertisement -
Fig 1. Author’s prototype
Fig 2. Smallest hacking laptop with touch keypad
Fig 3. Smallest hacking laptop running Linux terminal

Laptop Features 

  • Small as your finger
  • Easy to carry and hide 
  • Built-in multi-touch display and keyboard panel
  • Equipped with WiFi and Bluetooth LE  

The best OS for ethical hacking is Kali Linux. It comes with various exploitation tools such as Metasploit, Aircrack-ng and Wireshark that are beneficial for penetration hacking and testing.

After deciding the computer specifications, let’s do some shopping for components.

Bill Of Materials

Designing 

To design the case or body of the laptop for holding the necessary hardware, begin working on three parts: base, top and front.

In the base part, keep the main hardware, that is, Raspberry Pi, battery and its charging system. Also, cut two slots at the bottom-front of the laptop case for the ethernet/USB and charging ports. 

Fig 6. Laptop base case

For the top part that will hold the touch e-paper-based keyboard for the laptop, cut a slot on the top-front face to affix the touch panel keyboard inside (refer Fig 4.)

Fig 6. Base cover design that hold the keyboard part

To design the LCD panel case for the laptop in the front, create an enclosure with the same size and thickness. 

Fig 7.LCD panel design

After designing the laptop body parts, 3D print them. 

Prerequisite

Before proceeding further, follow the basic setup procedures for your Raspberry Pi board. Most white hat hackers prefer Kali Linux OS. Therefore, its setup on your RPi board is highly recommended. Please follow the below steps:

  1. Go to the official website of Kali Linux and download the latest version for Arm-based devices like Raspberry Pi.  
  2. Install the Raspberry Pi disk imager. 
  3. Now insert the SD card into the USB drive. 
  4. Choose the Kali Linux OS image file and install Kali Linux OS in the SD card using the Raspberry Pi disk imager.
Fig 9. Preparing the SD card with Kali Linux OS

Preparing OS for SPI Display 

It is recommended to use an HDMI-based touch display sized 3.5 inches in order to keep the laptop size as small as possible.

Note that when two SPI displays are used simultaneously, a conflict is created during communication. Because an HDMI-based touch display and e-ink display (for the keyboard panel) is used for the laptop, the above condition holds true for you. However, the SPI touch e-ink display is used for keyboard panel only, so its touch function that’s I2C-based shouldn’t cause many problems. 

If you are using an HDMI display for the laptop, then you can skip the following steps and go straight to the keyboard preparation section.

To use the SPI display, you need to install the required driver and set up the SPI touch display for Raspberry Pi. For this, run the following commands in the Linux terminal.

git clone https://github.com/goodtft/LCD-show.git
chmod -R 755 LCD-show
cd LCD-show/
sudo ./LCD35-show

After installing the driver, make sure to solder the pins to Raspberry Pi as per the below table. Also, connect the SPI display as shown below. 

PIN NO. SYMBOL DESCRIPTION
1, 17 3.3V Power positive (3.3V power input)
2, 4 5V Power positive (5V power input)
3, 5, 7, 8, 10, 12, 13, 15, 16 NC NC
6, 9, 14, 20, 25 GND Ground
11 TP_IRQ Touch Panel interrupt, low level while the Touch Panel detects touching
18 LCD_RS Instruction/Data Register selection
19 LCD_SI / TP_SI SPI data input of LCD/Touch Panel
21 TP_SO SPI data output of Touch Panel
22 RST Reset
23 LCD_SCK / TP_SCK SPI clock of LCD/Touch Panel
24 LCD_CS LCD chip selection, low active
26 TP_CS Touch Panel chip selection, low active
Fig 10. Connecting SPI display with Raspberry Pi

Waveshare touch e-ink display. So open the Linux terminal and run the following command to get the library and driver for the e-ink display.   

sudo pip3 install gpiozero
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.tar.gz
tar zxvf bcm2835-1.68.tar.gz 
cd bcm2835-1.68/
sudo ./configure && sudo make && sudo make check && sudo make install
sudo apt-get install wiringpi
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo pip3 install RPi.GPIO
sudo pip3 install spidev
cd ~
git clone https://github.com/waveshare/Touch_e-Paper_HAT

In the code, change the display picture on the e-ink display with the picture of the keyboard layout vector image. Run the code to see the changes.  

Note: Connect the e-ink touch display with the GPIO of Raspberry Pi before running the code.

For creating the virtual input of mouse and keyboard in the Raspberry Pi, there are many Python libraries including pynput. Make sure to install any of them. Run the following command in the Linux terminal to install the pynput module. 

sudo pip3 install pynput

Now you are ready to begin coding for monitoring the touch points and also for checking which key is being pressed at the time, that is, converting the touch points into the desired input. So, import the library and pynput modules to Raspberry Pi.

Fig 11. Keyboard layout on E-Ink display

Next, create a while loop to define a function to use pynput that will send the keyboard input to Raspberry Pi. Set the function of a key when pressed.

Fig 12.Code for keyboard input
Fig 13. Code checking touchpoints and converting into keyboard input

You will need to change the SPI(0,0 ) of the Raspberry Pi SPI port to a second SPI. So, open the lib folder and make changes in the code file of the e-ink touch display by changing SPI(0,0) to SPI(1,0) in every file. Save it. 

Next, enable the SPI second port of Raspberry Pi (by adding the line pointed out in Fig 14) into the config.txt file of Raspberry Pi that can be found in the boot folder in the root of Raspberry Pi.

Fig 14 . Changing the SPI number in code
Fig 15. Enabling other SPI on Raspberry Pi

Connect the e-ink display to the Raspberry Pi pins as per the following table. Because you are using only the touch part and the touch controller is I2C based, you only need to connect the pins of the touch controller of the e-ink display to the Raspberry Pi.

           E-INK Paper Pins                    BCM PIN Numbering                 Board Pin Number

VCC 3.3V 3.3V
GND GND GND
INT 27 13
SCL SCL1 5
SDA SDA1 3
TRST 22 15

Preparing The Laptop 

After setting up everything in the library and modules with respect to the connection, assemble all the hardware within the 3D printed laptop case. Also, connect the battery and charging system with Raspberry Pi 5V pin and GND pin inside the case.

Setting Raspberry Pi inside the case
Fig 16. Setting Raspberry Pi inside the case
Fig 17. Assemble the touch keyboard on the base of the laptop
Fig 18. Touch keyboard fixed
Fig 19 .Display fixed onto the display case

Testing 

Fig 20.Laptop running Kali Linux
Fig 21. Laptop running the Linux terminal

Congrats!! The world’s smallest hacking laptop created by you is now ready. Simply power it and run the keyboard code. Although small in size, this portable machine is as powerful as any large-sized hacking laptop, enabling you to perform penetration testing and check network security. 

The laptop can also be used for office work, playing games or video streaming. The device is capable of performing as expected from a conventional laptop.

Download Source Code

Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics

×