Step 5: Python Server

Google bike uses a small python server to read incoming sensor data and serve up the google bike webpage. You will need to install python (version 2.something, the script is not 3.0 compatible as far as I know), and pyserial. Installing python and pyserial should be a relatively painless process with lots of useful information found via google. The only issue I ran into on windows was that I needed to install a 32-bit version of python as I could not find a 64-bit version of pyserial.

The attached server.zip contains the python code to run google bike. It includes:

arduino.py a very simple python module with an Arduino object that receives incoming sensor data

server.py the main python script that creates an Arduino object, a small web server, and launches the google bike page (index.html)

and other supporting files

Sadly, the serial port address is hardcoded on line 17 of server.py So... once you plug in the arduino be sure to correct this line before running server.py On a windows machine the line should look something like:


on mac it will look something like:


After correcting line 17, run server.py (either from the command line, or double click, etc...) and python should launch a web browser with the address: