Skip to content
wbcode edited this page Nov 9, 2013 · 9 revisions

The idea is to use a raspberry pi as a gateway for a rf24 arduino network that automate and monitor my house. I use code form http://code.mios.com/trac/mios_arduino-sensor for the ardunio network. This repository contains the code needed to collect, store, view and mange the ardunio network. Installation This can be done much smolder but that’s for the futher.

On the raspberry pi install the standard Raspbain – wheezy release

Install the python tornado and serial packages. sudo apt-get install python-tornado python-serial php5-common php5-cli php5-fpm php-pear php5-dev nginx

Since there isn’t a prepared package for mongodb to raspberry use the following instruction to install the files needed. You can compile it from the source code but according to varius blogs it will take you 4+ hours do it.

Get the binaries

git clone https://github.com/brice-morin/ArduPi.git cd ArduPi/mongodb-rpi/ sudo cp -r mongo/ /opt/ sudo mv /opt/mongo/ /opt/mongodb/

Create /etc/profile.d/mongodb.sh and add this two lines

PATH=$PATH:/opt/mongo/bin/ export PATH

Get init.d script

cd /etc/init.d/ sudo wget https://raw.github.com/brnt/mongo-pi/master/init.d/mongodb

Edit /etc/init.d/mongodb change DATA to

DAEMON=/opt/mongo/bin/mongod DATA=/var/lib/mongodb

Also add the following at the begining of the script. It's just to get away from some warnings.

\#\# BEGIN INIT INFO \# Provides: mongod \# Required-Start: $remote_fs $syslog \# Required-Stop: $remote_fs $syslog \# Default-Start: 2 3 4 5 \# Default-Stop: 0 1 6 \# Short-Description: Start mongod at boot time \# Description: Enable service provided by daemon. \### END INIT INFO

Make executable and add to autostart

sudo chmod +x mongodb && sudo update-rc.d mongodb defaults

Get config file

cd /etc sudo wget https://raw.github.com/RickP/mongopi/master/debian/mongodb.conf

Edit /etc/mongodb.conf to fitt your needs.

Create db and log dirs, fix permissions

sudo mkdir /var/lib/mongodb && sudo mkdir /var/log/mongodb/ sudo chown -R pi:pi /var/lib/mongodb /var/log/mongodb/ /opt/mongodb/ sudo chmod u+x,g+x /opt/mongo/bin/*

Configure php

See http://www.andrewdcox.com/blog/2013/05/11/running-an-nginx-php-and-mysql-webserver-on-the-raspberry-pi/

Add support to php for mongodb

sudo pecl install mongo

Add mongo extention to php.ini

add "extension=mongo.so" to sudo vi /etc/php5/cli/php.ini sudo vi /etc/php5/fpm/php.ini sudo service php5-fpm restart

Clone this wiki locally