Browser Controlled Robot

Browser Controlled Robot

The browserBot” is a web-browser controller robot using the BrickPi.  With this project, we demonstrate how to control a BrickPi robot directly from the browser of any computer, tablet, or phone.

Raspberry Pi Robot Controlled with a Web Page

Using the browserBot you can build your own web-controlled robot in very very easily with just a few lines of code. The browserBot is a good place to start if you want to build a project using BrickPi to send and receive information directly to a web page.

browserBot infographic: How the Raspberry Pi is controlled by your tablet.

SimpleBot: Easy to Build Robot with the Raspberry Pi

SimpleBot: Easy to Build Robot with the Raspberry Pi

Building the browserBot

The browserBot uses the same body the simplebot .  Here are some links for building instructions:


The code for the browserBot is available on our  BrickPi Python Github Repository under the “Project Examples” folder.

To pull the example code, just clone the BrickPi Python Repository,

git clone

If you don’t have Git installed, download and install it from here.


There are two files in the Project_ExamplesbrowserBot folder in the repository:

Browser_Client_Code.html : This page runs on the client computer, cell phone, or tablet browser, the one from which you want to control the bot. This code runs on the Raspberry Pi Server and controls the robot.

Prepare Your Pi

This code needs “Tornado” for python installed on your Raspberry Pi.  Tornado will allow us to use Web Sockets with our Raspberry Pi.  Web sockets will allow us to communicate back and forth between the Raspberry Pi and the client.

To install Tornado on Raspberry Pi, first install pip on the RaspberryPi:

sudo apt-get install python-pip

And then install Tornado for python using PIP:

pip install tornado

To run this example, you won’t need to know too much about tornado or websockets.  But if you if you are new to Web Sockets and want to know more about how they work, here’s a good place to learn a little more.

Using the Robot

The Raspberry Pi and the client (your browser, phone, tablet, or computer) must be connected to the same WiFi network.  So begin by making sure everything is on the same wifi network.

Once you’re connected and have Tornado installed on the RaspberryPi, run in terminal on the Raspberry Pi:



After the server is running on the Raspberry Pi, download Browser_Client_Code.html from the BrickPi Github Repository to the device you want to control the browserBot from.

Run the client code Browser_Client_Code.html in the web browser of any device such as a laptop or a Mobile Phone as long as they are on the same network as the Raspberry Pi.

Once the HTML page it loaded, enter the BrickPi’s IP address into the text box and press “clickme”.  There will be a short lag as the browser connects to the Raspberry Pi, and then you should be able to control the browserBot with the buttons on your web page..


Errors and Troubleshooting:

If you get the following error:

socket.error: [Errno 98] Address already in use

Run netstat on the terminal and check which process is currently using the port 9093:

sudo netstat -ap |grep :9093


Note down the PID (Process IDentifier) of the process running it and kill that process :

kill pid

If it does not work use:

kill -9 pid

If the error does not go away, try changing the port number ‘9093’ both in the client and server code.

Tip:Don’t use Ctrl+Z to stop the program, use Ctrl+c.

If you use Ctrl+Z, it will not close the socket and you won’t be able to run the python server on the Raspberry Pi the next time.