Difference between revisions of "Create SD Image Version 0.7.4"
(→phpLiteAdmin) |
(→Install TEMPerHUM software) |
||
(54 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | ||
+ | '''Hivetool 0.7.4 image is now available''' | ||
+ | |||
+ | Download it here; | ||
+ | https://drive.google.com/file/d/0B_3xqxGS2psWWHhyMUNjbW4tSHc/view?usp=sharing | ||
+ | |||
+ | It does not include HiveControl like the HiveConTool version. | ||
+ | |||
+ | hivetool074.img 5856092672 bytes | ||
+ | hivetool074.img.zip 2474147900 bytes | ||
+ | |||
+ | md5sum hivetool074.img 2e26e8f266870cebcd51bf365d861559 | ||
+ | sha1sum hivetool074.img c855c8c1175866bd52ed8143490d320011323108 | ||
+ | |||
+ | md5sum hivetool074.img.zip 7cdca1e73a5d81e3c70909961c6ea4b9 | ||
+ | sha1sum hivetool074.img.zip ff504657257fdf13905a1ad24fd2f2eab5af1562 | ||
+ | |||
+ | |||
+ | '''Important Notes:''' | ||
+ | #May not unzip on Apple Mac using Unarchiver. | ||
+ | #Image is greater than 4 gig so it will not fit on FAT32 formatted memory device. | ||
+ | #It doesn't automatically expand to fit the memory card. | ||
+ | |||
+ | '''BUGS''' | ||
+ | #The HX711 python driver based on PIGPIO library (HX711py) doesn't work on the model A+ or B+. Use the old HX711 driver based on the wiringPI library. | ||
+ | |||
+ | |||
Line 17: | Line 43: | ||
5. Fix hive config.pl so it will insert a NULL instead on nothing in the hive_parameters table if hive elevation is left blank. | 5. Fix hive config.pl so it will insert a NULL instead on nothing in the hive_parameters table if hive elevation is left blank. | ||
+ | |||
+ | 6. Change DHT22 code to Adafruit | ||
+ | |||
+ | 7. Fix error at end of hivetool.log if hive_command.pl is not executable. | ||
=== Feature Request === | === Feature Request === | ||
− | #add latest | + | #add latest HiveControl software, debug HTML conflicts, restrict both apps from uploading |
#implement battery voltage monitoring using channel B of HX711, send it to hivetool.net and display it. | #implement battery voltage monitoring using channel B of HX711, send it to hivetool.net and display it. | ||
− | #add | + | #add ability to upgrade & update, github installer like hivecontrol, log & display current version & rev. |
+ | #send host IP and MAC addresses to hivetool.net, use MAC for registration | ||
+ | #add scale calibration layman wizard (accept current zero weight, accept known weight) | ||
+ | #add ability to auto register with online hivetool.net database, minimize server blacklisting | ||
== 0.7.3 == | == 0.7.3 == | ||
Line 33: | Line 66: | ||
=== Feature Request === | === Feature Request === | ||
− | #'''''Done''''' add Ryans Hive Controller code | + | #'''''Done''''' add Ryans Hive Controller code, not yet available in 074 |
#'''''Done''''' add xrdp, open62541 packages | #'''''Done''''' add xrdp, open62541 packages | ||
#'''''Done''''' add Data Acquisition Daemon (DAD) code | #'''''Done''''' add Data Acquisition Daemon (DAD) code | ||
Dad supports battery voltage monitoring and the rain gauge. | Dad supports battery voltage monitoring and the rain gauge. | ||
− | |||
== 0.7.2 == | == 0.7.2 == | ||
Line 94: | Line 126: | ||
http://raspberrypi.stackexchange.com/questions/4120/how-to-automatically-reconnect-wifi | http://raspberrypi.stackexchange.com/questions/4120/how-to-automatically-reconnect-wifi | ||
+ | |||
+ | === 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 | ||
+ | |||
+ | '''*** WARNING! THIS IS A BAD IDEA! IT MAY BREAK THE GPIO ***''' | ||
+ | |||
+ | rpi-update should probably only be run if you need to install the bleeding | ||
+ | edge experimental firmware. It has a history of breaking the GPIO. | ||
+ | |||
+ | Update the GPU firmware | ||
+ | sudo apt-get install rpi-update | ||
+ | sudo rpi-update | ||
=== Remove packages we don't need === | === 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 remove --purge penguinspuzzle scratch dillo squeak-vm squeak-plugins-scratch sonic-pi netsurf-gtk netsurf-common | ||
Line 108: | Line 153: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 183: | Line 223: | ||
and insert this line in the "User privilege specification" section: | 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 | + | www-data ALL=NOPASSWD: /home/hivetool/hive.sh, /home/hivetool/hx711pyB.sh, /home/hivetool/hx711.sh, /home/hivetool/HX711a128.py, /home/hivetool/hx711py.sh, /usr/local/bin/2591, /usr/local/bin/2561, /usr/bin/nice, /home/hivetool/temperhum.sh, /usr/local/bin/hx711, /usr/local/bin/Seeed_DHT22 |
===Create SQLite database=== | ===Create SQLite database=== | ||
Line 239: | Line 279: | ||
#sudo git clone https://github.com/rcrum003/TEMPered-v6-2015 | #sudo git clone https://github.com/rcrum003/TEMPered-v6-2015 | ||
#cd 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/ | git clone git://github.com/mushisushi/TEMPered/ | ||
Line 303: | Line 348: | ||
#: make | #: make | ||
#: sudo cp Seeed_DHT22 /usr/local/bin | #: sudo cp Seeed_DHT22 /usr/local/bin | ||
+ | |||
+ | Python DHT22 code from Adafruit | ||
+ | |||
+ | sudo apt-get install python-dev | ||
+ | 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). | ||
+ | |||
+ | #Download the DHT11/21/22/33/44 Sensor code from http://abyz.co.uk/rpi/pigpio/code/DHTXXD.zip | ||
+ | #Unzip | ||
+ | #Compile | ||
+ | #Test | ||
+ | |||
+ | mkdir /home/downloads/DHTxx | ||
+ | mv /home/pi/Downloads/DHTXXD.zip /home/downloads/DHTxx | ||
+ | cd /home/downloads/DHTxx | ||
+ | unzip DHTXXD.zip | ||
+ | gcc -Wall -pthread -o DHTXXD test_DHTXXD.c DHTXXD.c -lpigpiod_if2 | ||
+ | ./DHTXXD -g22 | ||
+ | ./DHTXXD -g27 | ||
+ | sudo cp DHTXXD /usr/local/bin | ||
+ | |||
+ | 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=== | ===HX711 weight ADC=== | ||
hx711wp | hx711wp | ||
− | Note: The original hx711 code has been modified to use the wiringPi library and | + | Note: The original hx711 code has been modified to use the wiringPi library and to fix 2 bugs. |
#Download the software from gitHub | #Download the software from gitHub | ||
Line 317: | Line 394: | ||
#Copy hx711 command to /usr/local/bin: | #Copy hx711 command to /usr/local/bin: | ||
#: sudo cp hx711wp /usr/local/bin/hx711 | #: sudo cp hx711wp /usr/local/bin/hx711 | ||
+ | #To read the battery voltage, copy hx711wp_chanB command to /usr/local/bin: | ||
+ | #: sudo cp hx711wp_chanB /usr/local/bin/hx711wp_chanB | ||
===TLS2591 Lux Sensor=== | ===TLS2591 Lux Sensor=== | ||
Line 336: | Line 415: | ||
# | # | ||
# Check the server status. Kill process after 1 minute. | # 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/server_status.txt | |
===Video=== | ===Video=== | ||
Install VLC media software. '''Note that for the camera to work, it must be enabled by running raspi-config.''' | Install VLC media software. '''Note that for the camera to work, it must be enabled by running raspi-config.''' | ||
− | apt-get install vlc | + | sudo apt-get install vlc |
To automatically start the video streaming using Real Time Streaming Protocol to port 8554, add to /etc/rc.local | To automatically start the video streaming using Real Time Streaming Protocol to port 8554, add to /etc/rc.local | ||
Line 353: | Line 432: | ||
===Access Point=== | ===Access Point=== | ||
− | apt-get install hostapd isc-dhcp-server | + | sudo apt-get install hostapd isc-dhcp-server |
https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software | https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software | ||
Line 364: | Line 443: | ||
sudo apt-get install gerbv | sudo apt-get install gerbv | ||
sudo apt-get install zip | sudo apt-get install zip | ||
+ | |||
===xrdp=== | ===xrdp=== | ||
− | sudo apt-get install xrdp | + | 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 | ||
+ | sudo apt-get install xrdp | ||
+ | |||
+ | fix mouse pointer | ||
+ | vi .xsessionrc | ||
+ | xsetroot -cursor_name left_ptr& | ||
+ | |||
+ | http://raspberrypi.stackexchange.com/questions/56413/error-problem-connecting-to-raspberry-pi-3-with-xrdp | ||
===open62541=== | ===open62541=== | ||
+ | |||
sudo git clone git://github.com/open62541/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 git build-essential gcc pkg-config cmake python python-lxml | ||
sudo apt-get install cmake cmake-data python-lxml | sudo apt-get install cmake cmake-data python-lxml | ||
Line 386: | Line 479: | ||
sudo make | sudo make | ||
− | + | select additional features | |
− | sudo ccmake .. | + | sudo ccmake .. |
+ | |||
+ | press c to configure | ||
+ | press g to generate and exit | ||
sudo make | sudo make | ||
Line 394: | Line 490: | ||
sudo apt-get install matchbox | sudo apt-get install matchbox | ||
+ | ===Install I2S support=== | ||
+ | In /boot/config.txt uncomment dtparam=i2s=on: | ||
+ | |||
+ | sudo vi /boot/config.txt | ||
+ | # Uncomment to enable I2S MEMs microphone 6-9-16 AO | ||
+ | dtparam=i2s=on | ||
+ | |||
+ | sudo reboot | ||
+ | |||
+ | Get asoc-i2s-loader code: | ||
+ | cd /home/downloads | ||
+ | git clone https://github.com/skakri/asoc-i2s-loader | ||
+ | cd asoc-i2s-loader | ||
+ | |||
+ | |||
+ | In /sys/kernel/debug/asoc/platforms get the platform and device name. | ||
+ | cat /sys/kernel/debug/asoc/platforms | ||
+ | 3f203000.i2s | ||
+ | snd-soc-dummy | ||
+ | |||
+ | '''Note: assoc/platform will not exist until dtparam=i2s=on is uncommented and the system rebooted!''' | ||
+ | |||
+ | In asoc-i2s-loader.c change .platform = "20203000.i2s" to 3f203000.i2s (two places) | ||
+ | |||
+ | Install the kernel headers to compile and the compile: | ||
+ | sudo apt-get install raspberrypi-kernel-header | ||
+ | make | ||
+ | |||
+ | 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 Hivecontrol=== | ===Install Hivecontrol=== | ||
Line 411: | Line 543: | ||
1. Remove the SD card from the Pi and on another computer, copy the image to a file: | 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/ | + | dd bs=4M if=/dev/sdb of=/home/downloads/hivetool080rc2.img |
2. Shrink the image: | 2. Shrink the image: | ||
http://sirlagz.net/2013/03/10/script-automatic-rpi-image-downsizer/ | http://sirlagz.net/2013/03/10/script-automatic-rpi-image-downsizer/ | ||
3. Compress the image using zip: | 3. Compress the image using zip: | ||
− | zip | + | zip hivetool080rc2.img.zip hivetool080rc2.img |
+ | |||
+ | |||
+ | bash-4.2# dd bs=40M if=/dev/sdb of=/home/downloads/hivetool080rc2.img | ||
+ | 379+1 records in | ||
+ | 379+1 records out | ||
+ | 15931539456 bytes (16 GB) copied, 596.492 s, 26.7 MB/s | ||
+ | |||
+ | ./autosizer.sh hivetool074.img | ||
+ | e2fsck 1.42.6 (21-Sep-2012) | ||
+ | Pass 1: Checking inodes, blocks, and sizes | ||
+ | Inodes that were part of a corrupted orphan linked list found. Fix<y>? yes | ||
+ | Inode 13283 was part of the orphaned inode list. FIXED. | ||
+ | ... | ||
+ | Inode 392946 was part of the orphaned inode list. FIXED. | ||
+ | Pass 2: Checking directory structure | ||
+ | Pass 3: Checking directory connectivity | ||
+ | Pass 4: Checking reference counts | ||
+ | Pass 5: Checking group summary information | ||
+ | |||
+ | /dev/loop0: ***** FILE SYSTEM WAS MODIFIED ***** | ||
+ | /dev/loop0: 141123/971040 files (0.2% non-contiguous), 1308188/3872384 blocks | ||
+ | resize2fs 1.42.6 (21-Sep-2012) | ||
+ | resize2fs 1.42.6 (21-Sep-2012) | ||
+ | Resizing the filesystem on /dev/loop0 to 1412558 (4k) blocks. | ||
+ | Begin pass 2 (max = 420793) | ||
+ | Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
+ | Begin pass 3 (max = 119) | ||
+ | Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
+ | Begin pass 4 (max = 14259) | ||
+ | Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
+ | The filesystem on /dev/loop0 is now 1412558 blocks long. | ||
+ | |||
+ | # zip hivetool080rc2.img.zip hivetool080rc2.img | ||
+ | adding: hivetool080rc2.img | ||
+ | |||
+ | (deflated 58%) | ||
+ | |||
+ | bash-4.2# md5sum hivetool080rc2.img.zip | ||
+ | 7cdca1e73a5d81e3c70909961c6ea4b9 hivetool080rc2.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 hivetool074* | ||
+ | -rw-r--r-- 1 root root 5856092672 Feb 21 20:01 hivetool074.img | ||
+ | -rw-r--r-- 1 root root 2474147900 Feb 21 20:07 hivetool074.img.zip |
Latest revision as of 22:04, 14 December 2017
Hivetool 0.7.4 image is now available
Download it here; https://drive.google.com/file/d/0B_3xqxGS2psWWHhyMUNjbW4tSHc/view?usp=sharing
It does not include HiveControl like the HiveConTool version.
hivetool074.img 5856092672 bytes hivetool074.img.zip 2474147900 bytes md5sum hivetool074.img 2e26e8f266870cebcd51bf365d861559 sha1sum hivetool074.img c855c8c1175866bd52ed8143490d320011323108 md5sum hivetool074.img.zip 7cdca1e73a5d81e3c70909961c6ea4b9 sha1sum hivetool074.img.zip ff504657257fdf13905a1ad24fd2f2eab5af1562
Important Notes:
- May not unzip on Apple Mac using Unarchiver.
- Image is greater than 4 gig so it will not fit on FAT32 formatted memory device.
- It doesn't automatically expand to fit the memory card.
BUGS
- The HX711 python driver based on PIGPIO library (HX711py) doesn't work on the model A+ or B+. Use the old HX711 driver based on the wiringPI library.
Contents
- 1 0.7.4
- 2 0.7.3
- 3 0.7.2
- 4 How the image was created
- 4.1 Get latest Jessie image
- 4.2 Set up Wi-Fi
- 4.3 Update, upgrade
- 4.4 Remove packages we don't need
- 4.5 Install packages we need
- 4.6 Install perl modules
- 4.7 Install HiveTool software
- 4.8 Patch perl module GD::Graph
- 4.9 Web Server
- 4.10 Create SQLite database
- 4.11 phpLiteAdmin ver 1.9.6
- 4.12 Install TEMPerHUM software
- 4.13 Install Broadcom 2835 Library ver 1.5
- 4.14 Install i2c support
- 4.15 Install wiringPi library ver 2.32
- 4.16 DHT22 Temperature/Humidity Sensor
- 4.17 DHTxx Temperature/Humidity Sensor
- 4.18 HX711 weight ADC
- 4.19 TLS2591 Lux Sensor
- 4.20 Add crontab entries
- 4.21 Video
- 4.22 Access Point
- 4.23 gEDA Schematic/PCB layout software
- 4.24 xrdp
- 4.25 open62541
- 4.26 Install touchscreen pop up keyboard support
- 4.27 Install I2S support
- 4.28 Install Hivecontrol
- 4.29 Install Desktop Background and Icons
- 5 Write Image
0.7.4
Bug Fixes
1. 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
2. Put sanity checks, retrying, and error logging in dht22.sh to prevent bad readings from DHT22. See http://hivetool.org/d/comment/151#comment-151 for details.
3, Update the SQL database creation scripts to reflect the new schema with battery voltage.
4. Use hive_stats3wDownload.pl and NOT hive_stats4wDownload.
5. Fix hive config.pl so it will insert a NULL instead on nothing in the hive_parameters table if hive elevation is left blank.
6. Change DHT22 code to Adafruit
7. Fix error at end of hivetool.log if hive_command.pl is not executable.
Feature Request
- add latest HiveControl software, debug HTML conflicts, restrict both apps from uploading
- implement battery voltage monitoring using channel B of HX711, send it to hivetool.net and display it.
- add ability to upgrade & update, github installer like hivecontrol, log & display current version & rev.
- send host IP and MAC addresses to hivetool.net, use MAC for registration
- add scale calibration layman wizard (accept current zero weight, accept known weight)
- add ability to auto register with online hivetool.net database, minimize server blacklisting
0.7.3
Bug Fixes
- Done replace hx711 and dth22 code with fixed versions.
- Done add export LC_NUMERIC="en_US.UTF-8" to hive.sh
- Done don't remove python tools when removing bloatware. Keep: wolfram-engine - a scientific platform, Idle and Idle3 - python language editors
Feature Request
- Done add Ryans Hive Controller code, not yet available in 074
- Done add xrdp, open62541 packages
- Done add Data Acquisition Daemon (DAD) code
Dad supports battery voltage monitoring and the rain gauge.
0.7.2
- Done Test most recent raspbian distro Jessie (4.1 Kernel)
- Done Removal of bloatware from Raspbian (games, educational, etc.)
- Done Hivetool Support Pi & Pi2 (auto detect preferred)
- Automatic removal of erroneous data from sensors
- Done 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.
- Done 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?
- Done Enable i2c & serial.
How the image was created
Get latest Jessie image
Download, verify the SHA-1 checksum, unzip, burn image.
Verify the checksum:
sha1sum 2016-05-10-raspbian-jessie.zip 66a50545358e80229d77ebba89ab01f1c0fb4a02
Unzip the image and copy it to the SD card
unzip 2016-05-10-raspbian-jessie.zip dd bs=4M if=2016-05-10-raspbian-jessie.img of=/dev/sdb
Boot
Jessie boots directly into the window system. Menu -> Preferences->Raspberry Pi Configuration
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 }
2. Wi-Fi auto reconnect to AP
Go to /etc/ifplugd/action.d/ and copy the ifupdown file to ifupdown.org
cp /etc/ifplugd/action.d/ifupdown /etc/ifplugd/action.d/ifupdown.org
Then copy the ifupdown.sh script provided with wpa supplicant to /etc/ifplugd/action.d/
cp /etc/wpa_supplicant/ifupdown.sh /etc/ifplugd/action.d/ifupdown
http://raspberrypi.stackexchange.com/questions/4120/how-to-automatically-reconnect-wifi
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
*** WARNING! THIS IS A BAD IDEA! IT MAY BREAK THE GPIO ***
rpi-update should probably only be run if you need to install the bleeding edge experimental firmware. It has a history of breaking the GPIO.
Update the GPU firmware
sudo apt-get install rpi-update sudo rpi-update
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
sudo cpan GD::Text GD::Graph Date::Format XML::Simple DBI DBD::SQLite
Install HiveTool software
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
Patch perl module GD::Graph
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
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 so it looks like:
- AddHandler cgi-script .cgi .pl
- 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 this line in the "User privilege specification" section:
www-data ALL=NOPASSWD: /home/hivetool/hive.sh, /home/hivetool/hx711pyB.sh, /home/hivetool/hx711.sh, /home/hivetool/HX711a128.py, /home/hivetool/hx711py.sh, /usr/local/bin/2591, /usr/local/bin/2561, /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
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.6
Install SQLite database administration tools. https://www.phpliteadmin.org/download/
sudo apt-get install php5 php5-sqlite cd /var/www/html sudo mkdir admin cd admin sudo cp /home/downloads/phpLiteAdmin_v1-9-6.zip . sudo unzip phpLiteAdmin_v1-9-6.zip
http://www.raspitux.de/en/using-phpliteadmin-with-raspberry-pi/#respond
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.5
Download and install the bcm2835 library: https://gist.github.com/annem/3183536
cd /home/downloads wget http://67.192.60.197/mikem/bcm2835/bcm2835-1.5.tar.gz tar xvfz bcm2835-1.5.tar.gz cd bcm2835-1.5 ./configure make sudo make check sudo make install
Install i2c support
- Install i2c tools
- apt-get install i2c-tools
- run raspi-config and turn on i2c
Install wiringPi library ver 2.32
- get wiringPi code from github and compile it
- cd /home/downloads
- git clone git://git.drogon.net/wiringPi
- cd wiringPi
- ./build
- Test
- gpio -v
- gpio readall
gpio -v gpio version: 2.32 Copyright (c) 2012-2015 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".
- Install wiringPi libraries
- 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 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).
- Download the DHT11/21/22/33/44 Sensor code from http://abyz.co.uk/rpi/pigpio/code/DHTXXD.zip
- Unzip
- Compile
- Test
mkdir /home/downloads/DHTxx mv /home/pi/Downloads/DHTXXD.zip /home/downloads/DHTxx cd /home/downloads/DHTxx unzip DHTXXD.zip gcc -Wall -pthread -o DHTXXD test_DHTXXD.c DHTXXD.c -lpigpiod_if2 ./DHTXXD -g22 ./DHTXXD -g27 sudo cp DHTXXD /usr/local/bin
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 to fix 2 bugs.
- Download the software from gitHub
- cd /home/downloads
- sudo git clone https://github.com/ggurov/hx711
- replace hx711.c with hx711wp.c and add locking.h
- compile
- gcc -o hx711wp hx711wp.c -lwiringPi
- Copy hx711 command to /usr/local/bin:
- sudo cp hx711wp /usr/local/bin/hx711
- To read the battery voltage, copy hx711wp_chanB command to /usr/local/bin:
- sudo cp hx711wp_chanB /usr/local/bin/hx711wp_chanB
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:
# 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. 4,9,14,19,24,29,34,39,44,49,54,59 * * * * timeout -s KILL 1m /home/hivetool/server_status.sh > /var/www/server_status.txt
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
sudo apt-get update sudo apt-get install geda sudo apt-get install pcb sudo apt-get install gerbv sudo apt-get install zip
xrdp
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 sudo apt-get install xrdp
fix mouse pointer
vi .xsessionrc xsetroot -cursor_name left_ptr&
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 cd open62541 sudo mkdir build sudo cd build sudo cmake .. sudo make
select additional features
sudo ccmake ..
press c to configure press g to generate and exit
sudo make
Install touchscreen pop up keyboard support
sudo apt-get install matchbox
Install I2S support
In /boot/config.txt uncomment dtparam=i2s=on:
sudo vi /boot/config.txt # Uncomment to enable I2S MEMs microphone 6-9-16 AO dtparam=i2s=on sudo reboot
Get asoc-i2s-loader code:
cd /home/downloads git clone https://github.com/skakri/asoc-i2s-loader cd asoc-i2s-loader
In /sys/kernel/debug/asoc/platforms get the platform and device name.
cat /sys/kernel/debug/asoc/platforms 3f203000.i2s snd-soc-dummy
Note: assoc/platform will not exist until dtparam=i2s=on is uncommented and the system rebooted!
In asoc-i2s-loader.c change .platform = "20203000.i2s" to 3f203000.i2s (two places)
Install the kernel headers to compile and the compile:
sudo apt-get install raspberrypi-kernel-header make
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 Hivecontrol
- Download
- Unzip in /home/hivetool2.
- Copy /home/hivetool2/www/public_html/ files to /var/www/html/hivecontrol
- Set up virtual host on port 81
- Add path to phpSQLiteadmin to database file.
hive-data.db -> /home/HiveControl-master/data/hive-data.db
This may not be right, should link to /home/hivetool2?
Install Desktop Background and Icons
Write Image
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
2. Shrink the image:
http://sirlagz.net/2013/03/10/script-automatic-rpi-image-downsizer/
3. Compress the image using zip:
zip hivetool080rc2.img.zip hivetool080rc2.img
bash-4.2# dd bs=40M if=/dev/sdb of=/home/downloads/hivetool080rc2.img 379+1 records in 379+1 records out 15931539456 bytes (16 GB) copied, 596.492 s, 26.7 MB/s
./autosizer.sh hivetool074.img
e2fsck 1.42.6 (21-Sep-2012) Pass 1: Checking inodes, blocks, and sizes Inodes that were part of a corrupted orphan linked list found. Fix<y>? yes Inode 13283 was part of the orphaned inode list. FIXED.
...
Inode 392946 was part of the orphaned inode list. FIXED. Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information
/dev/loop0: ***** FILE SYSTEM WAS MODIFIED ***** /dev/loop0: 141123/971040 files (0.2% non-contiguous), 1308188/3872384 blocks resize2fs 1.42.6 (21-Sep-2012) resize2fs 1.42.6 (21-Sep-2012) Resizing the filesystem on /dev/loop0 to 1412558 (4k) blocks. Begin pass 2 (max = 420793) Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 3 (max = 119) Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 4 (max = 14259) Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The filesystem on /dev/loop0 is now 1412558 blocks long.
# zip hivetool080rc2.img.zip hivetool080rc2.img adding: hivetool080rc2.img (deflated 58%)
bash-4.2# md5sum hivetool080rc2.img.zip 7cdca1e73a5d81e3c70909961c6ea4b9 hivetool080rc2.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 hivetool074* -rw-r--r-- 1 root root 5856092672 Feb 21 20:01 hivetool074.img -rw-r--r-- 1 root root 2474147900 Feb 21 20:07 hivetool074.img.zip