Small Meteo station
Post ReplySmall Meteo stationPosted: Thursday, February 16, 2017 [16:42:31] - 1
Small Meteo station - HardwarePosted: Thursday, February 16, 2017 [18:35:03] - 2
Small Meteo station - AM2302 and BMP180 setupPosted: Thursday, February 16, 2017 [19:10:37] - 3
Setup I2C interface for BMP180: https://learn.adafruit.com/using-the-bmp085-with-raspberry-pi/configuring-the-pi-for-i2c install software from GitHub and test it. Setup AM2302: learn.adafruit.com When everything works and checked both sensors are read in one sweep by Perl and reported to the server for storing in database. use strict; our %sendfl; our $hum = `/usr/bin/python /home/pi/Desktop/meteo/humid.py 2302 4`; $hum =~ s/\n|\r|\*//g; $hum =~ s#(\-\d{1,3}\.\d{1,2}|\d{1,3}\.\d{1,2})(\s)(\d{1,3}\.\d{1,2})#$ our $temp = $1; our $humidity = $3; if($temp) { $sendfl{'temp.outside.txt'}=$temp; } else { if($temp < 1 && $temp > -1) { $sendfl{'temp.outside.txt'}=$temp; } } if($humidity) {$sendfl{'humidity.txt'}=$humidity;} our %dread; $hum = `/usr/bin/python /home/pi/Desktop/meteo/pressure.py`; while($hum =~ /(.*?)( = )(.*?)(\n)/gs) {$dread{$1} = $3;} my %fnames = ( 'Altitude','altitude', 'Pressure','pressure', 'Sealevel Pressure','sealevel.pressure', 'Temp','temperature.kitchen' ); my %dconv = ( 'Pressure','pressure', 'Sealevel Pressure', 'sealevel.pressure' ); my $sh; foreach $f (sort keys(%dread)) { ($dread{$f},$sh) = split(/ /,$dread{$f}); if($dconv{$f}) { $dread{$f} *= .00750061561303; $dread{$f} = sprintf("%0.0f",$dread{$f}); } ## END IF CONVERT REQUIRED unless($f =~ m/sealevel|altitude/i) { $sendfl{"$fnames{$f}.txt"}=$dread{$f}; } } ## Check connection to the server my $dcheck = `/bin/ping -c 1 -r -t 5 192.168.1.12`; sleep(6); unless($dcheck =~ m/1 packets transmitted\, 1 received/) { exit(0); ## Exit if there is a network problem } our $urlsendd; foreach $f (sort keys(%sendfl)) { $urlsendd = "http://user:password\@192.168.1.12/report.cgi"; $report .= `/usr/bin/curl --connect-timeout 30 -F f=$sendfl{$f} -F fn=$f $urlsendd`; $report .= " \: $sendfl{$f}\n"; } ## FOREACH FILE END if($report) { chomp $report; open(RPRT,">/home/pi/Desktop/meteo/curl.report.txt"); print RPRT "$localtime\n$report\n"; close(RPRT); } exit(0); Then Perl script added to the cron jobs for every 15 minutes run as root. As Perl runs as root, no sudo required to run Python from within Perl script to get data from GPIO pins. Output of Python scripts was a bit modified to get formatted data in Perl. |
Small Meteo station RPi framePosted: Thursday, February 16, 2017 [19:31:14] - 4
This is a 3D view of the frame for Raspberry Pi 3: Download STL file for your 3D printer: https://www.codemacs.com/downloads/frame.stl |
Small Meteo station - Spacers 3DPosted: Friday, February 17, 2017 [16:43:59] - 5
This is a 3D view of spacers used to assembly the Sun protector made of drain couplings. and STL file download for 3D printer: https://www.codemacs.com/downloads/spacers.stl This is a Home Depot parts used in this project: 1"X2' PVC PIPE 052063344072 4X3 COUPLING 4"X3" SEWER/DRAIN COUPLING D3034 PVC [email protected] $5.60 0000-225-866 4IN CAP $2.10 4" SEWER/DRAIN CAP D3034 PVC 611942038190 PVC BUSHING 1-1/4"X1" PVC BUSHING SPGXS [email protected] $2.64 SUBTOTAL $12.50 SALES TAX $0.76 TOTAL $13.26 enjoy |
RE: Small Meteo stationPosted: Friday, December 27, 2019 [13:29:16] - 6