Screen Mirroring of Android Smartphone using Raspberry Pi

17 Jan, 2022
Raspberry Pi consists series of small single-board computers. It was developed in the United Kingdom by the Raspberry Pi foundation in association with Broadcom. The first Raspberry Pi model was launched in 2012 and by the time it became popular because of its wide applications in many fields like many used Raspberry Pi to learn programming skills, build hardware projects, do home automation, and even use them in industrial applications.
Raspberry Pi is a very cheap computer that runs Linux but also provides a set of GPIO(general purpose input/output)pins that allow you to control electronic components for physical computing and explore the internet of things(IoT).
Here is the list of different models of Raspberry Pi:
Cortex-A72 (ARM v8) 
64-bit
1 GB,2 GB,
4 GB(LPDDR4)
Cortex-A72 (ARM v8)
 64-bit
Cortex-A72 (ARM v8) 
64-bit
RP2040 dual-core
 Arm Cortex-M0+
Now, let’s move to our project based on the screen mirroring of an android phone with the help of Raspberry Pi.
Screen Mirroring or casting allows you to mirror your mobile device content to your TV screen. One needs at least Raspberry Pi 2 model for mirroring your mobile device to your tv screen.
Raspberry Pi 2(or above model, excluding Pi Pico)
HDMI cableMouseKeyboardSD card(8GB at least)Data Cable(Depending upon your smartphone charging port)Output Screen(TV screen, Computer screen or any other screen)
HDMI cable
Mouse
Keyboard
SD card(8GB at least)
Data Cable(Depending upon your smartphone charging port)
Output Screen(TV screen, Computer screen or any other screen)
Before moving forward, one should install Raspberry Pi OS(previously called Raspbian) an official supported operating system for Raspberry Pi.
So, now here are connections one should make before moving further:
Connect one end of the HDMI cable to the output screen and the other to Raspberry Pi.Connect mouse and keyboard to the Raspberry Pi ports.For internet connection connect with an Ethernet cable or with WiFi.For providing power to Raspberry Pi connect it with a type-C or type-B data cable(depending upon the Raspberry Pi model).
Connect one end of the HDMI cable to the output screen and the other to Raspberry Pi.
Connect mouse and keyboard to the Raspberry Pi ports.
For internet connection connect with an Ethernet cable or with WiFi.
For providing power to Raspberry Pi connect it with a type-C or type-B data cable(depending upon the Raspberry Pi model).
Now it begins, after installing OS and making connections follow the given below steps carefully:
For installing scrcpy we have to install PiKiss on our Raspberry Pi.
Step 1: Open terminal(Ctrl+Alt+T) on Raspberry Pi and type the following command and hit enter:
 $ curl -sSL https://git.io/JfAPE | bash
      
Step 2: Open File Explorer->Pi(folder)->PiKiss. Under PiKiss Folder go-to tools and on top click on ‘Open Current Folder in Terminal’.
Step 3: Check if new scripts are available on remote and update them automatically, but If you want to get the latest version manually, just enter into the directory with cd PiKISS and use the below command: 
$ git pull
Step 4: Open the drop-down menu and click on ‘System Tools followed by Open PiKISS.
Step 5: The given window will pop up and scroll down to select scrcpy and press enter.
Step 6: Again open the drop-down menu and click on System tools followed by scrcpy.
Step 7: Now, connect the android smartphone to raspberry pi and enable the developer option on your android smartphone by tapping 4-7 times on your android smartphones’ build number(If you are unable to enable the developer option, then search how to enable developer option for any particular device. After getting on developer option,enable USB debugging on android smartphone. (Click ‘OK’ on popup message if it displays on after enabling USB debugging). On connecting your android smartphone to Raspberry Pi, it will show the ‘USB Debugging’ popup window, click on ‘Allow‘.
Step 8: At last, again enable scrcpy by simply click on Scrcpy under System Tools.
It will mirror your android device on your output screen.
simmytarika5
Android
TechTips
Android
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Add Views Dynamically and Store Data in Arraylist in Android?
Android SDK and it's Components
How to Communicate Between Fragments in Android?
Flutter - Custom Bottom Navigation Bar
Retrofit with Kotlin Coroutine in Android
How to Find the Wi-Fi Password Using CMD in Windows?
Docker - COPY Instruction
Setting up the environment in Java
How to Run a Python Script using Docker?
Running Python script on GPU.