Installing dependencies for Hydrosys

Here we are, the SD card is loaded with Raspbian Wheezy and the SSH connection is established.

Let’s install the require dependencies to make the hydrosystem platform works:

The installation will be made on the entire system (no virtual environment used)

Connect through SSH -> pi@raspberrypi ~ $ .

Optionally if we want to have the most updated system, type the two below commands:

sudo apt-get update
sudo apt-get upgrade

Now let’s install the dependencies:

sudo apt-get install python-dev

sudo apt-get -y install python-pip
sudo pip install flask
sudo pip install apscheduler
sudo pip install pyserial

(for the webcam support)
sudo apt-get install fswebcam 

(for external IP address, using DNS)
sudo apt-get install dnsutils

sudo pip install pbkdf2 
(encryption)

sudo pip install tornado
(web server)

Libraries for the Sensors

DHT22 library (Hymidity and temperature sensor):

sudo apt-get install build-essential python-dev
mkdir DHT22
cd DHT22
wget https://github.com/adafruit/Adafruit_Python_DHT/archive/master.zip
unzip master.zip
cd Adafruit_Python_DHT-master
sudo python setup.py install
cd ..
cd ..

Enable I2C and Spi :

sudo nano /boot/config.txt

The lines are already there, just remove the # in front of the row

dtparam=i2c_arm=on
dtparam=spi=on
dtparam=i2s=on

then modules should be added to modules file:

sudo nano /etc/modules

paste in the file the following lines:

i2c-bcm2708
i2c-dev
i2c-bcm2835
rtc-ds1307
bcm2835-v4l2

sudo apt-get install git build-essential python-dev python-smbus
sudo apt-get install -y i2c-tools

IMPORTANT:

if you want to use the picamera, it is needed to enable it.

This can be done using thefollowing command:

sudo raspi-config

 

INSTALL SPI library:

sudo apt-get install python2.7-dev 

wget https://github.com/Gadgetoid/py-spidev/archive/master.zip

unzip master.zip

rm master.zip

cd py-spidev-master

sudo python setup.py install

cd ..

INSTALL BMP180 library (pressure sensor)

sudo apt-get install git build-essential python-dev python-smbus

Create and go in directory bmp180

sudo mkdir bmp180

cd bmp180

Copy the adafruit program

sudo git clone https://github.com/adafruit/Adafruit_Python_BMP.git
cd Adafruit_Python_BMP

sudo python setup.py install

cd ..
cd ..

 

Real Time Clock (RTC)

To ensure the DS3132 device is setup and the time synchronised when the Pi boots we need to edit another system file :

sudo nano /etc/rc.local

Add the following two lines before the exit 0 line :

echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device || true
hwclock -s || true