Create SD Image Version 0.71
Contents
- 1 Feature Request
- 2 Bug Fixes
- 3 Create new image
- 3.1 Get latest Wheezy image
- 3.2 Set up Wi-Fi
- 3.3 Remove packages we don't need
- 3.4 Install packages we need
- 3.5 Configure apache
- 3.6 Set sudo user privileges for Apache
- 3.7 Create SQLite database
- 3.8 Install TEMPerHUM software
- 3.9 Install Broadcom 2835 Library
- 3.10 Install wiringPi library
- 3.11 DHT22 Temperature/Humidity Sensor
- 3.12 HX711 weight ADC
- 3.13 TLS2591 Lux Sensor
- 3.14 Add crontab entries
Feature Request
- Most recent raspbian distro
- Removal of bloatware from Raspbian (games, educational, etc.)
- Hivetool Support Pi & Pi2 (auto detect preferred)
- Automatic removal of erroneous data from sensors
- Basic navigation from webserver index.html, especially config.pl and Hivestats with download.
- Menu driven selection & configuration of sensors (gpio 2,3 for DHT22s preassigned by menu default)
- Menu driven setup of essential parameters with choices that don't crash app when saving, grey out unused.
- Sensor calibration provisions (gain, offset)
- Display instantaneous sensor readings from config screen with read button
- Preload & configure Apache Webserver and database, Hivetool, sensor drivers for proven sensors.
- Update local & online hivestats graphs to display lux trend pen, (use latest hivestats with enhanced autoscaling for local)
- Network / wifi support out of the box seems to work well now, handle configuration on router side with DHCP reservation as may be needed.
- Add configuration menu item for naming pi, same as hivestats name?
- Minimize need to enter Raspiconfig, can timezone and time all be handled in hivetool config?
- Enable i2c & serial.
Bug Fixes
- Add timeout to crontab so hive.sh can't hang.
- Fix HX711 code addressing and timing to work on Pi2.
- Fix tempered code to work with new TEMPerHUMs.
- Improve Wi-Fi auto reconnect.
Create new image
Get latest Wheezy image
- Download, unzip, burn image.
- Boot
- DO NOT EXPAND file syatem!
Set up Wi-Fi
Add to /etc/wpa_supplicant/wpa_supplicant.conf:
network={ ssid="dlink" key_mgmt=NONE auth_alg=OPEN }
Wi-Fi auto reconnect to AP
- Go to /etc/ifplugd/action.d/ and rename the ifupdown file to ifupdown.original
- Then do:
cp /etc/wpa_supplicant/ifupdown.sh ./ifupdown
http://raspberrypi.stackexchange.com/questions/4120/how-to-automatically-reconnect-wifi
Remove packages we don't need
This will make room for software without expanding the image.
sudo apt-get remove --purge wolfram-engine penguinspuzzle scratch dillo squeak-vm squeak-plugins-scratch sonic-pi idle idle3 netsurf-gtk netsurf-common sudo apt-get autoremove sudo apt-get clean rm -rf /home/pi/python_games sudo rm -rf /opt/vc #NO! Don't do this if you want to use the video camera sudo rm -rf /opt/minecraft-pi
https://project.altservice.com/issues/418
Install packages we need
sudo apt-get -y update sudo apt-get -y install gawk bc apache2 libusb-dev libgd-graph-perl libexpat1-dev sqlite3 sudo cpan GD::Text GD::Graph Date::Format XML::Simple DBI DBD::SQLite
Configure apache
- Add .pl to AddHandler cgi-script
- sudo vi /etc/apache2/mods-enabled/mime.conf
- uncomment #AddHandler cgi-script .cgi (around line 219) and add .pl so it looks like:
- AddHandler cgi-script .cgi .pl
- add Includes and +ExecCGI to Options:
- sudo vi /etc/apache2/sites-enabled/000-default
- In stanza <Directory /var/www/>
- change
- Options Indexes FollowSymLinks MultiViews
- to
- Options Indexes FollowSymLinks MultiViews Includes +ExecCGI
- Add index.shtml to DirectoryIndex:
- sudo vi /etc/apache2/mods-enabled/dir.conf
- Change
- DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
- to
- DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm index.shtml
- Copy the include.load module to enable it
- sudo cp /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled/
- Set up apache to listen on port 8080 if using port forwarding:
- sudo vi /etc/apache2/ports.conf
- add Listen 8080
- Restart Apache
sudo apachectl restart or sudo/etc/rc4.d/S02apache2 restart
Set sudo user privileges for Apache
This is necessary to allow config.pl to read the sensors. Run visudo to edit the sudo config file:
sudo visudo
and insert this line in the "User privilege specification" section:
www-data ALL=NOPASSWD: /usr/local/bin/2591, /usr/bin/nice, /home/hivetool/temperhum.sh, /usr/local/bin/hx711, /usr/local/bin/Seeed_DHT22
Create SQLite database
cd /home/hivetool sqlite3 hivetool_raw.db sqlite> .read create_hivetool_sqlite.sql sqlite> .quit
Install TEMPerHUM software
sudo apt-get update sudo apt-get install dh-autoreconf sudo apt-get install libudev-dev sudo apt-get install libusb-1.0-0-dev
sudo git clone git://github.com/signal11/hidapi cd hidapi sudo ./bootstrap sudo ./configure sudo make sudo make install
sudo apt-get install cmake-curses-gui cd .. sudo git clone git://github.com/edorfaus/TEMPered cd TEMPered sudo ccmake .
Then the sub commands: "c" to configure then "g" to save and go
sudo make sudo make install
Add /usr/local/lib/arm-linux-gnueabihf/ to /etc/ld.so.conf
sudo vi /etc/ld.so.conf sudo ldconfig
Install Broadcom 2835 Library
Install bcm2835 library http://www.airspayce.com/mikem/bcm2835/
Download the bcm2835 library:
curl -o bcm2835-1.42.tar.gz http://www.airspayce.com/mikem/bcm2835/bcm2835-1.42.tar.gz tar xvf bcm2835-1.42.tar.gz
cd bcm2835-1.42 ./configure make sudo make check sudo make install
Install wiringPi library
- Install i2c tools
- apt-get install i2c-tools
- modprobe -a i2c-bcm2708
- get wiringPi code from github and compile it
git clone git://git.drogon.net/wiringPi cd wiringPi ./build
- add i2c-dev to /etc/modules (?)
- Install i2c tools
- apt-get install i2c-tools
- run raspi-config and turn on i2c or in /etc/modprobe.d/raspi-blacklist.conf comment out:
- blacklist i2c-bcm2708 (?)
- reboot or run:
- modprobe -a i2c-bcm2708
- Install git
- sudo apt-get install git-core
- get wiringPi code from github and compile it
git clone git://git.drogon.net/wiringPi cd wiringPi ./build
http://wiringpi.com/download-and-install/wiringPi
DHT22 Temperature/Humidity Sensor
Groove Seeed - DHT22 with modified code
HX711 weight ADC
hx711wp
TLS2591 Lux Sensor
2591 Adafruit with modified code.
Add crontab entries
Edit crontab:
sudo crontab -e
Add to crontab:
# Check hive instruments every 5 minutes. Kill process after 3 1/2 minutes. 0,5,10,15,20,25,30,35,40,45,50,55 * * * * timeout -s KILL 3.5m /home/hivetool/hive.sh # # Check the server status. Kill process after 1 minute. 0,5,10,15,20,25,30,35,40,45,50,55 * * * * timeout -s KILL 1m /home/hivetool/server_status.sh > /var/www/server_status.txt