Android Pi

GPIO Tool For Raspberry Pi

Besides the mundane tasks of monitoring, rebooting, and shutting down Raspberry Pi, you can put your Android device to other, more interesting uses like controlling the GPIO ports. The GPIO Tool For Raspberry Pi app [3] allows you to do just that. Using it, you can connect to a remote Raspberry Pi machine and get the status of all GPIO ports as well as control them individually.

Before you run the app on your Android device, you need to install the WiringPi library on Raspberry Pi. Start by installing the Git software using the

sudo apt-get install git

command. Then, clone the WiringPi Git repository by running the

git clone git://

command. Next, switch to the wiringPi directory and run the build script:

cd wiringPi

Once WiringPi has been compiled and installed, you can grab and install the GPIO Tool For Raspberry Pi app on your Android device. During the first run, the app prompts you to install the androidcmd utility. This app offers two options: compile the utility from source or install the binary package. If Raspberry Pi runs the Raspbian Linux distribution, use the latter option. Otherwise, you need to compile the utility from source.

Next, choose Add Raspberry Pi from the Settings menu and configure the connection profile. Press OK when done to save the profile, then press the Connect button to establish a connection to Raspberry Pi. If everything works properly, you should see the Connected status message and a GPIO layout. You can then switch pin modes for each individual pin. Of course, there is not much point in controlling pins if nothing is connected to them.

So, as an experiment, you might want to connect an LED to a GPIO port and control it from Android using the GPIO Tool For Raspberry Pi app. For this project, you need a breadboard, a couple of jumper wires, an LED, and a 270-ohm resistor. Wire the components as shown in Figure 3 and make sure that the black and yellow wires are connected to the Ground and GPIO 17 pins, respectively.

Figure 3: Connecting an LED to Raspberry Pi.

Now, fire up the GPIO Tool For Raspberry Pi app on the Android device and set the GPIO 17 pin as output (Figure 4). To do this, long-tap on the pin's label and select Output from the pop-up list. Then, tap on the pin to change its mode to HIGH to turn on the LED. Tap on the pin again to change its mode to LOW and turn off the LED. Obviously, instead of the LED, you can connect and control other peripherals, which opens a whole new world of possibilities.

Figure 4: Controlling GPIO pins with the GPIO Tool For Raspberry Pi app.

Raspberry Control

Similar to GPIO Tool for Raspberry Pi, Raspberry Control [4] lets you control GPIO pins, but this particular app packs other useful features, too. Raspberry Control can be used to collect and graph data from DS18B20 temperature sensors connected to Raspberry Pi, view and manage processes, access and control Raspberry Pi via SSH, and much more (Figure 5).

Figure 5: Raspberry Control offers a plethora of tools for controlling and managing Raspberry Pi from Android.

To make Raspberry Control play nicely with Raspberry Pi, grab the latest rpc_installer-<xxxx-xx-xx>.tar.gz archive from the project's website [5] and copy the downloaded file to the home directory on your Raspberry Pi. Run the tar xvzf rpc_installer-<xxxx-xx-xx>.tar.gz command to unpack the archive. Then, switch to the resulting rpc_installer directory and unpack two other tarballs:

tar xvzf quick2wire-gpio-admin.tar.gz
tar xvzf shellinabox-x.xx.tar.gz

Next, run the ./rpc_utils --install command, wait until the installation process is completed, and reboot Raspberry Pi. Install Raspberry Control on your Android device, launch the app, provide the required connection info, and press the Connect button. When the connection has been established, you are dropped into the app's interface. Before you start, you should specify connection info, so you don't have to do this manually every time you launch the app. Press the Settings button and provide the required info, such as the IP address of your Raspberry Pi and SSH login credentials.

Each button in Raspberry Control's interface gives you access to a specific module that controls certain aspects of the Raspberry Pi. The GPIO button, for example, opens the interface for controlling the GPIO pins (Figure 6). You can use the LED setup described earlier to test this functionality. To begin, set the GPIO pin as output, then change its mode from OFF to ON to turn on the LED.

Figure 6: The app makes it possible to control the GPIO pins on Raspberry Pi.

Raspberry Control also allows you to disable and hide certain GPIO pins as well as change their labels to something more descriptive, for example "Yellow LED" or "Living Room" instead of the generic "GPIO 7." To do this, open the rpc.conf file in the nano text editor using the sudo nano /etc/raspberry_control/rpc.conf command. To disable specific pins, change the yes value to no (e.g., GPIO_11='no') in the [GPIO_EXPORT] section. To give a pin a descriptive name, change its value in the [GPIO_NAME] section (e.g., GPIO_7='Yellow LED').

Raspberry Control supports MJPEG streaming, so if you have a webcam connected to your Raspberry Pi, you can view the video stream by tapping on the WebCam button. The Process button lets you view and kill processes running on Raspberry Pi (Figure 7), and the Remote button opens a terminal window, which you can use to establish an SSH connection to Raspberry Pi. You can put Raspberry Control to other clever uses, too. Add an infrared LED to Raspberry Pi, install and configure the LIRC software on it, and you can use the Raspberry Control app as a remote control.

Figure 7: Raspberry Control allows you to view and manage processes.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content