Screen Mirroring of Android Smartphone using Raspberry Pi
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:
Model | Release Date | Core Type | No. of Cores | RAM | GPU |
---|---|---|---|---|---|
Pi B | 15 Feb,2012 | ARM1176JZF-S | 1 | 512 MB | VideoCore IV 1080p@30 |
Pi 2 | 1 Feb,2015 | Cortex-A7 | 4 | 1 GB | VideoCore IV |
Pi zero | 30 Nov,2015 | ARM1176JZF-S | 1 | 512 MB | VideoCore IV |
Pi 3 | 29 Feb,2016 | Cortex-A53 64-bit | 4 | 1 GB(DDR2) | VideoCore IV 1080p@30 |
Pi A+ | 10 Nov,2014 | ARM1176JZF-S | 1 | 256 MB | VideoCore IV |
Pi zero w | 28 Feb,2017 | ARM1176JZF-S | 1 | 512 MB | VideoCore IV |
Pi zero wh | 12 Jan,2018 | ARM1176JZF-S | 1 | 512 MB | VideoCore IV |
Pi 3B+ | 14 Mar,2018 | Cortex-A53 64-bit | 4 | 1 GB(DDR2) | VideoCore IV |
Pi 3Model A+ | 15 Nov,2018 | Cortex-A53 64-bit | 4 | 512 MB(DDR2) | VideoCore IV |
Pi 4B | 24 June,2019 |
Cortex-A72 (ARM v8) 64-bit |
4 |
1 GB,2 GB, 4 GB(LPDDR4) |
VideoCore VI |
Pi 4B(8 GB) | 28 May,2020 |
Cortex-A72 (ARM v8) 64-bit |
4 | 8 GB(LPDDR4) | VideoCore VI |
Pi 400 | 2 Nov,2020 |
Cortex-A72 (ARM v8) 64-bit |
4 | 4 GB(LPDDR4) | VideoCore VI |
Pi Pico | 21 Jan,2021 |
RP2040 dual-core Arm Cortex-M0+ |
2 | 264 KB | ————– |
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.
Prerequisites:
Raspberry Pi 2(or above model, excluding Pi Pico)
- 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.
Connections & Configuration:
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).
Implementation:
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.