SdWebBrowse_Ethernet_WebServer.ino is a datalogger and web server. Current revision is 31, Formatted.
Requires Arduino Mega 2560, Ethernet Shield and Real time clock, and Sensors for Humidity/Temperature and Barometric pressure.
Now Features:
Real Time Clock; used for 15 minute time interval, date and time stamping and dayofweek (every 7th day, log.txt file gets renamed to keep file size manageable. Every Saturday (7th day of week) log.txt gets renamed in the format "logxxyy” xx being the month and yy being the date; a new log.txt is created after file renaming.
Dynamic web page displays current observations for Last update time and date, Humidity, dew point, temperature, heat index, Barometric Pressure both inches of Mercury and millibars.
Server files are listed as web links; clicking link opens a prompt to: "Open with/Save as." "System~1/", "Favicon.ico", and "Access" are listed; however, they are for internal use and cannot be "Opened with/Save as," result of clicking link produces "404 Page not found."
Log.txt file is appended every 15 minutes with the latest update; storing data from Dynamic web page.
Access.txt stores Client ip address; requires special Ethernet.h file. Web link provided in Sketch source code.
Differ.txt stores the difference in barometric pressure for the last fifteen minutes. Only a difference of equal to or greater than .020 inches of Mercury are logged with difference, date and time.
Server.txt is used is used to log Server RESETS caused by "SwitchDoc Labs, Dual Watchdog Timer," "Watchdog Starting Server" entries in the Server.txt file are from a reset from the "Dual Watchdog Timer" or a "Manual Starting Server."
URL addresses other than ones defined in the Sketch produce "404 Page not found."
Audible alert from Piezo electric buzzer when there is Barometric Pressure difference of .020 inches of Mercury. I am interested in sudden drop of Barometric pressure in a 15 minute interval. Serve weather more likely with a sudden drop. Difference of .020 inches of Mercury point is set for my observations to log and sound audible alert; not based on any known value to be associated with serve weather.
Two-line LCD Display of Barometric Pressure in both inches of Mercury and millibars.
"SwitchDoc Labs, Dual Watchdog Timer" added to project; resets Arduino Mega in case Sketch execution fails.
Added a 74HC73, JK Flip-flop to differentiate which reset: a "Dual Watchdog Timer" reset or a "Manual" reset, for example opening "Serial Monitor" or pressing "Reset" switch on the Arduino Mega.
13, Added fileRead function; consolidating code for doing file reads,
Added ability to cancel download; without hanging Sketch.
I can't really tell...but if this is a private IP (your own), I'd be more tempted to buy some actual hosting...using your own IP address and hosting your own web-server may not be the best idea...unless you are a security consultant or the like.
Just send the data to a £5 a year basic web hosted page.
Project update; last SwitchDoc, "Dual Watchdog Timer" reset was 4/5/2016, 22:51:39. Project web page has been online thirty-one days steady with no RESETS of any kind. So far, J-K Flip-flop addition to project has performed as expected. J-K Flip-flop is used to determine which RESET has occurred; Serial Monitor/pressing RESET switch or SwitchDoc, "Dual Watchdog Timer" for logging RESETS.
Couple of differences: First, remote client IP is not supported in the Adafruit CC3000 Library. Second, there is a WLAN Guard function that attempts to keep wireless LAN connection --this is in addition to "SwitchDoc Labs, Dual WatchDog Timer."
Ethernet version of the project has been taken offline. Thanks to those that took time to checkout the project.
I am working with a wireless version of the same project now. Looks like with all the tweaking of the trim pot on the DWT; it is working as planned. Also, I had to increase the length of the DWT "keep alive" pulse in the sketch.
Made a wiring change; connection to Arduino Mega 2560's RESET pin now connects to Pin 1 (CP) of the 74HC73.
Early results are attached. "Manual RESET" 8/1/2016, 22:48:16" was the time I stopped working on project for the nigh. Times before 8/1/2016, 22:48:16 are from testing and making adjustments. Approximately 05:15 this morning the Cable modem/Gateway rebooted and I lost connectivity. The "Guard" function caught the event and reconnected. 8/2/2016, 05:36:50 at this point the CM/G was not fully rebooted (no wireless) a "Manual RESET was logged. Once wireless was fully up, "Guard" function reconnected. Not sure what the event was 8/2/2016, 05:51:26 that caused a "Watchdog RESET." As of 08/02/2016, 08:21:00 project is still online and responding to requests.
Appears to be working, may need more observation,,,
NOTE; the connection for the Arduino Mega 2560, RESET pin to 74HC73, pin 1 needs to switched off or disconnected to compile and load sketch, then after Serial Monitor has produced "Manual RESET," switch on or reconnected 74HC73, pin 1 to Arduino Mega 2560, pin RESET.. This connection is normally HIGH until the SwitchDocs Lab, Dual Watchdog Timer briefly goes LOW.
IMPORTANT: If this procedure is not followed; the Arduino IDE, compiler will abort!
Trying to compile the MEGA version I get these errors
D:\IDE\arduino-1.6.12\portable\sketchbook\SdWebBrowse_Ethernet_HTTPServer\SdWebBrowse_Ethernet_HTTPServer.ino:37:59: fatal error: SdFile.h: No such file or directory
#include <SdFile.h> // https://github.com/greiman/SdFat
^
In SDfat library there is not any SdFile.h
SdWebBrowse_Ethernet_HTTPServer:187: error: 'PgmPrint' was not declared in this scope
PgmPrint("error: ");
PgmPrint is not declared nor defined anywere
SdWebBrowse_Ethernet_HTTPServer:188: error: 'SerialPrintln_P' was not declared in this scope
SerialPrintln_P(str);
Just compiled Sketch attached on this post with "Arduino 1.6.12" without error.
You will need to download the libraries from the download links provided in the Sketch file.
Download link is commented to the left of the #include file of the library.
Started developing the Sketch in Fall of 2012; some, libraries I used are aging...
Ethernet version of Sketch requires Arduino Mega 2560, Arduino Ethernet Shield, DS1307 RTC, DHT22 Humidity and Temperature sensor, and BMP085 Barometric Pressure sensor.
Thank you for your reply I had the directions to research solutions, you use some older libaries from about 2012.
So I got compiled after some modifications in IDE 1.6.12.
Maybe you used an older library than LiquidCrystal_V1.2.1.zip that is written in the sketch because the inisialization is different
All PgmPrint("text"); is now Serial.print(F("text"));
I used standard Ethernet library and added a file found in this forum to have RemoteIP.
All my files are in the zip, I used LiquidCrystal_V1.2.1, the other files are in the zip
There are other little modifications but they are written in the sketch.
Thank you for the follow-up; glad you were able to compile Sketch with your modifications. Will take a look, at your modifications to the original Sketch. Sketch uses many aspects of Arduino programming; it has been a good learning experience, with input from multiple forum and their users.
Hardware update: DS3231 breakout module is a Real Time Clock; compatible with DS1307, at some point, would like to use. Also, would like to use a BME280 breakout module. Both devices are 3.3 to 5 Volt devices and feature I²C protocol.
Current Wireless version of project is attached; along with modified library for return of the client ip address. Modified library is experimental; have not learned if changing clientIndex from != -1 to clientIndex = 2 has any negative impact on the library. Result of this change is the client ip address is returned every time.
Update: November 19, 2016, Current Features SdBrowse_CC3000_HTTPServer.ino.
DIY Datalogger combined with HTTPWeb server.
Requires Arduino Mega 2560, Adafruit CC3000 Shield and Real time clock, and Sensors for Humidity/Temperature and Barometric pressure.
Real Time Clock; used for 15 minute time interval, date and time stamping and dayofweek (every 7th day, log.txt file gets renamed to keep file size manageable. Every
Saturday (7th day of week) log.txt gets renamed in the format "logxxyy" xx being the month and yy being the date; a new log.txt is created after file renaming.
Dynamic web page of current observations for Last update time and date, Humidity, dew point, temperature, heat index, barometric pressure (both inches of Mercury and millibars.)
Server files are listed as web links; clicking link prompts for "Open with/Save as." "System~1/", "Favicon.ico", and "Access" are listed; however, they are for internal use and cannot be "Opened
with/Save as," result of clicking link produces "404 Page not found."
Log.txt file is appended every 15 minutes with the latest update; storing data from Dynamic web page.
Access.txt stores Client ip address; modified Adafruit_CC3000_Server.cpp and Adafruit_CC3000_Server.h filesre are required; this feature is experimental.
Differ.txt stores the difference in barometric pressure for the last fifteen minutes. Only a difference of equal to or greater than .020 inches of Mercury are logged with difference, date and time.
Server.txt is used only with wireless version of Sketch; records Restart of server from lost of wireless connectivity (not all lost connectivity is recoverable; high percentage is recoverable.)
URL file names other than ones defined in the Sketch produce "404 Page not found."
Audible alert from Piezo electric buzzer when there is Barometric Pressure difference of .020 inches of Mercury. I am interested in sudden drop of Barometric pressure in a 15 minute interval. Serve weather more likely with a sudden drop. Difference of .020 inches of Mercury point is set for my observations to log and sound audible alert; not based on any known value to be associated
with serve weather.
Two-line LCD Display of Barometric Pressure in both inches of Mercury and millibars.
Added "SwitchDoc Labs, Dual Watchdog Timer" to project; RESETs Arduino Mega in case sketch execution fails..
Added a 74HC73, JK Flip-flop that acts as a "Status Bit" and logs "Dual Watchdog Timer" RESET to file on SD Card.
Added ability to cancel download; without hanging Sketch.
Added cc3000.getStatus() call to check for open socket; which may not allow client to close.
Added listen() call to end of init_network(); instances of init_network called from Loop, hanging Sketch.
Server is an Arduino Mega 2560 with an Adafruit CC3000 Shield, DS1307, BMP085, and DHT22.
All sensors are located inside house; during this phase of testing.
Made changes to the J-K Flip-flop code; much improved over last update. Changes were also made to the Status Bit Monitor schematic. Updated 12/11/2016 21:58 PM EST.
Pushing the RESET button on the Arduino Mega produces a "Manual RESET" in the Serial Monitor. Arduino RESETS caused by SwitchDoc Labs, "Dual WatchDog Timer" produce "WatchDog RESET" in the Serial Monitor. Note: After compiling and uploading sketch; "WatchDog RESET" will be produced in the Serial Monitor. May be due to Arduino's internal RESET design.
Removed client IP feature over concerns that too many client requests were required before a page would open. Modified Client index value may be effecting the response. Reverted back to only using Adafruit_CC3000 Library in its original form.
Additionally, tweaked the process of Resetting the J-K Flip-flop.
Added a Diode (D1) on the schematic, to block the pulse from the Arduino RESET pin for when a Arduino RESET occurs.
The keep WDT keep "alive' pulse comes fro Arduino Mega, Pin 33 and connects to WDT, JP7. All connections to WDT are on Dog1 and on the Arduino side of the dual pin header.
SdBrowse_CC3000_HTTPServer.ino with date of 12/28/2016 at 19:19 EST --has modified J-K Flip-Flop coding for clearing (resetting) FF. I have attached the sketch to this post; in-addition, posted a Higher resolution image of the schematic.