Article View: es.comp.os.linux.programacion
Article #10380Re: Estacion meteorologica y PHP
From: Coco
Date: Sun, 03 Mar 2002 12:09
Date: Sun, 03 Mar 2002 12:09
277 lines
8881 bytes
8881 bytes
Hola, La estacion meteorologica es una de tipo aficionado, en particular la Oregon Scientific WMR-928. Esta estacion tiene un puerto serie unidireccional que vuelca a intervalos regulares los datos que ha obtenido de los sensores externos (comunicacion inalambrica a 433Mhz). Como ya os comente, la idea es coger esos datos, tratarlos y ponerlos en internet a intervalos regulares, p.e. cada 15 minutos o media hora. La captura de datos no la veo excesivamente problematica, simplemente "cazando" el tty y volcando el trafico a un fichero. Lo mas complicadito es transformar los datos (mas abajo teneis la descripcion del protocolo para que os hagais una idea) en algo "human readable", despues lo pasaria a una DBase SQL. Ultimo paso, extraer los datos de la SQL, p.e. velocidad media del viento en los ultimos quince minutos, velocidad maxima en las ultimas 24 horas, etc. Y lo mas dificil, crear los graficos GIF o Jpeg que ilustren graficamente los datos obtenidos para situarlos en la pagina web. Chicos, gracias por la respues y aqui estamos... Tomas ************************************************************************************ Protocol of the WMR918 weather Station(4) ----------------------------------------- Data communication w/ the WMR918 weather station is unidirectional. i.e. the data frames are put on the serial line by the station. Each packet starts with two binary bytes of 0xFF. Each packet ends with a checksum. The type of packet is given by the third byte, and ranges from 0x00 through 0x0f. Each type of packet has a predetermined length. For example, a typical type 5 packet looks like: ff ff 05 00 09 02 47 09 dc 0c 50 79 0f The checksum is the simple addition of each byte in the packet, excluding the checksum byte, keeping only the lowest 8 bits. In all further examples, the leading "ff ff" will be omitted. The .tab output from wmr918d omits the leading "ff ff". The known packet types are: 00 - anemometer and wind related data 01 - rain guage 02 - extra sensors 03 - outside temp, humidity and dewpoint 04 - unknown 05 - inside temp, humidity, dewpoint, and baro. 06 - inside temp, humidity, dewpoint, baro for wmr968 and some wmr918's. 07 - unknown 08 - unknown 09 - unknown 0a - unknown 0b - unknown 0c - unknown 0d - unknown 0e - sequence number 0f - hourly status report The following description will attempt to use the same format as the WX200 listing by Mike Wingstrom. H is a hex digit from 0 to f. D is a decimal digit from 0 through 9. B is bit encoded, bit 3 is the high bit (0x8). Type 00 - anemometer and wind related data Byte Nibble Bit Meaning 1' W all FF 2' W all FF 0 W all 00 Anemometer data packet 1 Bx Battery status. Higher value == lower battery volt 1 xB Unknown 2 DD Gust direction, bc of 0<abc<359 degrees 3 xD Gust direction, a of 0<abc<359 degrees 3 Dx Gust speed, c of 0<ab.c<56 m/s 4 DD Gust speed, ab of 0<ab.c<56 m/s 5 DD Average speed, bc of 0<ab.c<56 m/s 6 xD Average speed, a of 0<ab.c<56 m/s 6 Bx 3 Sign of wind chill, 1 = negative 7 DD Wind chill Example: 00 00 90 01 00 00 00 07 96 Example: gust at 190 degrees, 0 m/s, average 0, wind chill 7 Celsius Type 01 - rain gauge Byte Nibble Bit Meaning 1' W all FF 2' W all FF 0 W all 01 : Rain guage packet 1 Bx Battery status. Higher value == lower battery volt 1 xB Unknown 2 DD Rain rate, bc of 0<abc<999 mm/hr 3 xD Rain rate, a of 0<abc<999 mm/hr 3 Dx Bucket tips since ?? 4 DD Rain Total, cd of 0<abcd<9999 mm (?) 5 DD Rain Total, ab of 0<abcd<9999 mm (?) 6 DD Rain Yesterday, cd of 0<abdc<9999 mm (?) 7 DD Rain Yesterday, ab of 0<abcd<9999 mm (?) 8 DD Total reset minute 9 DD Total reset hour 10 DD Total reset day 11 DD Total reset month 12 DD Total reset year Example: 01 00 92 62 02 00 00 00 15 21 09 03 00 37 Example: 292 mm/hr, 0 yesterday, 2mm total since 21:15 9-Mar-2000 Type 02 - extra sensors Byte Nibble Bit Meaning 1' W all FF 2' W all FF 0 W all 02 : Outside temp/humidity data 1 Bx Battery status. Higher value == lower battery volt 1 xB Unknown 1 xB Sensor number bit encoded, 4=3 2=2 1=1 2 DD Outside temp, bc of -?<ab.c<? Celsius 3 xD Outside temp, a of -?<ab.c<? Celsius 3 Bx 3 Sign of outside temp, 1 = negative 4 DD Relative humidity, ab of ?<ab<? percent 5 DD Dew point, ab of 0<ab<? Celsius Example: 02 81 71 00 87 05 ff Example: 7.1 Celsius, 87% humidity, dew point 5 Celsius Type 03 - outside temp, humidity and dew point Byte Nibble Bit Meaning 1' W all FF 2' W all FF 0 W all 03 : Outside temp/humidity data 1 Bx Battery status. Higher value == lower battery volt 1 xB Unknown 2 DD Outside temp, bc of -?<ab.c<? Celsius 3 xD Outside temp, a of -?<ab.c<? Celsius 3 Bx 3 Sign of outside temp, 1 = negative 4 DD Relative humidity, ab of ?<ab<? percent 5 DD Dew point, ab of 0<ab<? Celsius Example: 03 01 71 00 87 05 ff Example: 7.1 Celsius, 87% humidity, dew point 5 Celsius Type 04 - unknown Type 05 - inside temperature, humidity, dew point, and baro Byte Nibble Bit Meaning 1' W all FF 2' W all FF 0 W all 05 : Inside sensor data 1 Bx Battery status. Higher value == lower battery volt 1 xB Unknown 2 DD Inside temp, bc of -?<ab.c<? Celsius 3 xD Inside temp, a of -?<ab.c<? Celsius 3 Bx 3 Sign of temp, 1 = negative 4 DD Relative humidity, ab of ?<ab<? percent 5 DD Dew point, ab of 0<ab<? Celsius 6 HH Baro pressure, convert to decimal and add 795. mb. 7 Bx Unknown 7 xB Encoded 'tendency' 0x0c=clear 0x06=partly cloudy 0x02=cloudy 0x03=rain 8 DD Sea level reference, cd of <abc.d>. 9 DD Sea level reference, ab of <abc.d>. Add this to raw bp from byte 6 to get sea level pressure. Example: 05 00 11 02 46 09 dc 0c 50 79 16 Example: 21.1 Celsius, 46% humidity, dew point 9 Celsius BP 1015 mb, sea level pressure 1015 mb. Type 06 - inside temp, humidity, dewpoint baro for wmr968 and some wmr918's Byte Nibble Bit Meaning 1' W all FF 2' W all FF 0 W all 06 : Inside sensor data 1 Bx Battery status. Higher value == lower battery volt 1 xB Unknown 2 DD Inside temp, bc of -?<ab.c<? Celsius 3 xD Inside temp, a of -?<ab.c<? Celsius 3 Bx 3 Sign of temp, 1 = negative 4 DD Relative humidity, ab of ?<ab<? percent 5 DD Dew point, ab of 0<ab<? Celsius 6 HH Baro pressure, low byte (bc of abc) 7 xB 0 Baro pressure, a of abc. Convert abc from hex to decimal, add 600. to get mb. a is low bit only. Upper three bits may be encoded BP tendency. 7 Bx Encoded 'tendency' 0x0c=clear 0x06=partly cloudy 0x02=cloudy 0x03=rain 8 DD Sea level reference, ef of <abcd.ef>. 9 DD Sea level reference, cd of <abcd.ef>. 10 DD Sea level reference, ab of <abcd.ef> Add this to raw bp from byte 6 and 7 to get sea level pressure. Example: 06 00 29 02 41 09 8b 61 90 33 06 2e Example: 22.9 Celsius, 41% humidity, dew point 9 Celsius BP 995 mb, sea level pressure 1028.9 mb. Type E - sequence number Byte Nibble Bit Meaning 1' W all FF 2' W all FF 0 W all 0e : Sequence number packet 1 Bx Status, high bit, battery for main unit 1 DD After removing high bit, minute chime Example: 0e 81 8d Example: status = 1, time is hh:01 Type F - hourly status report Byte Nibble Bit Meaning 1' W all FF 2' W all FF 0 W al 0f : Hour Chime 1 BB Status. High bit == battery low 2 DD Hour 3 DD Day 4 DD Month 5 DD Year Example: 0f 80 07 09 03 00 a0 Example: It's 7AM, 9-March-2000, do you know where your weather station is?
Technical Details
Message-ID:
<3c8210cc.2502788@news.wanadoo.es>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!opentransit.net!newsfeed.comtenidos.com!newsfeeder.wanadoo.es!not-for-mailReferences:
<3c7ba8a4.18734176@news.wanadoo.es> <wu9f8.4635$Q5.97961@telenews.teleline.es> <3C7F3D06.6000702@yahoo.com.ar>Show Full Headers
Complete Article Headers
X-Google-Language: PORTUGUESE,ASCII-7-bit X-Google-Thread: f86c8,ba704ff3a527145b X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2002-03-03 04:11:06 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!opentransit.net!newsfeed.comtenidos.com!newsfeeder.wanadoo.es!not-for-mail From: nulo@ceuta.com (Coco) Newsgroups: es.comp.os.linux.programacion Subject: Re: Estacion meteorologica y PHP Date: Sun, 03 Mar 2002 12:09:49 GMT Organization: Wanadoo Lines: 280 Message-ID: <3c8210cc.2502788@news.wanadoo.es> References: <3c7ba8a4.18734176@news.wanadoo.es> <wu9f8.4635$Q5.97961@telenews.teleline.es> <3C7F3D06.6000702@yahoo.com.ar> NNTP-Posting-Host: 62-36-178-14.dialup.uni2.es X-Trace: news.wanadoo.es 1015157032 29852 62.36.178.14 (3 Mar 2002 12:03:52 GMT) X-Complaints-To: usenet@wanadoo.es NNTP-Posting-Date: Sun, 3 Mar 2002 12:03:52 +0000 (UTC) X-Newsreader: Forte Free Agent 1.21/32.243