Control Raspberry pi GPIO using an app


Raspberry Pi : Control Raspberry pi GPIO using an app:

Android Moblie with Raspberry Pi



A quick view about how to control Raspberry pi GPIO pins using an application

Let’s start

Step 1:

Raspberry Pi – Requirements


controlling Android Moblie with Raspberry Pi

Any Raspberry Pi model connected to your network

An android mobile phone

To put an app on the phone you require a personal computer.

Step 2:

Raspberry Pi – The application

Mobile App


For this you can use an app and change the IP address of your Raspberry Pi. You can change it according to your requirements

Step 3:

Raspberry Pi


Wiring Pi


Connect Wiring Pi

Raspberry Pi: Installation

There are two things to be installed to your Raspberry Pi

  1. Wiring pi
  2. apache2 with php5

Wiring pi is required to direct the GPIO pins from the php page.

You can pursue these commands to install apache2 on a raspberry pi and also trail ‘ADDITIONAL – INSTALL PHP’ down the page.

Now you should ‘/var/www/html’ eradicate index.html and create a new file index.php.

In index.php you add:


exec(“gpio mode 0 out”);

exec(“gpio mode 2 out”);

exec(“gpio mode 3 out”);

if (isset($_GET[‘led1’])) {

if($_GET[‘led1’] == 1) {

exec(“gpio write 0 1”);// pin 0 in wiring pi is gpio 17

} else {

exec(“gpio write 0 0”);



if(isset($_GET[‘led2’])) {

if($_GET[‘led2’] == 1) {

exec(“gpio write 2 1”);// pin 2 in wiring pi is gpio 27

} else {

exec(“gpio write 2 0”);



if(isset($_GET[‘led3’])) {

if($_GET[‘led3’] == 1) {

exec(“gpio write 3 1”);// pin 3 in wiring pi is gpio 22

} else {

exec(“gpio write 3 0”);




Now you ought to manage the GPIO pins of your raspberry pi by means of an app.

Step 4:

Raspberry Pi – Restart it now


Connected App with mobile and Raspberry pi


About Author

1 Comment

Leave A Reply