RobotPi Part 2 – The remote

The robot remote runs on Android and allows to control many functionality of the robot
The remote control can allow a stable interface across different improvements of the robot. Feedback on the status is is provided as well.

I want to be able in the future to connect the robot with Internet, so I think a good starting point is to design a remote control running on my Android tablet. The target is to create something that can be used for different missions, so I took some time to develop a generic design to cater for different needs.

To create a remote there are basically two options:

  1. build from the scratch that is program java applets, forms, etc
  2. use a remote framework

I opted for the second one as I think it is more interesting to focus on the design of the  whole system rather than going into the low level details of programming sockets & Co.

I found that the NetIO Controller, is the perfect solution for my needs: very simple to install runs on Android and iOS and, since it uses Python, it integrates perfectly with Raspberry. 

Another interesting framework worth mentioning is; looks very promising, but is not easy to install on Raspberry.

After familiarizing with the key concepts the development in NetIO became very intuitive and create controls like the one in the image above is just fun.

The main element of the system are:

  • Controller application: available for Android and iOS 
  • Remote design, done in the cloud and synced (downloaded) with the Android/iOS device
  • Python script as a server running on the Raspberry (thanks Stephen’s post I created a daemon)

In essence each time the user generates an event in the remote such as pressing or releasing a button, the controller application sends a string  to the Raspberry via the socket managed by the Python script. The script simply loop through if statements and  take actions according the signals sent, in the specific example below if the data transmitted is “P1 ON” the Raspberry will change the status of the LED1 pin to HIGH. It is possible to send back some feedback to the remote by using the .conn() method so the remote can also be used to display sensor readings.

while 1:

data = conn.recv(1024)
if data == 'P1 ON\n':


elif data == 'P1 OFF\n':


I have designed the remote for landscape mode so the controls can be placed at the side of the screen; I tried to pack a many controls as I can without hindering the usability of the remote. The central area is reserved for information, specifically I think it is important to know the status of the system after each command. For this I used a clever feature of NetIO called “Webview”, which essentially it allows to embed a webpage in the remote.

In order to get  the status of the GPIO I installed WebIOPi, an automation framework that has, among many good features, a great debug  functionality. In the picture above I posted the GPIO layout where the user is able to see the GPIO status.

Source files
NetIO controller
post from Stephen C Philiips on how to daemonize a Python script


5 thoughts on “RobotPi Part 2 – The remote

    1. Paolo Negrini Post author

      I have not posted it before because there are major changes since the blog entry and I think the code needs some more cleanup, so please consider it as *experimental*. Specifically I changed the control mechanism to use node.js, and foundation as remote controller. Basically the Raspberry Pi is now a web server providing clients pages containing control elements.

      I am now working another project that has a more refined web interface and plan to re-use the experience for Bailey.


Interested? Let's discuss!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s