Home

User Manual for HOBO Project Nicholas Lavanda Senior Software

image

Contents

1. function CheckLow 1 isNaN document getElementById txtLow value alert Please insert a numerical value for the low range document getElementById txtLow focus else CheckHigh function CheckHigh if isNaN document getElementById txtHigh value alert Please insert a numerical value for the high range document getElementById txtHigh focus else SendPost function CheckTSLow var reTS d 2 d 2 d 4 d 2 d 2 d 2 if reTS test document getElementById txtLow value trim document getElementById txtLow value alert Time stamp low range must be in the format of DD MM YYYY HH MM SS document getElementById txtLow focus else CheckTSHigh function CheckTSHigh var reTS d 2 d 2 d 4 d 2 d 2 d 2 if reTS test document getElementById txtHigh value trim document getElementById txtHigh value alert Time stamp high range must be in the format of DD MM YYYY HH MM SS document getElementById txtHigh focus else SendPost function SendPost document getElementById reg submit A function FilterGraph var count 0 if trim document getElementById txtLow value count CheckTSLowG if trim document getElementById txtHigh value count CheckTSHighG if c
2. Check to see if the sleep time was provided Exit if not if args length 2 System out println Usage HoboBuilder sleep time between updates in seconds hobo file System exit 1 else fileName args 1 sleepTime Long parseLong args 0 Check to see if a long enough time has been given While the HOBO software can be set to readout every second the amount of time it actually takes to complete the readout will around 30 secs or more if sleepTime lt 30 System out println nUpdate Cycle must be greater than 30s as that is the shortest time between readings on HOBO unit itself System exit 1 User input in seconds convert to milliseconds sleepTime 1000 Notify that the HOBO Builder process has begun by outputting to console System out println nHOBO Builder Activated at t t timeStamp n t Press CTRL C to end process n active true RR KKK KKK KKH KEK KKK KKK he hehe AAA de he ke ke AAA He He ke ke ke e e de IKK KKK KK KK e He He He KKK KEKE KKK connect to database try System out println Attempting to connect to HOBO MySQL server n nmlv2 A gt Class forName com mysql jdbc Driver newInstance con DriverManager getConnection jdbc mysql satnet fgcu edu hobo if con isClosed System out println Successfully connected to MySQL server n stmt con createStatement
3. 22 1020 1 18 666 672 2010 04 15 22 39 63 19202 186 72 1019 9 18 66 67 2 2010 04 18 22 38 53 10201 10 6 201N N4 1C 22 n II ina 18 AAI Figure 15 Screenshot of Tables Page Figure 15 is a screenshot of the tables page Under the menu a form is placed to allow the filtering of the results The following code shows how lt form id reg action tables php method get gt lt div id frmText gt The readouts listed can be filtered via the following form lt div gt lt input type hidden name page value 1 gt lt br gt lt div id frmFields gt Filter by lt select class field name selType id selType onchange Javascript CheckDisplay gt lt option value A11 gt A11 lt option gt lt option value dateTime gt Time Stamp lt option gt lt option value pressure gt Pressure lt option gt lt option value temperature gt Temperature lt option gt lt option value rh gt Relative Humidity lt option gt lt select gt lt div gt lt br gt lt div id dbHidden style display none gt In the range of lt input type text id txtLow name txtLow size 19 maxlength 19 gt to lt input type text id txtHigh name txtHigh size 19 maxlength 19 gt lt div gt lt br gt lt div id frmBtns gt lt input type button id btnFilter value Filter onmousedown Javascript Filte
4. one for each of the sensor types currently attached to the HOBO and each has its own refresh button The graph is created by the PHPGraphLib package This is done by passing a array of data to the library which will return a PNG image file The following code snippet shows an example sql SELECT dateTime pressure FROM readouts WHERE dateTime BETWEEN 1ow AND S high Sresult mysql_query sql if Sresult while row mysql fetch assoc result SdateTime Srow dateTime Spressure Srow pressure ADD TO ARRAY SdataArray SdateTime Spressure graph addData dataArray Sgraph gt setTitle Barametric Pressure Over Time Sgraph gt setRange 1200 800 Sgraph gt setBars false Sgraph gt setLine true Sgraph gt createGraph 7 2 4 Summary Page HOBO Remote Weather Monitoring Station At Florida Gulf Coast University View sensor readings online Home Graphs n Summary Report of Readings Total Number of Readings 2880 Time Period 2010 04 14 22 46 23 2010 04 15 22 45 53 Avg Pressure Avg Temperature Avg RH 1020 15 18 62 65 79 Max Pressure Max Temperature Max RH 1021 80 19 42 69 20 Min Pressure Min Temperature Min RH 1018 40 17 90 62 80 Author Nicholas Lavanda April 2020 Visit Florida Gulf Coast University Figure 17 Screenshot of the Summary page Figure 17 shows a scr
5. This method consists of using the formatting capabilities of a CSS and intelligent placing and design of the div tag By doing this it will allow the creation of separate sections and when used properly can mimic the design of a table but will be much more flexible Figure 13 shows an example of this design approach note colors chosen are used just to point out each different component more easily Figure 13 Concept Example of lt div gt based Design This design as stated before looks much like a website designed with embedded tables or frames but this example contains neither In a way it is much simpler to design albeit it requires more manual work as opposed to the table much automatic handling In order to pull this design off with tables one would have to embed tables within tables within tables and then some while the lt div gt method simply involves putting various lt div gt sections next to each other The following HTML shows and example of the pick and blue sections seen in Figure 13 above lt div id column400 gt COLUMN 400 TEST lt div gt lt div id column200 gt COLUMN 200 TEST lt div gt The id column400 points to an entry in the CSS which tells how to draw this specific lt div gt In way this may seem about as much work as a table in the end is much simpler Take the Header and the Menu for example In order to do this with tables one would have to create one table that has one colum
6. id txtLow name txtLow size 19 maxlength 19 gt and lt input type text id txtHigh name txtHigh size 19 maxlength 19 gt amp nbsp lt br gt lt input type button id btnShow value Show onmousedown Javascript FilterGraph amp nbsp input type reset id btnClear value Clear form php 1ow Shigh o if isset GET txtLow 1ow GET txtLow if isset GET txtHigh Shigh GET txtHigh echo lt div gt lt img src pgraph php txtLow Slow amp txtHigh high gt lt div gt echo lt div gt lt img src tgraph php txtLow lowg amp txtHigh high gt lt div gt echo lt div gt lt img src hgraph php txtLow lowg amp txtHigh high gt lt div gt echo lt div align right gt lt a href http www ebrueggeman com phpgraphlib gt Graphs generated by PHPGraphLib lt a gt lt div gt 2 gt 11 Appendix G summary php Displays summary report lt html gt lt head gt lt title gt HOBO Weather Montitoring Station Florida Gulf Coast Univerity lt title gt lt head gt lt body gt lt php dbhost localhost dbuser root dbpass conn mysql connect dbhost dbuser dbpass or die Error connecting to mysql dbname hobo mysql_select_db dbname php query SELECT COUNT AS numRead AVG pressure AS avgPres AVG temperature AS avgTemp AVG rh AS avgR
7. install the Onset Remote Site Manager To install this program insert the installation CD and run the setup exe program if it does not auto run There is no advanced configuration needed for this program so just remember where you install it to so you can run the program later The next program that needs to be installed is Onset s HOBOware software To install this software insert the HOBOware CD and run the setup exe program if it does not auto run HOBOware has no advanced configuration needed just remember where it is installed to so it can be run at a later time 3 HOBO Software Configuration HOBOWare There are two choices for communication with the HOBO HOBOware and Remote Site Manager For this project we will use both HOBOware and Remote Site Manager First we need to setup the data logger to record information from the sensors In order to do this we will use HOBOware Start HOBOware by double clicking on the HOBOware icon As a result a screen shown in Figure 3 appears MW HO Owatt Fie Device Eat Vew Toot Window Heb 152343 5 o0bit sorto A60 86 Figure 3 HOBOware starting screen Now at the top menu from Figure 3 go to device and select Launch This will Launch Logger screen shown in Figure 4 Launch Logger Logger Type HOBO U12 013 Temp RH Ext Ext Serial Number 756486 Deployment 40 Battery Level MOMO l Description Building A Channels to Log A Tools 1 Temperature 10K
8. 1 00 2009 10 7 Reads the text file generated by the HOBOware software The text file contains a log of the various sensor readings This version can handle a HOBO unit that has Barometic Pressure Temperature and Relative humidity sensors and the unit must have all three no less no more This data is then entered into a database no duplicate entries The user must determine the time inbetween the reads and enters via a command line parameter NOTE This program does handle the cases where the database is modifed by another source while running specifically deletion of records in the database IE records are deleted or the entire database is empty during runtime the program will not catch and continue as if the database was in the same state as the last update import import import import import public java sql java io java util java text SimpleDateFormat java text DateFormat class HoboBuilder private static boolean active public HoboBuilder public static void main String args throws SQLException String input null String fileName SimpleDateFormat gFormat new SimpleDateFormat yyyy MM dd HH mm ss java sql Timestamp recentEntry null java sql Timestamp dateTime null Double pressure Double temperature Double rh long sleepTime 0 int entryCount 0 Connection con null Statement stmt null boolean emptyDB false
9. Required field CANCEL Figure 7 Remote Site Manager software Add Site page At this screen as shown in Figure 7 you will need to give the site a name where it says Name Then from the choices for Connection Route select Local Port Now where it says COM Port select COM 1 or which serial port that you have connected the radio module to The Auto Readout Schedule will need to be setup in order for the program to auto readout To setup the auto readout select the checkbox next to Utilize Schedule Next change the Read out new data every and select CUSTOM This will allow you to select how often you would like it to sample in the column DDD HH MM Change this value to 3 minutes Now where it says Datafile path select where you would like to save the files containing the sensor data that this software is generating Once you have these parameters filled out click OK button From this screen click Connect and a screen like Figure 8 will appear This page is attempting to connect to the data logger and it should connect if the parameters are correct Modet HOOO Weyther Logger e 2001 Orsat Comouter Corporation Sordi f 541170 Put 4 H21001 Decloymert 26 Memory xk 12 Descebon November bunch Status Launched and logging data every 30 00 minutes Logger Battery eS s5 Modom Battery Primary Power Figure 8 Remote Connection page from Remote
10. entryCount 2880 rs stmt executeQuery SELECT dateTime FROM readouts ORDER BY dateTime DESC LIMIT 1 if rs next recentEntry rs getTimestamp dateTime the most recent entry do Notify that reading has begun by outputting to console System out println Updating of HOBO database Started Nt timeStamp try Open the text file containing the HOBO read out hobo txt BufferedReader in new BufferedReader new FileReader fileName Scroll past the information not needed in hobo txt for int 1 0 i lt 5 i input in readLine Scroll past the the entries already in database try do input in readLine Parse the date and time from the string StringTokenizer st new StringTokenizer input t String dateStr st nextToken String dateStrF gFormat format new java util Date dateStr dateTime new java sql Timestamp gFormat parse dateStrF getTime I no entries in database then use first in hobo txt if recentEntry null recentEntry dateTime emptyDB true break while recentEntry after dateTime catch NullPointerException e System out println nNULL POINTER Could not find a entry in the database that matched an entry in the fileName This likely means the file passed does not match the orginal file used to create the database This program is not designed to ha
11. not shown in Figure 11 dateTime is used a primary key to identify each entry as unique In order to manually check the database the user would have to have an account on the satnet server with the proper privileges granted to use mySQL After connecting to the server preferably via SSH for this case one would use the following simple command to access mySQL mysql Once connected to mySQL the following command would be used to access the specific database used for this project use hobo With the database selected the user can now directly interact with it by viewing the makeup of the table Describe readouts View entries already in Select from readouts Add entries Insert Anto readouts dateTime pressure temperature rh values vall val2 val3 val4 Remove entries DELETE FROM readouts WHERE dateTime dateToBeDeleted Update entries Update readouts SET columnName someValue WHERE someColumn somevalue There are more SOL commands to interact with the database but these provide the gist of the desired function 6 2 Database Connectivity The database is connected to from two points HoboBuilder the Java program that updates the database which is located on the server hosting the HOBO software and hardware and the website In order to connect to a database in Java a driver specific to the implantation of the database must be loaded in the program In t
12. H MAX pressure AS maxPres MAX temperature AS maxTemp MAX rh AS maxRH MIN pressure AS minPres MIN temperature AS minTemp MIN rh AS minRH MIN dateTime AS minTS MAX dateTime AS maxTS FROM readouts result mysql_ query query if result while row mysql fetch assoc result numRe row numRead avgPr row avgPres avgTe row avgTemp avgRh row avgRH maxPr row maxPres maxTe row maxTemp maxRh row maxRH minPr row minPres minTe row minTemp minRh row minRH minTS row minTS maxTS row maxTS echo h3 Summary Report of Readings lt h3 gt echo table echo lt tr gt lt td width 20 gt lt b gt Total Number of Readings lt b gt lt td gt lt td gt numRe lt td gt lt tr gt echo lt tr gt lt td width 20 gt lt b gt Time Period lt b gt lt td gt lt td colspan 2 SminTS maxTS lt td gt lt tr gt echo lt tr gt lt td gt amp nbsp lt td gt lt tr gt echo lt tr gt lt td width 20 gt lt b gt Avg Pressure lt b gt lt td gt lt td width 20 gt lt b gt Avg Temperature lt b gt lt td gt lt td width 20 gt lt b gt Avg RH lt b gt lt td gt lt tr gt echo lt tr gt lt td width 20 gt sprintf 5 2f SavgPr lt td gt lt td width 20 gt sprintf 5 2f SavgTe lt td gt lt td width 20 gt sprintf 5 2 SavgRh lt td gt lt tr gt ech
13. Site Manager If the parameters are not correct the software will tell you that it is not connected If this is the case edit your parameters to the correct ones Once you have the remote site connected to close the screen Now you will be back at a screen shown in Figure 6 Here you should see the site you just created in the Auto Readout Schedule Click on the activate box and select the correct remote site to activate to begin the automatic readout process 5 Java Based Updater HOBO Builder The HOBOware has no means of populating the database used for this project so a custom application was made Programmed in Java HOBO Builder will connect to the database and automatically keep it updated The program flowchart is shown in Appendix A and its code in Appendix B It is recommended that the HOBOBuilder java file is stored in the location you choose the Onset Remote Site Manager to save the sensor readout files After the program has been compiled it is launched from the command line console The proper syntax being an example is shown in Figure 8 java HOBOBuilder lt update interval seconds gt lt sensor readout txt file s path gt CAWINDOWSIsystem32imd exe ag x Microsoft Windows XP Version 5 1 26001 GC Copyright 1985 2661 Microsoft Corp lC Documents and Settings Nic gt cd c hobo C hobo gt jaua HOBObuilder 30 readouts txt_ Figure 8 Launching the HOBO Builder java program Once launch
14. Thermistor E Scaling 2 Relative Humidity Requires Temp Channel 1 3 CABLE 4 20mA 4 20 mA Input Cable w E O 4 TMCx HA WVide Range Temperature v 5 Logger s Battery Voltage iv Logging Interval OSH 02 Min 10 Sec Maximum logging interval 18 hours 12 min 15 sec Logging Duration 1 Day 08h 54m 40s This value is based on the logging interval Aaprox time until the and channel s selected above it does not logger memory is ful account for memory used by events Kosten epus s Now 2 11 05 3 19 50 PM GMT 05 00 At Interval 2 11 05 3 20 00 PM GMT 05 00 Delayed O 2 11 05 Date 4 19 14 PM Time Maximum delay 194 days 4 hours 20 min 15 sec Trigger O Push Logger Button for 3 Seconds TS ALAN pio sisi sore EP the launch option selected above ieiunus Launch Figure 4 Launch Logger screen from HOBOware On this screen under Channels to Log make sure all of the desired sensors that you want to log are checked It is recommended to select all of the sensors Now select how often you would like the data logger to log sensor information by changing the Logging Interval For this project we select 30 seconds Once the Logging interval is selected we need to decide on a Launch option Select the radial next to Now to start logging information immediately Once you have done this click on the Launch button at the bottom of the screen Now the program will take some time to configure the data l
15. User Manual for HOBO Project Nicholas Lavanda Senior Software Project CEN 4935 Instructor Dr J Zalewski April 15 2010 1 Hardware Configuration Working with the Onset HOBO micro weather station this project s objective is to use the sensors to detect weather conditions record this information in a database and make it available via the web The Onset HOBO micro weather station consists of a data logger a temperature sensor a relative humidity pressure sensor and two RF radio modules Figure 1 shows the different pieces of the HOBO micro weather station Pressure ond Mumidity Temperature Sensor Radio Module Radio Module Comnects to computer Figure 1 Onset HOBO micro weather station devices The sensors connect directly to the data logger Four sensors can be plugged into the data logger at one time They use a connection much like an Ethernet plug and plug into the data logger next to the batteries The remote RF radio module connects to the data logger through a custom connection The other RF radio module connects to a server through a serial port RS 232 A diagram of how these pieces are connected is shown in Figure 2 Temperature Sensor Radio Module Radio Module Connects to computer Figure 2 Diagram of how Onset HOBO micro station devices connects to each other 2 HOBO Software Installation In order to talk to the weather station one has to use Onset s proprietary software First
16. catch Exception e System err println Exception e getMessage n System out println Connection to MySQL server failed Exiting program System exit 1 BKK KKK HRI KK e e He He KKK ke e e e hehe ke ke e e He He KK kk e de KKK ke e He IKK ede He He He He He e e He He He He He He e He ke ke readouts dateTime entries in the sec sensor get the total amount of entries currently in the db ResultSet rsCount stmt executeQuery SELECT COUNT as count FROM rsCount next entryCount rsCount getInt count grab most recent entry ResultSet rs stmt executeQuery SELECT dateTime FROM readouts ORDER BY rs next to prevent a possible overload on the satnet servers the ammount of database is limited to 2880 entries or 24 hours worth of data at a 30 reading interval if entryCount gt 2880 grab the first entry java sql Timestamp initial rs getTimestamp dateTime skip ahead the total numberof entry 2880 th entry in the db int toDelete entryCount 2880 for int i toDelete i gt 0 i rs next grab the total numberof entry 2880 th entry recentEntry rs getTimestamp dateTime delete the entries from the inital date to the total numberof entry 2880 th date to reduce the number of entries to 2880 stmt executeUpdate DELETE FROM readouts WHERE dateTime BETWEEN initial AND recentEntry
17. eadouts WHERE filter BETWEEN low AND high ORDER BY dateTime DESC result mysql_ query query num mysql_numrows result i 0 echo lt h3 gt Current Weather Station Sensor Readings lt h3 gt echo lt table gt echo lt tr gt lt td width 20 b Time Stamp b td td width 20 gt lt b gt Pressure lt b gt lt td gt lt td width 20 gt lt b gt Temperature amp deg C lt b gt lt td gt lt td width 20 gt lt b gt Relative Humidity lt b gt lt td gt lt tr gt while i lt num dateTime mysql_result result i dateTime pressure mysql_result result i pressure temperature mysql result result i temperature rh mysql_result result i rh echo lt tr align right gt lt td gt dateTime lt td gt lt td gt pressure lt td gt lt td gt temperature lt td gt lt td gt rh lt td gt lt tr gt i echo lt table gt gt lt body gt lt html gt 10 Appendix F graph php Displays results in graph form lt html gt lt head gt lt title gt HOBO Weather Montitoring Station Florida Gulf Coast Univerity lt title gt lt script type text javascript src hobo js gt lt script gt lt head gt lt body gt form id reg action graph php method get gt lt div class left gt Select date range of readouts shown amp nbsp lt br gt amp nbsp amp nbsp Between lt input type text
18. eals with getting the information from the database for this website and then the data is displayed to the user via HTML enhanced with a Cascading Style Sheet Website Design 7 1 Design Direction After more thought was put into the website it s been decided to scrap the initial and current design It did not look as intended and was becoming tacky and a bit unprofessional looking see Figure 12 for a screenshot The way it was designed was also making it difficult to continue due to being originally designed not to use a CSS The converting to the use of this and the over embedded frames and tables to get the desired look gave the website very clunky code on the backend Fiter Reeuks The readouts Isted can be fibered via the followng form Fiter by Al File Reaet Current Weather Station Sensor Readings Time Stamp Pressure Temperature C Relative Homadity 11134847 10182 20 57 46 8 2 11 1348 17 1018 2 20 57 56 8 2 1 134747 10184 20 57 53 2 9 12 11 1347 17 1018 5 20 57 56 2 2 1 134647 10184 20 57 56 2 3302 12 11 1346 17 1018 3 20 57 56 8 2009 12 11 134547 1018 3 20 57 56 8 2009 12 11 1345 17 1018 3 20 57 56 8 2009 12 11 134447 111 4 2n 57 122 Figure 12 Old Scrapped Website Design The new design will take a much cleaner and professional look to it It will also be built from the ground up to use a CSS The frames and tables will also be scrapped and a different method will be used to create the layout of the website
19. eated lt div id menu gt lt div id mDBtn gt lt div id menuTxt gt lt u gt Home lt u gt lt div gt lt div gt lt div id menuSub gt lt div id menuSens gt Sensor Readouts lt div gt lt br gt lt div id mSBtn onclick window location href tables php page 1 gt lt div id menuTxtE gt lt a href tables php page 1 gt Tables lt a gt lt div gt lt div gt lt div id mSBtn onclick window location href graphs php gt lt div id menuTxtE gt lt a href graphs php gt Graphs lt a gt lt div gt lt div gt lt div id mSBtn onclick window location href summary php gt lt div id menuTxtE gt lt a href summary php gt Summary lt a gt lt div gt lt div gt lt div gt lt div id mSBtn2 onclick window location href about html gt lt div id menuTxt gt lt a href about html gt About lt a gt lt div gt lt div gt lt div gt Below the menu the most recent entry will be displayed The following code shows how lt php Sdbhost satnet fgcu edu Sdbuser nmlv2 Sdbpass Sconn mysql_connect dbhost Sdbuser Sdbpass or die Error connecting to mysql Sdbname hobo mysql_select_db dbname Squery SELECT FROM readouts ORDER BY dateTime DESC LIMIT 1 result mysql_query query Snum mysql_numrows result SdateTime if Sresult while row mysql fetc
20. ed the program can run automatically Upon successful running the screen should look similar to Figure 9 Command Prompt java HoboBuilder 30 hobo_3 txt eg X 3 Dirts gt 76 169 684 928 bytes free C Documents and Settings Nic My Documents FGCU Docs Computer Network Programmin Mlig projectX src java HoboBuilder 39 hobo_3 txt HOBO Builder Activated at 2616 62 18 22 38 36 Press CTRL C to end process attempting to connect to HOBO MySQL server Successfully connected to MySQL server Updating of HOBO database Started 2616 62 18 22 38 38 61 29 2616 11 29 01 1617 9 20 57 58 8 01 29 2018 11 29 31 1017 5 20 57 58 8 01 29 2019 11 30 81 1617 5 20 57 58 8 01 29 2018 11 30 31 1617 6 20 57 58 8 61 29 2616 11 31 01 1017 6 20 57 58 8 01 29 2010 11 31 31 1017 6 20 57 58 2 01 29 2019 11 32 61 1617 6 20 57 58 8 01 29 2010 11 32 31 1617 7 20 57 58 8 01 29 2019 11 33 01 1617 6 20 57 58 2 61 29 2616 11 33 31 1617 6 20 57 58 8 Update complete 2616 62 18 22 38 38 Figure 9 Successful launch of HOBO Builder As one can see the program will connect to the hobo mySQL database on satnet and enter the new readings These new entries will be displayed in the console window additionally The update cycle can be halted by pressing CTRL C In addition this action will also quit the program 6 Database Organization and Connections Satnet Server Wireless Receiver l Internet j Client x Client Clie
21. eenshot of the summary report page Below the menu the report is made The data is collected by one large SQL statement Squery SELECT COUNT AS numRead AVG pressure AS avgPres AVG temperature AS avgTemp AVG rh AS avgRH MAX pressure AS maxPres MAX temperature AS maxTemp MAX rh AS maxRH MIN pressure AS minPres MIN temperature AS minTemp MIN rh AS minRH MIN dateTime AS minTS S MAX dateTime AS maxTS FROM readouts Sresult mysql_query query if Sresult while Srow mysql_fetch_assoc Sresult SnumRe Srow numRead SavgPr Srow avgPres SavgTe Srow avgTemp SavgRh Srow avgRH SmaxPr Srow maxPres SmaxTe Srow maxTemp SmaxRh Srow maxRH SminPr Srow minPres SminTe Srow minTemp SminRh Srow minRH SminTS Srow minTS SmaxTS Srow maxTS Then the results are simply displayed using headers and paragraphs Also at the bottom the page on can see a footer This footer is also on every page 7 2 5 About Page Sensor Readouts Home Tables Graphs n Website This website was created as a part of a project to allow the sensor readings of a HOBO Remote Weather Station to be viewable over the web The last 2880 24hrs readings are available in the forms of a table graph and summary Project The goal of the project was to take the data collected by a HOBO Remote Weather Station which would nor
22. h_assoc result SdateTime Srow dateTime Spressure Srow pressure Stemperature Srow temperature Srh Srow rh echo lt div id dbHeader gt echo lt div id dbTimeCol gt Time Stamp lt div gt echo lt div id dbPresCol gt Pressure lt div gt echo lt div id dbTempCol gt Temperatur amp deg C lt div gt echo div id dbRHCol gt Relative Humidity lt div gt echo lt div gt if SdateTime echo lt div id dbRow0 gt echo lt div id dbTimeCol gt SdateTime lt div gt echo lt div id dbPresCol gt Spressure lt div gt echo lt div id dbTempCol gt Stemperature lt div gt echo lt div id dbRHCol gt Srh lt div gt echo lt div gt else echo lt div id dbRow0 gt echo Database empty echo lt div gt P Following that will just be headers and paragraphs of general information about the site 7 2 2 Tables Page Filter Results The readouts listed can be filtered via the following form Filter by Pressure In the range of 10185 to 10205 Fiter Reset Sensor Readouts 123456789109 9 Time Starup_____ Pressure Temperature C Relalive Humidity 2010 04 15 22 42 53 19204 dae E22 2010 04 15 22 42 23 10199 1866 672 MESSE TECA IENE NI i844 2 goose 220s dj 1844
23. hange Javascript CheckDisplay gt lt option value All All option lt option value dateTime gt Time Stamp lt option gt lt option value pressure gt Pressure lt option gt lt option value temperature gt Temperature lt option gt lt option value rh gt Relative Humidity lt option gt lt select gt amp nbsp lt br gt lt div id divID style display none gt In the range of lt input type text id txtLow name txtLow size 19 maxlength 19 gt to lt input type text id txtHigh name txtHigh size 19 maxlength 19 gt amp nbsp lt br gt lt div gt lt input type button id btnFilter value Filter onmousedown Javascript Filter gt amp nbsp lt input type reset id btnReset value Reset gt lt form gt lt php dbhost localhost dbuser root dbpass conn mysql connect dbhost dbuser dbpass or die Error connecting to mysql dbname hobo mysql select db dbname gt lt php filter if isset _GET selType filter _GET selType if isset GET txtLow 1ow GET txtLow if isset GET txtHigh high GET txtHigh if filter All filter query SELECT FROM readouts ORDER BY dateTime DESC else if filter dateTime query SELECT FROM readouts WHERE filter BETWEEN low AND high ORDER BY dateTime DESC else query SELECT FROM r
24. his case the Connector J MySQL JDBC driver is used In order to use this driver one must download and install the jar file from www MySQL com Once installed the driver is loaded in the program with the following code see Appendix C for more detailed code of the Java based updater Class forName com mysql jdbc Driver newInstance Once loaded a connection can be established by adding the following line of code Connection con DriverManager getConnection jdbc mysql hostname DB name user password In order for these two lines of code to work the java sql package must be imported To connect to the database via the website functions within PHP are used The two following lines of PHP code are used to connect to a mySQL database see appendix E for more detailed code of the website Sconn mySQL connect host Sdbuser Sdbpass or die Error MySQL select db dbname Both the mySQL_connect and mySOL_select_ db functions are built into PHP provided mySQL is enabled in the php ini The values proceeded by a S are variables in PHP that the coder would have set up Once the connections are setup SQL statements are passed to them to query the database This passing is done with PHP s mysql query function for example query SELECT FROM readouts ORDER BY dateTime DESC Sresult mysql query query In this case the SQL statement was saved to a local variable first befo
25. mally only be accessible by the computer it is connected to and make it much more accessible The methods chosen were to store the readings in a database done by writing a Java based program which would automatically enter the readings into the database Then this database would be accessed by a website i e this site LINDA Damata Ulanthaw C hatian Figure 18 Screenshot of the about page Figure 18 shows a screenshot of the About page This page just displays some information about the site project equipment used and author This is done just using simple headers and paragraphs Appendix A Troubleshooting A1 HOBO Configuration Problem Hobo Hardware is not being recognized by HOBOware Solution Sometimes usually after extended non use the software may have difficulty detecting the hardware This can generally be fixed with a combination of unplugging plugging connections and removing and reinserting batteries or other power sources much like a resetting a home router If the hardware still fails to be recognized then the problem likely lies with a dead power source or faulty hardware Problem Hobo Hardware is not being recognized by Onset Remote Manager Solution If the OK light on the data logger is flashing and everything is connected properly and the hardware is still not being detected by Onset Remote Manager then the problem is likely with the settings placed on the screen shown back in Figure 7 The Co
26. n and 2 rows The first row would be the header but then to make the menu another table with one row and six columns would have to be created in the second row To do this would lt div gt design one would just put seven lt div gt sections in no thought into embedding needed as they could just be listed like in the example above 7 2 Design Specifics The design of the website will be simple and everything will go in a single main column Colors will be soft and clean and the overall design lean more towards a minimalistic approach Any page on the site will be accessible from any other page via a menu bar 7 2 1 Home Page HOBO Remote Weather Monitoring Station At Florida Gulf Coast University Most Recent Sensor Readout 2010 04 15 22 39 53 102023 18668 67 2 Welcome Welcome to the site Here you will find the final product of a project done by the author of this website which deals with working with database usage and connectivity Figure 14 Index Page of Website Figure 14 shows a screenshot of the home page index php At the top you can see the header which displays the name of the site Below it is the menu Both of these items will on every page of the site When the mouse hovers over a button on the menu that buttons background color will darken As one can see in Figure 14 the button of the current page is further darkened and disabled from being clicked on The following code shows how the menu is cr
27. ndle this case System exit 1 if at end of file data base is up to date close else new entries to be input parse and place into databse if in ready System out println Database is already up to date in close KK He He He KKK e ke ehe IAA AAA KKK ke e dede IA AAA ARA AIA AAA ARA KKK KKK f Close Connection to database try if con null con close catch SQLException e else BRR KKK KK KH KKK KK de hehe ke e ke e he ehe KK ke e IKK KK HK KKK He e He He He He He He KKK KKK ke Check to see if database is open if con isClosed try System out println Attempting to connect to HOBO MySQL server Mn Class forName com mysql jdbc Driver newInstance DriverManager getConnection jdbc mysql satnet fgcu edu hobo connected to MySQL server n catch e getMessage n server failed Exiting program while in ready input use current StringTokenizer input t java util Date dateStr java sql Timestamp gFormat parse dateStrF con nmlv2 aai if con isClosed System out println Successfully stmt con createStatement System err println Exception Exception e System out println Connection to MySQL System exit 1 If the database is empty dont refresh if emptyDB input in readLine System
28. nnection Route setting can have problems sometimes If Local Port does work then select the Remote Modem option Simply put usually only one of this will work so it may be necessary to try the other if one does not work A2 HOBO Builder Java based Updater Problem Console displays NULL POINTER Could not find a entry in the database that matched an entry in the filename This likely means the file passed does not match the original file used to create the database This program is not designed to handle this case Solution The HOBO Builder software assumes that the readouts will always be saved to the same file If a file other than the one originally used to create the database is used then the software will fail to update the database as it will find no entries in the new readouts file which already exists in the database The prevents the program from finding a reference point on where to start the update Appendix B HOBO Builder Program Flowchart Connect to mySQL Database Success Grab most recent entry from DB Open readout text file Grab most recent entry from file Timestamp of DB entry lt Timestamp of text file entrv Wait until next update time Enter most Update database recent entries in most recent text file into DB entry for comparison Appendix C HoboBuilder java HoboBuilder java author Nicholas Lavanda version
29. nt Sensors er m lm bo 1 Temperature 2 Pressure 3 Relative Hurnidty Figure 10 Diagram of the Hardware used Figure 10 shows a diagram of how all the hardware involved in the project connects Data is collected by the sensors and stored on the data logger The logger will then periodically send the stored readings to the HOBO service via the logger s wireless system The data is then stored in a text file on the HOBO Server via the HOBO software and is then entered into the database on the satnet server using the Java Based updated design specifically for the project The data can then be viewed through the internet by clients by accessing the website located on the satnet server 6 1 Database Structure The database used is a simple one with a single table readouts and is located on the satnet server This table contains four columns dateTime pressure temperature and rh Figure 10 shows a description of the readouts table showing the field s name type and other attributes 4 4 Field Type Null Key Default Extra 4 4 dateTime timestamp YES NULL pressure double YES NULL temperature double YES NULL rh double YES NULL 4 4 Figure 11 Description of the Database While
30. o lt tr gt lt td width 20 gt lt b gt Max Pressure lt b gt lt td gt lt td width 20 gt lt b gt Max Temperature lt b gt lt td gt lt td width 20 gt lt b gt Max RH lt b gt lt td gt lt tr gt echo lt tr gt lt td width 20 gt sprintf 5 2f SmaxPr lt td gt lt td width 20 gt sprintf 5 2 maxTe lt td gt lt td width 20 gt sprintf 5 2 SmaxRh lt td gt lt tr gt echo lt tr gt lt td width 20 gt lt b gt Min Pressure lt b gt lt td gt lt td width 20 gt lt b gt Min Temperature lt b gt lt td gt lt td width 20 gt lt b gt Min RH lt b gt lt td gt lt tr gt echo lt tr gt lt td width 20 gt sprintf 5 2f SminPr lt td gt lt td width 20 gt sprintf 5 2 minTe lt td gt lt td width 20 gt sprintf 5 2 SminRh lt td gt lt tr gt echo lt table gt 2 gt lt body gt lt html gt
31. ogger Once the data logger is launched which is indicated by the appearance of a status bar you may close HOBOware by selecting Exit menu choice from the screen as shown in Figure 3 4 HOBO Software Configuration Onset Remote Site Manager Now start up the Onset Remote Site Manager by double clicking on the Remote Site Manager icon As a result a screen shown in Figure 5 should appear Remote Site Manager SS M Cor IL Figure 5 Onset Remote Site Manager Start up screen Once the Remote Site Manager is running we need to create a remote site In order to do this click on the Set up remote site profiles button and a screen will appear as shown in Figure 6 Remote Sites Add Ske Connect eat d ones Connection Route Prefix es Location Auto Readout Schedule Figure 6 Remote Profile page from Remote Site Manager program From the Remote Profile Screen as shown in Figure 6 select the Add Site tab A screen like Figure 7 will appear m Remote Profiles zal x Remote Sites Add Site Connection Route 9 Local Port Name 10 Char Max Hobo COM Port 3 COM 1 Location 10 Char Max Auto Readout Schedule v Utilize schedule DDD HH MM Read out new data every CUSTOM gt 000 00 01 Start Time IMMEDIATE v 04 22 09 05 00 PM Datafile path 4 C Documents and Settings hobo Desktop Hobo example Set Up Email and FTP Data Transfers
32. ount 0 SendPost function CheckTSLowG var reTS d 2 d 2 d 4 d 2 d 2 d 2 if reTS test document getElementById txtLow value alert Time stamp low range must be in the format of DD MM YYYY HH MM SS document getElementById txtLow focus return 1 else return 0 function CheckTSHighG var reTS d 2 d 2 d 4 d 2 d 2 d 2 if reTS test document getElementById txtHigh value alert Time stamp high range must be in the format of DD MM YYYY HH MM SS document getElementById txtHigh focus return 1 else return 0 A function CheckDisplay if document getElementById selType value All document getElementById divID style display none else document getElementById divID style display function trim str return str replace s s replace s s 9 Appendix E view php Displays results in text form html lt head gt lt title gt HOBO Weather Montitoring Station Florida Gulf Coast Univerity lt title gt lt script type text javascript src hobo js gt lt script gt lt head gt lt body gt lt form id reg action view php method get gt lt div class left gt The readouts listed can be filtered via the following form amp nbsp lt br gt Filter by lt select class field name selType id selType onc
33. out println input Parse the date and time from the string StringTokenizer st new String dateStr st nextToken String dateStrF gFormat format new dateTime getTime new Parse the pressure from the string pressure Double parseDouble st nextToken Parse the temperature from the string temperature Double parseDouble st nextToken string Parse the relative humidity from the rh Double parseDouble st nextToken RRR KKK RIK KK KKK KK de he IAA AAA AIA AAA IKK AAA AAA ee He He He He He He He Delete old entries to make room for new ones if entryCount gt 2879 get the oldest entry ResultSet rs2 stmt executeQuery SELECT dateTime FROM readouts ORDER BY dateTime LIMIT 1 date of the oldest entry rs2 next Java sq1 Timestamp victim rs2 getTimestamp dateTime remove the oldest entry stmt executeUpdate DELETE FROM readouts WHERE dateTime victim entryCount RRR KKK KKK KKK He de KKK KKK he ke AAA He He he AIA AAA IAA A AAA HK He He He He KKK KKK Enter Parses into database stmt executeUpdate INSERT INTO readouts dateTime pressure temperature rh VALUES dateTime pressure temperature 4rht entryCount emptyDB false Update the time of the most recent entry recentEntry dateTime Close hobo txt in close Notify that
34. r gt amp nbsp lt input type reset id btnReset value Reset gt lt div gt lt form gt The hidden type of name page is there to allow the form to work with the pagination code as the code requires that a page value be passed with the form The div dbHidden is only shown if the filter type is not set to all Below the form the actual data collected from the HOBO unit is displayed Due to the amount of possible entries the results are broken up by pagination This makes it so that no more than 300 entries are shown at once The user can simply click the page numbers above the table to see the rest of the entries The code for this is too long for a meaningful snippet so refer to Appendix E for details 7 2 3 Graph Page Filter Results Select the range of dates of the readouts shown Between and Show Reset Pressure Refresh Graph Barametric Pressure Over Time Figure 16 Screenshot of Graph Page Figure 16 shows a screenshot of the graphing page This page also contains a form to filter the results shown but this one only accepts dates and times to limit Under the form is a button to refresh the graph below The button will only refresh the one graph and not affect the others or reload the page The code to handle this is too long for a meaningful snippet so refer to Appendix D for more details Under the refresh button is the graph itself There are three graphs only one is shown in the screenshot
35. re passing due to the author s preference The function will return a return a ResultSet that contains the rows in the database that satisfied the query for this example that would be all entries and sorting them by dateTime in descending order Another example would be query SELECT FROM readouts WHERE filter BETWEEN low AND high ORDER BY dateTime DESC Sresult mysql_query query This time the results returned would be more specific Sfilter would have retrieved from a list box containing which column the user wants to filter the results by Slow and Shigh would also be retrieved from a user inputted value and be used to select entries which fall between these two values 6 3 Data Retrieval and Presentation While the entry into the database is done with the Java based updater something else must be done in order to actually view this data in a meaningful manner This is where the website comes into play The website is coded in mix of HTML and PHP as html doesn t have the means to interact with the database on its own PHP is scripting language used quite often to interact with databases as it does it well and is open source Using various commands not going into specific as some examples are provided in the previous sections and more can be found in Appendixes C G one is able to query the database and 7 performing other general programming functions in PHP The PHP just d
36. reading has ended by outputting to console System out println Update complete t t t timeStamp RRR KKK KKK KKK KKK He He IAA KKK AAA He He AA KKK KK He He He He KKK KKK Close Connection to database try if con null con close catch SQLException e catch Exception e System out println e Wait until next check try Thread sleep sleepTime catch Exception e System out println e while active Returns the current time and date public static String timeStamp java util Date readStamp new java util Date SimpleDateFormat formatter new SimpleDateFormat yyyy MM dd HH mm ss return formatter format readStamp 8 Appendix D hobo js Form parameter editor function Filter if trim document getElementById selType value All SendPost else if trim document getElementById selType value dateTime if trim document getElementById txtLow value amp amp trim document getElementById txtHigh value alert Please enter a range of values to filter document getElementById txtLow focus else CheckTSLow else if trim document getElementById txtLow value amp amp trim document getElementById txtHigh value alert Please enter a range of values to filter document getElementById txtLow focus else CheckLow

Download Pdf Manuals

image

Related Search

Related Contents

AP ソーラージェネレーションキット20W 取扱説明書    BUTLER 800/TWIN      Manual de Funcionamiento  Pluggable UV-C Air Sanitizer & Deodorizer USE & CARE  

Copyright © All rights reserved.
Failed to retrieve file