-
Notifications
You must be signed in to change notification settings - Fork 1
Create a server that will store the GPS coordinates
In order to store the GPS coordinates to a central server, we use openshift. You must create an account in https://www.openshift.com. Then create a php application. Add the mysql and phpmyadmin cartridges.
First, open phpmyadmin and submit the sql statments which are located in the file https://github.com/ellak-monades-aristeias/mult_bus/blob/master/src/mysql_scripts/create_tables_opeshift.sql.
Then, open the bus
database and add a new user with a password. In what follows we use id=1
, pass=1234
.
Afterwards, copy the files below to the openshift root directory:
- https://github.com/ellak-monades-aristeias/mult_bus/blob/master/src/php_scripts/config.php
- https://github.com/ellak-monades-aristeias/mult_bus/blob/master/src/php_scripts/index.php
- https://github.com/ellak-monades-aristeias/mult_bus/blob/master/src/php_scripts/insert.php
- https://github.com/ellak-monades-aristeias/mult_bus/blob/master/src/php_scripts/list.php
- https://github.com/ellak-monades-aristeias/mult_bus/blob/master/src/php_scripts/map.php
Then, copy the file https://github.com/ellak-monades-aristeias/mult_bus/blob/master/src/python_scripts/read_and_send_gps.py. Edit the following lines of the script, in order to match your desired values:
basUrl = 'http://bus-aggelos.rhcloud.com/insert.php'
busId = '1'
busPass = '1234'
In order to run the script, use the command:
sudo python read_and_send_gps.py
If you want to start sending the gps coordinates to the central server when raspberry boots, place the command sudo python read_and_send_gps.py
to /etc/rc.local
or any other script that runs during boot.