Difference between revisions of "Create SD Image Version 0.8.4"
(→Install ffmpeg streaming software) |
(→Install wiringPi library ver 2.50) |
||
Line 197: | Line 197: | ||
− | === | + | === Test wiringPi library=== |
WiringPi is PRE-INSTALLED with standard Raspbian systems. To update (or install): | WiringPi is PRE-INSTALLED with standard Raspbian systems. To update (or install): | ||
Line 203: | Line 203: | ||
sudo apt-get install wiringpi | sudo apt-get install wiringpi | ||
+ | To test: | ||
$ gpio -v | $ gpio -v | ||
Line 218: | Line 219: | ||
http://wiringpi.com/download-and-install/ | http://wiringpi.com/download-and-install/ | ||
+ | |||
+ | To display all the I/O: | ||
+ | |||
+ | $ gpio readall | ||
===DHTxx Temperature/Humidity Sensor=== | ===DHTxx Temperature/Humidity Sensor=== |
Revision as of 14:32, 3 September 2019
Contents
- 1 Bug fixes
- 2 Features
- 3 Install gnuplot
- 4 add -r Retries option to driver wrappers
- 5 How the image was created
- 5.1 Get latest Stretch image
- 5.2 Update, upgrade
- 5.3 Remove packages we don't need
- 5.4 Install packages we need
- 5.5 Install perl modules
- 5.6 Web Server
- 5.7 Test wiringPi library
- 5.8 DHTxx Temperature/Humidity Sensor
- 5.9 TLS2591 Lux Sensor
- 5.10 phpLiteAdmin ver 1.9.7.1
- 5.11 gnuplot
- 5.12 gEDA Schematic/PCB layout software
- 5.13 Install ffmpeg streaming software
Bug fixes
- Fix problem with config.pl taking a long time to load
- Fix problem with data on charts not aligning properly.
Features
- Change graph generation to gnuplot.
- Added additional graphs for wind and battery voltage.
- Add support for BME680
- Add support for DS18B20
- Increase resolution of the weight from xxx.xx to xxx.xxx
Install gnuplot
sudo apt-get install gnuplot
add -r Retries option to driver wrappers
The maximum number of retries to read a sensor before giving up can be specified.
The shell script wrappers around the sensor drivers (dht22.sh, hx711.sh, hx711py.sh, etc) now accept a -r retries command line argument.
# # Get the command line options (which device/GPIO pin to read), maximum number of times to try reading the sensor # while getopts "d:r:" option do case "${option}" in d) DEVICE=${OPTARG};; r) MAXRETRIES=${OPTARG};; esac done # # If max number of retires not specified, default to 10 # if [ -z $MAXRETRIES ] then MAXRETRIES=10 fi #echo "DEVICE = $DEVICE" #echo "MAXRETRIES = $MAXRETRIES" # # Loop up to MAXRETRIES times trying to read the sensor # DATA_GOOD=0 COUNTER=0 while [ $COUNTER -lt $MAXRETRIES ] && [ $DATA_GOOD -eq 0 ] do
In config.pl, the -r1 option is added to the command line when the driver is called:
if ( $hive_weight_sensor eq "cpw200plus" ) { $raw_hive_weight=`/usr/bin/sudo /home/hivetool/cpw200plus.sh -r1 -d $hive_weight_device`; } elsif ( $hive_weight_sensor eq "HX711") { $raw_hive_weight=`/usr/bin/sudo /home/hivetool/hx711.sh -r1 2>&1`; } elsif ( $hive_weight_sensor eq "HX711py") { $raw_hive_weight=`/usr/bin/sudo /home/hivetool/hx711py.sh -r1 2>&1`; }
How the image was created
Get latest Stretch image
Download, verify the SHA256 checksum, unzip, burn image.
Version: November 2018 Release date: 2018-11-13 Kernel version: 4.14
Image with desktop and recommended software based on Debian Buster Version: July 2019 Release date: 2019-07-10 Kernel version: 4.19 Size: 1945 MB SHA-256: 2bd0613ec8739b6fa4274ea186ec859046f79e6aee4b8c6af0acb6d88f3f533a
Verify the checksum:
$ openssl dgst -sha256 -hex 2018-11-13-raspbian-stretch-full.zip SHA256(2018-11-13-raspbian-stretch-full.zip)= 0ca644539fdaf4e19ec7cebf9e61c049b82ba45b1a21cdec91fa54bd59d660d2
$ openssl dgst -sha256 -hex 2019-07-10-raspbian-buster-full.zip SHA256(2019-07-10-raspbian-buster-full.zip)= 2bd0613ec8739b6fa4274ea186ec859046f79e6aee4b8c6af0acb6d88f3f533a
Unzip the image
$ unzip 2018-11-13-raspbian-stretch-full.zip Archive: 2018-11-13-raspbian-stretch-full.zip inflating: 2018-11-13-raspbian-stretch-full.img
$ unzip 2019-07-10-raspbian-buster-full.zip Archive: 2019-07-10-raspbian-buster-full.zip inflating: 2019-07-10-raspbian-buster-full.img
Copy it to the SD card
# dd bs=40M if=2018-11-13-raspbian-stretch-full.img of=/dev/sdc 126+1 records in 126+1 records out 5297405952 bytes (5.3 GB, 4.9 GiB) copied, 890.612 s, 5.9 MB/s
# dd bs=40M if=2019-07-10-raspbian-buster-full.img of=/dev/sdb 153+1 records in 153+1 records out 6434062336 bytes (6.4 GB, 6.0 GiB) copied, 819.132 s, 7.9 MB/s
Boot
Stretch boots directly into the window system.
....
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
Remove packages we don't need
sudo apt-get remove --purge scratch dillo squeak-vm squeak-plugins-scratch sonic-pi sudo apt-get autoremove sudo apt-get clean rm -rf /home/pi/python_games sudo rm -rf /opt/minecraft-pi sudo apt-get remove --purge scratch dillo squeak-vm squeak-plugins-scratch sonic-pi
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 sudo apt-get install gnuplot
Install perl modules
sudo cpan CGI Date::Format XML::Simple DBI DBD::SQLite Chart::Gnuplot sudo cpan DateTime
The above cpan DateTime seemed to work. Otherwise we will use apt-get to install the perl DateTime module
apt-get install libdatetime-perl
Web Server
Configure apache
- 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
- 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 .py" so it looks like:
- AddHandler cgi-script .cgi .pl .py
- 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
- 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
- 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 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
Test wiringPi library
WiringPi is PRE-INSTALLED with standard Raspbian systems. To update (or install):
sudo apt-get install wiringpi
To test:
$ gpio -v gpio version: 2.50 Copyright (c) 2012-2018 Gordon Henderson This is free software with ABSOLUTELY NO WARRANTY. For details type: gpio -warranty Raspberry Pi Details: Type: Pi 3B+, Revision: 03, Memory: 1024MB, Maker: Sony * Device tree is enabled. *--> Raspberry Pi 3 Model B Plus Rev 1.3 * This Raspberry Pi supports user-level GPIO access.
http://wiringpi.com/download-and-install/
To display all the I/O:
$ gpio readall
DHTxx Temperature/Humidity Sensor
This code uses the PiGPIO libraries (pigpiod).
- Download the DHT11/21/22/33/44 Sensor code from http://abyz.me.uk/rpi/pigpio/code/DHTXXD.zip
- Unzip
- compile
Note that this code uses the Broadcom GPIO numbering so Ras Pi GPIO 2 <=> Broadcom GPIO 27 Ras Pi GPIO 3 <=> Broadcom GPIO 22
mkdir /home/downloads/DHTxx cd /home/downloads/DHTxx wget http://abyz.me.uk/rpi/pigpio/code/DHTXXD.zip unzip DHTXXD gcc -Wall -pthread -o DHTXXD test_DHTXXD.c DHTXXD.c -lpigpiod_if2
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
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.
mkdir /home/downloads/phpLiteAdmin cd /home/downloads/phpLiteAdmin wget https://bitbucket.org/phpliteadmin/public/downloads/phpLiteAdmin_v1-9-7-1.zip
Unzip and copy the php files to/var/www/html/admin
unzip phpLiteAdmin_v1-9-7-1.zip sudo mkdir /var/www/html/admin sudo cp *.php /var/www/html/admin
Install php
sudo apt install php7.0 php7.0-cli sudo apt-get install php-sqlite3
Configure phpliteadmin
cd /var/www/html/admin/ sudo cp phpliteadmin.config.sample.php phpliteadmin.config.php vi phpliteadmin.config.php
change
$directory = '.';
to
$directory = '..';
gnuplot
sudo apt-get install gnuplot pip install PyGnuplot
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.
Install ffmpeg streaming software
Install ffmpeg streaming software for streaming audio and video from the hive
sudo apt-get update sudo apt-get install ffmpeg sudo apt-get install ffmpeg-doc
Change /etc/ffserver.conf to:
# ### This works but needs to be optimized ### Port 8090 # bind to all IPs aliased or not BindAddress 0.0.0.0 # max number of simultaneous clients MaxClients 10 # max bandwidth per-client (kb/s) MaxBandwidth 1000 # Suppress that if you want to launch ffserver as a daemon. NoDaemon <Feed feed1.ffm> File /tmp/feed1.ffm FileMaxSize 10M </Feed> <Stream test.mjpg> Feed feed1.ffm Format mpjpeg VideoFrameRate 8 VideoSize 600x480 # VideoBitRate 80 # VideoQMin 1 # VideoQMax 100 VideoIntraOnly NoAudio Strict -1 </Stream>