Wetterstation
Version vom 23. Juni 2007, 23:10 Uhr von MegaDave (Diskussion | Beiträge)
Hier ein Howto wie man eine Wetterstation unter Linux betreibt. Als Modell wurde eine ws2300 genommen.
Was benötigt wird
- serieller oder usb Anschluss
- Webserver (apache oder lighthttp)
- PHP (4 oder höher)
- MySQL (optional)
Installation
- Programmcode runterladen und installieren
cd ~ wget http://puzzle.dl.sourceforge.net/sourceforge/open2300/open2300-1.10.tar.gz tar -xvzf open2300-1.10.tar.gz make all make install
- folgende Programme werden dadurch nach /usr/local/bin installiert:
log2300
- Schreibt die aktuellen Messwerte in eine Datei zur Weiterverarbeitung z.B. mittels Perl oder PHP.
fetch2300
- Zur direkten Übernahme aktueller Messwerte in ein HTML-Dokument mittels PHP.
xml2300
- Holt ebenfalls die neuesten Messwerte und schreibt sie in eine XML-Datei.
mysql2300
- Wie der Name erahnen lässt, dient hier eine Datenbank als Speicherort für die neuesten Messwerte.
Konfigurieren
- zentrale einstellungen werden in der open2300.conf gemacht:
# open2300.conf # # Configuration files for open2300 weather station tools # # Default locations in which the programs will search for this file: # Programs search in this sequence: # 1. Path to config file including filename given as parameter (not supported by all tools) # 2. ./open2300.conf (current working directory) # 3. /usr/local/etc/open2300.conf (typical Linux location) # 4. /etc/open2300.conf (typical Linux location) # # All names are case sensitive!!! # Set to your serial port and time zone # For Windows use COM1, COM2, COM2 etc # For Linux use /dev/ttyS0, /dev/ttyS1 etc SERIAL_DEVICE /dev/ttyS0 # /dev/ttyS0, /dev/ttyS1, COM1, COM2 etc TIMEZONE 1 # Hours Relative to UTC. East is positive, west is negative # Units of measure (set them to your preference) # The units of measure are ignored by wu2300 and cw2300 because both requires specific units WIND_SPEED m/s # select MPH (miles/hour), m/s, or km/h TEMPERATURE C # Select C or F RAIN mm # Select mm or IN PRESSURE hPa # Select hPa, mb or INHG #### Citizens Weather variables (used only by cw2300) # Format for latitude is # [2 digit degrees][2 digit minutes].[2 decimals minutes - NOT seconds][N for north or S for south] # Format for longitude is # [3 digit degrees][2 digit minutes].[2 decimals minutes - NOT seconds][E for east or W for west] # Use leading zeros to get the format ####.##N (lat) and #####.##E (long) CITIZEN_WEATHER_ID CW0000 # CW0000 should be replaced by HAM call or actual CW number CITIZEN_WEATHER_LATITUDE 5058.00N # DDMM.mmN or S - example 55 deg, 40.23 minutes north CITIZEN_WEATHER_LONGITUDE 01119.00E # DDDMM.mmE or W - example 12 deg, 24.60 minutes east APRS_SERVER aprswest.net 23 # These are the APRS servers and ports for APRS_SERVER indiana.aprs2.net 23 # Citizens Weather reporting. APRS_SERVER newengland.aprs2.net 23 # They they are tried in the entered order APRS_SERVER aprsca.net 23 # you may enter up to 5 alternate servers ### MYSQL Settings (only used by mysql2300) MYSQL_HOST localhost # Localhost or IP address/host name MYSQL_USERNAME open2300 # Name of the MySQL user that has access to the database MYSQL_PASSWORD mysql2300 # Password for the MySQL user MYSQL_DATABASE open2300 # Named of your database MYSQL_PORT 0 # TCP/IP Port number. Zero means default
Cronjob einrichten
- öffnen der datei
vim /etc/crontab
und diese zeile am Ende anhängen
0-59/10 * * * * root /usr/local/bin/log2300 /var/www/weather_log.log
dann cron neustarten mit
/etc/init.d/crond restart
Anzeigen
open2300 bring schon eine php-website mit zum anzeigen auf dem Webserver. einfach die Dateien unter /var/www kopieren.
cd /open2300-1.10/htdocs cp cloudy.jpg falling.png rainy.jpg rising.png steady.png sunny.jpg weatherstation.php /var/www
Jetzt könnt ihr euch das Wetter ansehen unter
http://ip-adresse /weatherstation.php