Controlling your Raspberry PI GPIO from Android using WebIOPI and DRGPIO

A couple of days ago, I was reading the Google+ Community for Raspberry PI when someone asked:  What could be the best way to control the Raspberry PI GPIO port from Android?

Another user suggested to use WebIOPi, a small python script that provides you with a small RESTFUL API to control the GPIO port on the Raspberry PI.

In the last two weeks, I have spent my spare time on developing a small tool for Android that allows you to control the GPIO port in the same way that you would do it on the web interface of WebIOPi. It also works as a handy reference for the pin functions when is not connected to the Raspberry PI.

This time, I'm going to show you how DRGPIO works and how you can use it to control your Raspberry PI GPIO Port from your Android device.


Prerequisites


First, before downloading anything on your Android you MUST install and run WebIOPI. This is not something complicated to do, just follow this instructions:

Installing WebIOPI the "easy way"


If you already have python setup tools installed, just open a terminal console on your Raspberry PI and execute the following command:

sudo easy_install webiopi

This is going to download all needed packages and you are going to be ready to use WebIOPI.

Installing WebIOPI the "hard way"


If you don't have python setup tools, first go to the project page of WebIOPI and download the latest version of the software:


On the download directory execute the following command:

tar -xzf WebIOPi-0.5.3.tar.gz

Change to the extracted directory:

cd WebIOPi-0.5.3

And install it as root:

sudo ./setup.sh


Running WebIOPi


The next thing to do is run WebIOPi, that's really easy... Just run the following command:

sudo python -m webiopi 8000

If you want to run it on background just put an "&" at the end of the command, like this:

sudo python -m webiopi 8000 &

DRGPIO


Downloading


The next step is download to your Android device the application DRGPIO, you can find it on the playstore with that name or clicking in the following link:



First time configuration


When you open it for the first time, DRGPIO is going to ask you to verify if you already have WebIOPi installed and running, if that's the case click on "Skip this step".





On the second screen, you can specify the connection information of your Raspberry PI. This setup screen is already filled with the default parameters used on WebIOPi. If you changed them, just put the right values there.

The most important parameter is the host or IP address, in this example I'm using the private IP address of my Raspberry Pi:


In this version is not necessary to specify the right Raspberry PI revision.

If you want to change the configuration values later, you can get back to this screen choosing the "Settings" option from the main menu.

Using DRGPIO


A message is going to show indicating that DRGPIO is trying to connect to your raspberry PI:




The word "connected" is shown a the top of the screen if the connection is successful:


I have a really bad memory, so I wanted that this small application to be a easy reference of the Raspberry GPIO port, so the buttons have the exact same distribution as shown on the GPIO reference.

Use the checkbox at the side of the buttons to change the port "mode", when they are checked the port is configured as an "input", when they're not checked they are "outputs".

There is a small delay between clicking the port and displaying changes on the user interface so procure don't click the buttons several times. If there is any error DRGPIO is going to show you a error message.


Reference mode


You can get more info about each port, choosing "Reference mode" from the main menu.



If you click on any button is going to show you detailed information about that specific port:



Connection troubles


If there is any problems DRGPIO is going to disconnect from your Raspberry and is going to switch to reference mode.


If you cannot connect please check that you really have direct network access to your raspberry PI, also check if WebIOPi is running and check the settings on DRGPIO.

To connect again just click on "Refresh" on the main menu.



What to expect next?


This first version is really simple. I want to incorporate all the functions from WebIOPi, may be on the next versions I would include a way to use PWM or may be a way to use a custom "skin" for the buttons or the possibility to use several different configurations for different Raspberry PI.

Credits and more information:


This software was developed by me, it's 100% freeware, but It couldn't be made possible without WebIOPi and the advice from Eric Trouch, so if you want to know more about his work, you can visit his page:


If you want to share ideas or want me to incorporate any functionality you can contact me at info_at_teubi.co (change _at_ by @) or by DM on my twitter @mxgxw_alpha.

If you really like this software you can also make a small donation via PayPal:


With nothing more to say... Download an enjoy!

Comentarios

Entradas populares de este blog

Reactivando el Blog

Emulando el Raspberry Pi OS con QEMU en Linux

Escribiendo Mensajes al Blockchain de Bitcoin