Difference between revisions of "Create SD Image Version 0.8.1"

From HiveTool
Jump to: navigation, search
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
The next major release will be [[Create SD Image Version 0.9| version 0.9]]
+
'''WARNING:  Please use [[Create_SD_Image_Version_0.8.3| version 0.8.3]]. '''
  
The HiveTool image for the Raspberry Pi Version 0.8.0 Release Candidate 5 is available here:
 
  
  https://drive.google.com/open?id=1euXRxbtnyF7nag5jWVq1-HKezHE6CsJy
+
The HiveTool image version 0.8.1 Release Candidate 1 for the Raspberry Pi is available for download at:
 +
   
 +
https://drive.google.com/file/d/1VqaEclr69SIgZLA6sbyahpniUwuBrfEN/view?usp=sharing
  
The sizes are:
+
The sizes of the compressed and unzipped file:
  hivetool080rc5.img.zip   2380977029  (2.3 GB)
+
  -rw-r--r-- 1 root root 2499670609 May 15 21:26 hivetool081rc1.img.zip
  hivetool080rc5.img       6585934336  (6.4 GB)
+
  -rw-r--r-- 1 root root 6493291008 May 15 21:17 hivetool081rc1.img
  
The sha1, md5 and sha256 sums of the zipped image are:
 
$ sha1sum hivetool080rc5.img.zip
 
0587f2544f525c4bcd6f70d42e5ef60acc0275d2  hivetool080rc5.img.zip
 
 
$ md5sum hivetool080rc5.img.zip
 
90940d4c80673e7f4fd305bff607a78d  hivetool080rc5.img.zip
 
 
$ openssl dgst -sha256 -hex hivetool080rc5.img.zip
 
SHA256(hivetool080rc5.img.zip)= e9c68ceb0d0dbc9912ed82d541a1aa84b54139bf3bf1498c5b67f6c4849669d3
 
  
 +
# md5sum hivetool081rc1.img.zip
 +
58c68a92b673aadb635b0a044ce77b8d  hivetool081rc1.img.zip
 +
 +
The main purpose of this release is to fix the boot loader in version 0.8.0 that is incompatible with the Pi 3+.  The image would fail to boot and freeze with a lightning bolt on the  screen and a flashing red LED.  See:
 +
https://www.raspberrypi.org/forums/viewtopic.php?t=58151
  
The sha1, md5 and sha256 sums of the expanded image are:
+
WARNING:  This is rc 1.  The TEMPerHUM, Adam CPW200plus, TSL2561 drivers have not been tested yet (but nobody uses them and this fix needs to go out.)
  
$ sha1sum hivetool080rc5.img
+
==BUGS==
efc01cdfc47fe4b00c74178e994d03e07af4c5b1  hivetool080rc5.img
+
These are know problems in 0.8.0 and assumed here.
+
#The python drivers for the HX711 do not work on the PI Zero (use wiringPi driver instead).
$ md5sum hivetool080rc5.img
+
#MEMS microphone doesn't work
fb1ec65e4ca3a9ea0846b18af870c6e0  hivetool080rc5.img
 
 
$ openssl dgst -sha256 -hex hivetool080rc5.img
 
SHA256(hivetool080rc5.img)= 07322c1f94f78085888b02d8815f222cc2de2742ee6001b00abc4d992d4ae71f
 
  
==Feature Request==
 
#<s>Display LAN IP prominently on config (currently on status screen).</s>
 
#<s>Add RTC support</s> See [[Real Time Clock RTC]].
 
#<s>Add openOCD to talk to the BMD-301.</s> See [[BMD301]].
 
#<s>Add MEMS digital microphone modules.</s>
 
#<s>Set system timezone and time</s>
 
#<s>'''Rain Gauge''' Add digital input and counting software for rain gauge at the hive.</s>
 
#<s>Add Hivetool icon to desktop and start menu that will launch browser. Set browser home page to localhost.</s>
 
#Add Service Mode switch to flag bad data from hive manipulations.
 
#<s>Add support for metric/SI units.</s>
 
#Add NASA Data Download.
 
#<s>Load cell calibration wizard.</s>
 
#Fix graphing software.
 
#Add more help pages including sensor connector pictures.  Put the whole Hivetool wiki on the image?
 
#Add comment field to beekeeper interface to annotate the data.
 
#'''Data sampling engine'''  See [[Change: Data Acquisition]]
 
#'''Data reduction and compression.''' Change the weather updates from being downloaded to the hive computer and then uploaded to the public server to reduce the amount of data transferred when using 3G/4G communication to minimize the charges for data transfer. The beehive would send only hive data to the public server, and the public server would fetch the weather data from public sources. This would also simplify the administration when moving the hives to another location, so the client doesn’t need to be updated. In Norway it’s normal to change the location 2 times per year.  Also see [[Change: Weather Data]].
 
#Integrate HiveControl or drop it.
 
  
==Bug Fix==
 
*Auto expand image
 
init=/usr/lib/raspi-config/init_resize.sh
 
raspberrypi.stackexchange.com/questions/47773/disable-auto-file-system-expansion-in-new-jessie-image-2016-05-10
 
https://www.raspberrypi.org/forums/viewtopic.php?t=174434
 
http://blog.febo.com/wp/?p=283
 
*fix formating in line 310 hive.sh when lux is NULL
 
  printf " %s  %s  %s %.2f  %.2f  %12s\n"
 
*Change HIVETOOL_UPLOAD=YES to NO so that the IP doesn't get blacklisted before the hive is configured
 
*Make sure ntpd is running
 
No! It is not installed!
 
sudo apt-get update
 
sudo apt-get -y install ntp
 
https://www.raspberrypi.org/forums/viewtopic.php?t=192020
 
*PIGPIO library based sensor drivers quit working with the latest update.
 
  
 
==How the image was created==
 
==How the image was created==
Line 76: Line 36:
  
 
Verify the checksum:
 
Verify the checksum:
  $ openssl dgst -sha256 -hex 2017-11-29-raspbian-stretch.zip
+
  openssl dgst -sha256 -hex 2018-04-18-raspbian-stretch.zip  
+
  SHA256(2018-04-18-raspbian-stretch.zip)= 0e2922e551a895b136f2ea83d1bc0ca71e016e6d50244ba3da52bd764df5d1b6
  SHA256(2017-11-29-raspbian-stretch.zip)= 64c4103316efe2a85fd2814f2af16313abac7d4ad68e3d95ae6709e2e894cc1b
 
  
 
Unzip the image
 
Unzip the image
  $ unzip 2017-11-29-raspbian-stretch.zip
+
  unzip 2018-04-18-raspbian-stretch.zip  
  Archive:  2017-11-29-raspbian-stretch.zip
+
  Archive:  2018-04-18-raspbian-stretch.zip
inflating: 2017-11-29-raspbian-stretch.img   
+
  inflating: 2018-04-18-raspbian-stretch.img   
  
 
Copy it to the SD card  
 
Copy it to the SD card  
Line 195: Line 154:
 
  sudo cpan CGI
 
  sudo cpan CGI
  
**********************************************************************
+
Install perl DateTime module by first installing the prerequisite DateTime::Local
  ***    Is it still necessary to use apt-get instead of cpan?      ***
+
  sudo cpan DateTime::Local
  *** This was done because installing DatTime with cpan didn't work ***
+
  sudo cpan DateTime
***      I think it didn't install all the dependencies.          ***
 
**********************************************************************
 
  
Install perl DateTime module
+
So, don't have to install from a package:
 
  apt-get install libdatetime-perl
 
  apt-get install libdatetime-perl
  
Line 218: Line 175:
 
  sudo ln -s /home/hivetool/hivetool.log /var/www/html
 
  sudo ln -s /home/hivetool/hivetool.log /var/www/html
 
  sudo ln -s /tmp/hive.xml /var/www/html
 
  sudo ln -s /tmp/hive.xml /var/www/html
 
===Patch perl module GD::Graph===
 
 
'''''It appears this has finally been fixed as it is working without doing the step.  YES!'''''
 
 
The Perl Module, GD::Graph needs a patch to correctly draw a graph with two y axes. Note that the  target directory changes with each new perl version. This time it is 5.20.2.  Copy the patched file to it's proper location:
 
 
sudo cp /home/downloads/axestype.pm  /usr/local/share/perl/5.20.2/GD/Graph/
 
  
 
===Web Server===
 
===Web Server===
Line 359: Line 308:
 
  sudo ldconfig
 
  sudo ldconfig
  
===Install Broadcom 2835 Library ver 1.5===
+
===Install Broadcom 2835 Library ver 1.55===
 
Download the bcm2835 library and save it in /home/downloads
 
Download the bcm2835 library and save it in /home/downloads
http://www.airspayce.com/mikem/bcm2835/bcm2835-1.52.tar.gz
+
http://www.airspayce.com/mikem/bcm2835/
 +
 
 +
bcm2835-1.55.tar.gz
  
 
extract the tarball, compile and install it:
 
extract the tarball, compile and install it:
 
  cd /home/downloads
 
  cd /home/downloads
  tar xvfz bcm2835-1.5.tar.gz
+
  tar xvfz bcm2835-1.55.tar.gz
  cd bcm2835-1.52
+
  cd bcm2835-1.55
 
  ./configure
 
  ./configure
 
  make
 
  make
Line 372: Line 323:
 
  sudo make install
 
  sudo make install
  
=== Install wiringPi library ver 2.32===
+
=== Install wiringPi library ver 2.46===
 
#get wiringPi code from github and compile it
 
#get wiringPi code from github and compile it
 
#: cd /home/downloads
 
#: cd /home/downloads
Line 383: Line 334:
  
 
  gpio -v
 
  gpio -v
  gpio version: 2.44
+
  gpio version: 2.46
 
  Copyright (c) 2012-2017 Gordon Henderson
 
  Copyright (c) 2012-2017 Gordon Henderson
  
Line 416: Line 367:
 
#Download the DHT11/21/22/33/44 Sensor code from http://abyz.co.uk/rpi/pigpio/code/DHTXXD.zip
 
#Download the DHT11/21/22/33/44 Sensor code from http://abyz.co.uk/rpi/pigpio/code/DHTXXD.zip
 
#Unzip
 
#Unzip
 +
/home/downloads/DHTxx# unzip DHTXXD.zip
 +
Archive:  DHTXXD.zip
 +
  inflating: DHTXXD.c               
 +
  inflating: DHTXXD.h               
 +
  inflating: DHTXXD_README         
 +
  inflating: test_DHTXXD.c   
 
#compile
 
#compile
 
+
gcc -Wall -pthread -o DHTXXD test_DHTXXD.c DHTXXD.c -lpigpiod_if2
 
Note that this code uses the Broadcom GPIO numbering so  
 
Note that this code uses the Broadcom GPIO numbering so  
 
Ras Pi GPIO 2  <=> Broadcom GPIO 27
 
Ras Pi GPIO 2  <=> Broadcom GPIO 27
 
Ras Pi GPIO 3  <=> Broadcom GPIO 22
 
Ras Pi GPIO 3  <=> Broadcom GPIO 22
 
  
 
===HX711 weight ADC===
 
===HX711 weight ADC===
Line 438: Line 394:
 
#To read the battery voltage, copy hx711wp_chanB command to /usr/local/bin:
 
#To read the battery voltage, copy hx711wp_chanB command to /usr/local/bin:
 
#: sudo cp hx711wp_chanB /usr/local/bin/hx711wp_chanB
 
#: sudo cp hx711wp_chanB /usr/local/bin/hx711wp_chanB
 +
 +
 +
===TSL2561===
 +
 +
/home/downloads/2561# cp tsl2561/2561 /usr/local/bin
  
  
Line 624: Line 585:
  
 
  cd  /home/pi/Desktop/
 
  cd  /home/pi/Desktop/
 +
 +
 +
[Desktop Entry]
 +
Name=HiveTool Local
 +
Comment=Hive Monitor
 +
Icon=/usr/share/icons/hicolor/32x32/apps/hivetool.org
 +
Exec=chromium-browser %U localhost/hive_stats5n.pl
 +
Type=Application
 +
Encoding=UTF-8
 +
Terminal=false
 +
Categories=None;
  
 
==Write Image==
 
==Write Image==
 +
 +
# dd bs=4M of=hivetool081rc1.img if=/dev/sdb
 +
1895+0 records in
 +
1895+0 records out
 +
7948206080 bytes (7.9 GB, 7.4 GiB) copied, 198.934 s, 40.0 MB/s
 +
 +
 +
ls -l
 +
total 7761932
 +
-rw-r--r-- 1 root root 7948206080 May 15 20:53 hivetool081rc1.img
 +
-rwxr-xr-x 1 root root      4592 May 15 20:56 shrink_image.sh
 +
 +
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# md5sum hivetool081rc1.img
 +
9b49e369153edab9a7b46511593dca62  hivetool081rc1.img
 +
 +
md5sum hivetool081rc1.img
 +
9b49e369153edab9a7b46511593dca62  hivetool081rc1.img
 +
 +
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# ./shrink_image.sh hivetool081rc1.img
 +
Creating new /etc/rc.local
 +
rootfs: 217784/477664 files (0.2% non-contiguous), 1412143/1928192 blocks
 +
resize2fs 1.43.4 (31-Jan-2017)
 +
resize2fs 1.43.4 (31-Jan-2017)
 +
Resizing the filesystem on /dev/loop0 to 1572988 (4k) blocks.
 +
Begin pass 2 (max = 34305)
 +
Relocating blocks            XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 +
Begin pass 3 (max = 59)
 +
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 +
Begin pass 4 (max = 25361)
 +
Updating inode references    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 +
The filesystem on /dev/loop0 is now 1572864 (4k) blocks long.
 +
 +
Shrunk hivetool081rc1.img from 7.5G to 6.1G
 +
 +
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1#
 +
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# ls -l
 +
total 6341120
 +
-rw-r--r-- 1 root root 6493291008 May 15 21:17 hivetool081rc1.img
 +
-rwxr-xr-x 1 root root      4592 May 15 20:56 shrink_image.sh
 +
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# md5sum hivetool081rc1.img
 +
4b99b40c9e136180f3e19ee081f35a51  hivetool081rc1.img
 +
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# zip hivetool081rc1.img.zip hivetool081rc1.img
 +
  adding: hivetool081rc1.img (deflated 62%)
 +
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# ls -l
 +
total 8782212
 +
-rw-r--r-- 1 root root 6493291008 May 15 21:17 hivetool081rc1.img
 +
-rw-r--r-- 1 root root 2499670609 May 15 21:26 hivetool081rc1.img.zip
 +
-rwxr-xr-x 1 root root      4592 May 15 20:56 shrink_image.sh
 +
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1#
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 
Copy the image to another computer:  
 
Copy the image to another computer:  
  

Latest revision as of 10:01, 25 May 2018

WARNING: Please use version 0.8.3.


The HiveTool image version 0.8.1 Release Candidate 1 for the Raspberry Pi is available for download at:

https://drive.google.com/file/d/1VqaEclr69SIgZLA6sbyahpniUwuBrfEN/view?usp=sharing

The sizes of the compressed and unzipped file:

-rw-r--r-- 1 root root 2499670609 May 15 21:26 hivetool081rc1.img.zip
-rw-r--r-- 1 root root 6493291008 May 15 21:17 hivetool081rc1.img


# md5sum hivetool081rc1.img.zip
58c68a92b673aadb635b0a044ce77b8d  hivetool081rc1.img.zip

The main purpose of this release is to fix the boot loader in version 0.8.0 that is incompatible with the Pi 3+. The image would fail to boot and freeze with a lightning bolt on the screen and a flashing red LED. See: https://www.raspberrypi.org/forums/viewtopic.php?t=58151

WARNING: This is rc 1. The TEMPerHUM, Adam CPW200plus, TSL2561 drivers have not been tested yet (but nobody uses them and this fix needs to go out.)

BUGS

These are know problems in 0.8.0 and assumed here.

  1. The python drivers for the HX711 do not work on the PI Zero (use wiringPi driver instead).
  2. MEMS microphone doesn't work


How the image was created

Get latest Stretch image

Download, verify the SHA256 checksum, unzip, burn image.

Version: November 2017
Release date: 2017-11-29
Kernel version: 4.9
Release notes: Link

Verify the checksum:

openssl dgst -sha256 -hex 2018-04-18-raspbian-stretch.zip 
SHA256(2018-04-18-raspbian-stretch.zip)= 0e2922e551a895b136f2ea83d1bc0ca71e016e6d50244ba3da52bd764df5d1b6

Unzip the image

unzip 2018-04-18-raspbian-stretch.zip 
Archive:  2018-04-18-raspbian-stretch.zip
 inflating: 2018-04-18-raspbian-stretch.img  

Copy it to the SD card

# dd bs=40M if=2017-11-29-raspbian-stretch.img of=/dev/sdb


Boot

Stretch boots directly into the window system.

Configure Rasbian Image

Set local, time zone, keyboard, WiFi country

Configure Start Menu -> Preferences-> Raspberry Pi Configuration

Localisation:


Set Local

Language      -> English (default)
Country       -> US 
Character Set -> UTF-8  (default)
OK

Set Time Zone

Area     -> US
Location -> Eastern
OK

Set Keyboard

Country  ->  United States
Variant  ->  English (US)
OK

Set WiFi Country

Country  -> US
OK
OK
Reboot Needed Reboot Now -> Yes

Configure Interfaces

Start Menu -> Preferences-> Raspberry Pi Configuration -> Interfaces

Camera         ON
SSH            ON
VNC           OFF   Turn this off as it conflicts with xRDP
SPI            ON
I2C            ON
Serial         ON    Causes Clock Not Found error on boot but need it on for serial console?
1-Wire        OFF    Causes Hive Interface Board LED to flash in bursts
Remote GPIO   OFF

Set up Wi-Fi

1. Add your network information to /etc/wpa_supplicant/wpa_supplicant.conf. For an unencrypted open network with an ESSID of dlink:

vi /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="dlink"
key_mgmt=NONE

auth_alg=OPEN }

Update, upgrade

update your system's package list and then upgrade all your installed packages to their latest versions:

sudo apt-get update
sudo apt-get dist-upgrade

DO NOT USE rpi-update.

It may be for Whezzy, not Stretch and will break the GPIO.  It installs bleeding edge
alpha or beta firmware and will break the GPIO.

Remove packages we don't need

sudo apt-get remove --purge penguinspuzzle scratch dillo squeak-vm squeak-plugins-scratch sonic-pi netsurf-gtk netsurf-common
sudo apt-get autoremove
sudo apt-get clean
rm -rf /home/pi/python_games
sudo rm -rf /opt/minecraft-pi

https://project.altservice.com/issues/418 NO! Don't do this if you want to use the video camera: sudo rm -rf /opt/vc



Install packages we need

sudo apt-get -y install gawk bc apache2 libusb-dev libgd-graph-perl libexpat1-dev sqlite3
sudo apt-get install dh-autoreconf libudev-dev libusb-1
pi@raspberrypi:~ $  sudo apt-get install dh-autoreconf libudev-dev libusb-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libusb-1

Oops. What happened to libusb-1? Hope it is not needed ... OK, We'll go on without it ...

sudo apt-get install dh-autoreconf libudev-dev 

Install perl modules

**********************************************************************
***         CGI.pm HAS BEEN REMOVED FROM THE PERL CORE!!            ***
**********************************************************************
sudo cpan GD::Text GD::Graph Date::Format XML::Simple DBI DBD::SQLite
sudo cpan CGI

Install perl DateTime module by first installing the prerequisite DateTime::Local

sudo cpan DateTime::Local
sudo cpan DateTime

So, don't have to install from a package:

apt-get install libdatetime-perl

Install HiveTool software

Create downloads directory owned by user pi

sudo mkdir /home/downloads
sudo chown pi:pi /home/downloads


Create symbolic links to the hivetool log files:

sudo ln -s /home/hivetool/hivetool_raw.db /var/www/html
sudo ln -s /home/hivetool/hive.conf /var/www/html
sudo ln -s /home/hivetool/hivetool.log /var/www/html
sudo ln -s /tmp/hive.xml /var/www/html

Web Server

Configure apache

  1. Link the cgi.load and include.load module to mods-enabled
    ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled
    ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled
  2. 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
  3. add Includes and +ExecCGI to Options:
    sudo vi /etc/apache2/apache2.conf
    In stanza <Directory /var/www/>
    change
    Options Indexes FollowSymLinks
    to
    Options Indexes FollowSymLinks Includes ExecCGI
  4. 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
  5. Set up apache to listen on port 8080 if using port forwarding:
    sudo vi /etc/apache2/ports.conf
    add Listen 8080
  6. 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 these line in the "User privilege specification" section:

# User privilege specification
root    ALL=(ALL:ALL) ALL
www-data ALL=NOPASSWD: /home/hivetool/hive.sh
www-data ALL=NOPASSWD: /home/hivetool/hx711pyB.sh, /home/hivetool/hx711.sh, /home/hivetool/hx711b.sh
www-data ALL=NOPASSWD: /home/hivetool/HX711a128.py, /home/hivetool/hx711py.sh
www-data ALL=NOPASSWD: /home/hivetool/dht22_adafruit.sh
www-data ALL=NOPASSWD: /usr/bin/nice
www-data ALL=NOPASSWD: /home/hivetool/temperhum.sh
www-data ALL=NOPASSWD: /usr/local/bin/2591, /usr/local/bin/2561
www-data ALL=NOPASSWD: /usr/local/bin/hx711, /usr/local/bin/hx711wp_chanB, /usr/local/bin/AdafruitDHT.py, /usr/local/bin/Seeed_DHT22

Create SQLite database

cd /home/hivetool
sqlite3 hivetool_raw.db
sqlite> .read create_hivetool_sqlite.sql
sqlite> .quit

Make it writable or config.pl will fail to save to the database.

sudo chmod a+w /home/hivetool/hivetool_raw.db
sudo chmod a+w /home/hivetool

Create a symbolic link to /home/hivetool/hivetool_raw.db from /var/www/html so hive_stats.pl and hive_graphX.pl can access the database:

sudo ln -s /home/hivetool/hivetool_raw.db /var/www/html/

phpLiteAdmin ver 1.9.7.1

Install SQLite database administration tools. Download zipped file from

https://www.phpliteadmin.org/download/

and save in /home/downloads.

Unzip and move the php files to/var/www/html/admin

unzip phpLiteAdmin_v1-9-7-1.zip
sudo mkdir /var/www/html/admin
sudo mv *.php /var/www/html/admin

This is broken in Stretch - php5 has(finally) been replaced with php7 - enhanced performance: faster, less memory and security flaws fixed. Now, to see if SQLite will work with it ...YES! All is good.

sudo apt install php7.0 php7.0-cli
apt-get install php-sqlite3

https://www.raspberrypi.org/forums/viewtopic.php?t=191838 https://askubuntu.com/questions/792116/whats-the-difference-between-the-php7-0-sqlite-and-php-sqlite3-packages

Configure phpliteadmin

cd /var/www/html/htadmin/
sudo cp phpliteadmin.config.sample.php phpliteadmin.config.php
vi phpliteadmin.config.php

change

$directory = '.';  

to

$directory = '..';

Install TEMPerHUM software

sudo apt-get update
sudo apt-get install dh-autoreconf libudev-dev libusb-1.0-0-dev cmake-curses-gui
cd /home/downloads
sudo git clone git://github.com/signal11/hidapi
cd hidapi
sudo ./bootstrap
sudo ./configure
sudo make
sudo make install
cd ..
#sudo git clone git://github.com/edorfaus/TEMPered
#cd TEMPered
#sudo git clone https://github.com/rcrum003/TEMPered-v6-2015
#cd TEMPered-v6-2015

Note: For TEMPered-v6-2015 in ccmake set

HIDAPI_HEADER_DIR                /usr/local/include/hidapi
HIDAPI_LIB                       /usr/local/lib/libhidapi-hidraw.so 


git clone git://github.com/mushisushi/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

So it looks like this:

include /etc/ld.so.conf.d/*.conf
/usr/local/lib/arm-linux-gnueabihf/


Run ldconfig to pick up the new libraries

sudo ldconfig

Install Broadcom 2835 Library ver 1.55

Download the bcm2835 library and save it in /home/downloads http://www.airspayce.com/mikem/bcm2835/

bcm2835-1.55.tar.gz

extract the tarball, compile and install it:

cd /home/downloads
tar xvfz bcm2835-1.55.tar.gz
cd bcm2835-1.55
./configure
make
sudo make check
sudo make install

Install wiringPi library ver 2.46

  1. get wiringPi code from github and compile it
    cd /home/downloads
    git clone git://git.drogon.net/wiringPi
    cd wiringPi
    ./build
  2. Test
    gpio -v
    gpio readall
gpio -v
gpio version: 2.46
Copyright (c) 2012-2017 Gordon Henderson

http://wiringpi.com/download-and-install/

DHT22 Temperature/Humidity Sensor

Groove Seeed - DHT22 with modified code. Note that the code has been modified to return the temperature and humidity in floating point instead of having to divide it by 10, and a few other "improvements".

  1. Install wiringPi libraries
  2. Get the DHT22 software
    cd /home/downloads
    sudo git clone https://github.com/Seeed-Studio/Grove-RaspberryPi.git
    cd Grove-RaspberryPi/Grove\ -\ Temperature\ and\ Humidity\ Sensor\ Pro
    make
    sudo cp Seeed_DHT22 /usr/local/bin

Python DHT22 code from Adafruit

*** sudo apt-get install python-dev *** NOT NECESSARY ALREADY INSTALLED ***
cd /home/downloads
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo python setup.py install
cd examples
python AdafruitDHT.py

DHTxx Temperature/Humidity Sensor

This code uses the PiGPIO libraries (pigpiod).

  1. Download the DHT11/21/22/33/44 Sensor code from http://abyz.co.uk/rpi/pigpio/code/DHTXXD.zip
  2. Unzip
/home/downloads/DHTxx# unzip DHTXXD.zip 
Archive:  DHTXXD.zip
  inflating: DHTXXD.c                
  inflating: DHTXXD.h                
  inflating: DHTXXD_README           
  inflating: test_DHTXXD.c    
  1. compile
gcc -Wall -pthread -o DHTXXD test_DHTXXD.c DHTXXD.c -lpigpiod_if2

Note that this code uses the Broadcom GPIO numbering so Ras Pi GPIO 2 <=> Broadcom GPIO 27 Ras Pi GPIO 3 <=> Broadcom GPIO 22

HX711 weight ADC

hx711wp

Note: The original hx711 code has been modified to use the wiringPi library and a bug fixed.

  1. Download the software from gitHub
    cd /home/downloads
    sudo git clone https://github.com/ggurov/hx711
  2. replace hx711.c with hx711wp.c and add locking.h
  3. compile
    gcc -o hx711wp hx711wp.c -lwiringPi
  4. Copy hx711 command to /usr/local/bin:
    sudo cp hx711wp /usr/local/bin/hx711
  5. To read the battery voltage, copy hx711wp_chanB command to /usr/local/bin:
    sudo cp hx711wp_chanB /usr/local/bin/hx711wp_chanB


TSL2561

/home/downloads/2561# cp tsl2561/2561 /usr/local/bin


TLS2591 Lux Sensor

2591 Adafruit with modified code.

-rw-r--r-- 1 root root 10439 Aug  3 01:36 2591a.cpp
-rw-r--r-- 1 root root  3303 Aug  3 01:36 2591a.h
-rw-r--r-- 1 root root  1509 Aug  3 01:36 2591_pi_2.cpp
gcc 2591_pi_2.cpp 2591a.cpp -lwiringPi -o 2591 
cp 2591 /usr/local/bin

Add crontab entries

Edit crontab:

sudo crontab -e

Add to crontab:

#
# ### Start of Hivetool crontab entries ###
#
# start PIGPIO daemon on boot 
@reboot /usr/local/bin/pigpiod
# 
# start Data Acquisition Daemon on boot
@reboot /home/hivetool/dad7.sh
#
# 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 >/dev/null 2>&1
#
# Check the server status. Kill process after 1 minute.
4,9,14,19,24,29,34,39,44,49,54,59 * * * * timeout -s KILL 1m /home/hivetool/server_status.sh > /var/www/html/server_status.txt
#
# Reset the rain gauge at midnight
1 0 * * * timeout -s KILL 1m /home/hivetool/rain_reset.sh
#
# ### End of HiveTool crontab entries ###
#

Video

Install VLC media software. Note that for the camera to work, it must be enabled by running raspi-config.

sudo apt-get install vlc

To automatically start the video streaming using Real Time Streaming Protocol to port 8554, add to /etc/rc.local

# start video stream
su pi /home/hivetool/stream_video.sh

/home/hivetool/stream_video.sh should be:

raspivid -n -o - -t 0 -w 800 -h 400 -fps 24 |cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554}' :demux=h264

This method uses raspivid to streams video from the PiCam to vlc where is can be accessed with videoLAN, a free and open souce media player for Apple, Linux, Microsoft platforms at port 8554 using RTSP://hive.ip:8554

Access Point

sudo apt-get install hostapd isc-dhcp-server

https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software

gEDA Schematic/PCB layout software

Install the Electronic Design Automation tools

sudo apt-get update
sudo apt-get install geda
sudo apt-get install pcb
sudo apt-get install gerbv

In /home/pi/.gEDA create /home/pi/.gEDA/gschem

vi /home/pi/.gEDA/gschem

and add the following line

(component-library "/home/hardware/symbols")

Copy the schematics and PCB layouts to /home/hardware.

xrdp

NO! Don't uninstall VNC, just turn it off in the configuration

Configure Start Menu -> Preferences-> Raspberry Pi Configuration -> Interfaces

uninstall RealVNC (This is a work around as now realvnc-vnc-server comes installed and breaks xrdp. xrdp is currently favored over realvnc as xrdp works with Microsoft Windows.)

uninstall RealVNC and install xrdp

apt-get purge realvnc-vnc-server

Install xrdp for Adrian and all the Micro$oft users:

sudo apt-get install xrdp

fix mouse pointer. Create /home/pi/.xsessionrc

vi /home/pi/.xsessionrc

and add this line:

xsetroot -cursor_name left_ptr&

http://raspberrypi.stackexchange.com/questions/56413/error-problem-connecting-to-raspberry-pi-3-with-xrdp

open62541

sudo git clone git://github.com/open62541/open62541
# ### sudo apt-get install git build-essential gcc pkg-config cmake python python-lxml
sudo apt-get install cmake cmake-data python-lxml
# enable additional features
sudo apt-get install libexpat1-dev # for XML-encodingi  ### already done
sudo apt-get install liburcu-dev # for multithreading
sudo apt-get install check # for unit tests
sudo apt-get install graphviz doxygen # for documentation generation 
sudo apt-get install cmake-curses-gui
sudo cd open62541
sudo mkdir build
sudo cd build
sudo cmake ..
sudo make

# select additional features
sudo ccmake .. # enter g to build and exit
sudo make

Install touchscreen pop up keyboard support

sudo apt-get install matchbox

Install MEMS microphone I2S support

sudo apt-get install raspberrypi-kernel-headers
cd /home/downloads
git clone https://github.com/skakri/asoc-i2s-loader
cd asoc-i2s-loader
make
... to be continued ...

in /boot/config.txt

# Uncomment to enable I2S MEMs microphone 6-9-16 AO
dtparam=i2s=on

in /sys/kernel/debug/asoc/platforms get the platform and device name. Change in the asoc-i2s-loader.c

3f203000.i2s
snd-soc-dummy

in /etc/modprobe.d/raspi-blacklist.conf

blacklist snd_soc_wm8804
blacklist snd_soc_pcm512x
blacklist snd_soc_tas5713


To record:

arecord -D hw:0 -c2 -r 48000 -f S32_LE -t wav -v file.wav

Install RTC support

Edit /boot/config.txt. Add:

#enable RTC DS3231 module
dtoverlay=i2c-rtc,ds3231


Edit /lib/udev/hwclock-set and comment out these three lines:

#if [ -e /run/systemd/system ] ; then
# exit 0
#fi

Install openOCD

sudo apt-get install git autoconf libtool make pkg-config libusb-1.0-0 libusb-1.0-0-dev
git clone git://git.code.sf.net/p/openocd/code openocd-code
cd openocd-code
./bootstrap
./configure --enable-sysfsgpio --enable-bcm2835gpio
make
sudo make install

Set GPU memory

Set GPU_MEM, GPU_MEM_256, GPU_MEM_512, and GPU_MEM_1024 for different Pi models in config.txt. Maybe:

GPU_MEM=64
GPU_MEM_256=64
GPU_MEM_512=128
GPU_MEM_1024=256


Install Desktop Background and Icons

Copy the HiveTool icons to /usr/share/icons/hicolor/XXxXX/apps/

cd /home/downloads/icons
./icon.sh
cd  /home/pi/Desktop/


[Desktop Entry]
Name=HiveTool Local
Comment=Hive Monitor
Icon=/usr/share/icons/hicolor/32x32/apps/hivetool.org
Exec=chromium-browser %U localhost/hive_stats5n.pl
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;

Write Image

# dd bs=4M of=hivetool081rc1.img if=/dev/sdb
1895+0 records in
1895+0 records out
7948206080 bytes (7.9 GB, 7.4 GiB) copied, 198.934 s, 40.0 MB/s


ls -l
total 7761932
-rw-r--r-- 1 root root 7948206080 May 15 20:53 hivetool081rc1.img
-rwxr-xr-x 1 root root       4592 May 15 20:56 shrink_image.sh

root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# md5sum hivetool081rc1.img
9b49e369153edab9a7b46511593dca62  hivetool081rc1.img
md5sum hivetool081rc1.img
9b49e369153edab9a7b46511593dca62  hivetool081rc1.img
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# ./shrink_image.sh hivetool081rc1.img
Creating new /etc/rc.local
rootfs: 217784/477664 files (0.2% non-contiguous), 1412143/1928192 blocks
resize2fs 1.43.4 (31-Jan-2017)
resize2fs 1.43.4 (31-Jan-2017)
Resizing the filesystem on /dev/loop0 to 1572988 (4k) blocks.
Begin pass 2 (max = 34305)
Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 59)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 25361)
Updating inode references     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/loop0 is now 1572864 (4k) blocks long.

Shrunk hivetool081rc1.img from 7.5G to 6.1G
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# 
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# ls -l
total 6341120
-rw-r--r-- 1 root root 6493291008 May 15 21:17 hivetool081rc1.img
-rwxr-xr-x 1 root root       4592 May 15 20:56 shrink_image.sh
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# md5sum hivetool081rc1.img
4b99b40c9e136180f3e19ee081f35a51  hivetool081rc1.img
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# zip hivetool081rc1.img.zip hivetool081rc1.img
 adding: hivetool081rc1.img (deflated 62%)
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# ls -l
total 8782212
-rw-r--r-- 1 root root 6493291008 May 15 21:17 hivetool081rc1.img
-rw-r--r-- 1 root root 2499670609 May 15 21:26 hivetool081rc1.img.zip
-rwxr-xr-x 1 root root       4592 May 15 20:56 shrink_image.sh
root@debian:/home/paul/Hivetool/Backups/ver0.8.1rc1# 






Copy the image to another computer:

1. Remove the SD card from the Pi and on another computer, copy the image to a file:

dd bs=4M if=/dev/sdb of=/home/downloads/hivetool080rc2.img

2a. Shrink the image http://sirlagz.net/2013/03/10/script-automatic-rpi-image-downsizer/

./autosizer.sh hivetool080rc2.img 

2b. Or use this script to shrink the image and make it expand on initial boot:

https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh

3. Compress the image using zip:

zip hivetool080rc2.img.zip hivetool080rc2.img


bash-4.2# dd bs=40M  if=/dev/sdb of=/home/downloads/hivetool074.img
 379+1 records in
 379+1 records out
 15931539456 bytes (16 GB) copied, 596.492 s, 26.7 MB/s
# ./autosizer.sh hivetool080rc2.img
partinfo BYT; /home/downloads  /hivetool080rc2.img:15931539456B:file:512:512:msdos::;1:4194304B:47737343B:43543040B:fat32::lba;2:48234496B:15931539455B:15883304960B:ext4::;
partnumber 2
partstart 48234496
loopback /dev/loop0
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
rootfs: 197120/957712 files (0.2% non-contiguous), 1406114/3877760 blocks
resize2fs 1.42.12 (29-Aug-2014)
minsize 1599497
minsize plus 10 1600497
resize2fs 1.42.12 (29-Aug-2014)
Resizing the filesystem on /dev/loop0 to 1600497 (4k) blocks.
Begin pass 2 (max = 68187)
Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 119)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 22883)
Updating inode references     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/loop0 is now 1600497 (4k) blocks long.


# zip hivetool080rc2.img.zip hivetool080rc2.img
  adding: hivetool080rc2.img (deflated 65%)
bash-4.2# md5sum hivetool074.img.zip 
 7cdca1e73a5d81e3c70909961c6ea4b9  hivetool074.img.zip

bash-4.2# sha1sum hivetool074.img.zip 
 ff504657257fdf13905a1ad24fd2f2eab5af1562  hivetool074.img.zip
 
$ md5sum hivetool074.img
 2e26e8f266870cebcd51bf365d861559  hivetool074.img

$ sha1sum hivetool074.img
 c855c8c1175866bd52ed8143490d320011323108  hivetool074.img

$ ls -l hivetool080*
-rw-r--r-- 1 root root 6603870720 Dec 23 16:54 hivetool080rc2.img
-rw-r--r-- 1 root root 2340360521 Dec 23 17:11 hivetool080rc2.img.zip