ESP8266 --Internet Weather Datalogger and Dynamic Web Server

Great! I'm glad you replied...I was wondering if the ice age was upon us!
Good luck with your class.

I made some PCB's a few years back with a laser printer. They make a nice small
footprint for your projects.

Weather Data is displayed and updated every fifthteen minutes, Data is pulled from server running on RobotDyn WiFi D1 R2. Pages "live" on a domain, website.

WiFi Client/Server Based --ESP8266

Domain Hosted, WiFi Client.Server Based --ESP8266

Both websites are running simultaneously from the same sketch! Sketch does not require a Real Time Clock! NTP Protocol and time server are used for all timing requirements!

See previous POST for "NTP_Web_Interface.zip" sketch and PHP file that receives data from the server on the Domain, hosted web site.

Correct filename.

schufti of the ESP8266.com Forum introduced me to two libraries for the ESP8266; "sys/time.h" and "time.h" these two libraries are used with NTP Time server to sync time with the ESP8266. Should be noted this requires ESP8266 core 2.4.1 version; which can be installed using the "Arduino IDE" "Board Manager."

I am having issues with the hosted web site; once this is resolved, the website should be back online.

WiFi Client/Server Based --ESP8266

Domain Hosted, WiFi Client.Server Based --ESP8266

"NTP_Web_Interface code has been renamed to "Fast_Time_Web_Interface_v4.ino." Current date of version is 04/11/2018 @ 17:03 PM.

William

Fast_Time_Web_Interface_v4.zip (11.4 KB)

ESP8266_Time_Sync.ino (2.96 KB)

I will check these libraries!

Thanks William!

Edit: Wow! seems much simpler than using UDP, TimeLib and TimeZone libraries.

Update 04/14/2018:

Faster performance using the two new libraries , have removed some code related to libraries no longer used. Everything is working: ESP8266 server website and the hosted website are both online!

Current version of the "NTP_Web_Interface.ino" has been renamed to: "Fast_Time_Web_Interface_v5.ino."

More than a Data Logger; also allows fast, remote downloading of files stored onboard in the SPIFFS memory, files are browser enabled and selectable from files list. Both ESP8266, local server and hosted web server are available from the same sketch. Commented out are two useful features; a LCD display function and a Audio beep to alert for a predetermined difference in a 15 minute interval of barometric pressure (experimental).

Same board that is online has been used for development of project coding; therefore, there may be gaps in the data logs! The 15 minute interval has been "spot on" every 15 minutes from the top of the hour. Awesome, for no real time clock. All time related requirements are provided by NTP time server. Even has a backup time server!

Two websites;one sketch:

WiFi Client/Server Based --ESP8266

Domain Hosted, WiFi Client.Server Based --ESP8266

Restrictions from free hosting service is why there is no file browser. Graphing of four weather parameters are availble on both websites.

William

Fast_Time_Web_Interface_v5.zip (11.3 KB)

04/21/2018

Removed all occurrences of "\r\n" from lines with "client.println." Implemented your suggestion to use formatted strftime, added %Z for timezone. Works perfectly, thank you schufti! Eliminated most of the timeStamp function except the formatting of "strftime."

File name was changed from "NTP_Web_Interface.zip" to reflect; faster, client connections under one second consistently .

ESP8266 Server web sites:

WiFi Client/Server Based --ESP8266

Domain Hosted, WiFi Client.Server Based --ESP8266

Both web sites obtain data from "Fast_Time_Web_Interface_v7.ino".

William

Fast_Time_Web_Interface_v7.zip (10.9 KB)

Serial Monitor.txt (6.02 KB)

Due to circumstances beyond my control; project has been offline since 05/29/2018. Online operation was restored 06/06/2018 at 01:30 EDT. ISP changed from Gateway -based firmware to Gateway cloud -based firmware; there were issues with port forward not working. Gateway was swapped out for a new one in the troubleshoot process and a new public IP was attached nullifying previous links to the ESP8266 Server web site.

I apologize for any inconvenience experienced by this change.

Active project websites:

WiFi Client/Server Based --ESP8266

Domain Hosted, WiFi Client.Server Based --ESP8266

William

NTP_Time-synced_Web_Interface.zip (15.8 KB)

Experienced sensor failure; awaiting replacement sensor. Both websites are affected; updated data is invalid!

Affected websites:

William

Update 7/28/2018

Replacement BME280 installed. Assembled new sensor board with a 6 pin, female header; so I can use the sensor board to test BME280 sensors, without needing to soldering sensor onto the SB400 prototyping board.

Project has been running the last week reliably and with valid data. Made some tweaks to the code. Have observed occasional delays in responding to client requests; does not happen often, when it does happen page has to be reloaded by the Client Browser. Issue may be the ESP8266 going to default modem sleep mode. I have added in the loop:

wifi_set_sleep_type(NONE_SLEEP_T);
  delay(100);

Trying to keep the ESP8266 from going into default modem sleep --power is not ain issue. Being occasional and random it is making it difficult to find and to correct.

William

NTP_Time-synced_Web_Interface.zip (16.7 KB)

WiFi Client/Server Based --ESP8266

Domain Hosted, WiFi Client.Server Based --ESP8266

There are two web sites; one hosted on the ESP8266, and one domain, hosted --both are driven by one sketch!

08/08/2018 Current version of sketch is attached.

NTP_Time-synced_Web_Interface.zip (17 KB)

Update 09/03/2018: "NTP_Time-sycned_Web_Interface.ino" has been online without resets of any kind since 08/13/2018; current code is attached in the previous message. No wireless drops or wireless interference.

Development board running web server is a "RobotDyn WiFi D1 R2 at a low-cost, of under $5." Board is available at RobotDyn.com; photograph of this board can be viewed in previous "Update of 07/28/2018."

William

02/19/2019

New WAN ip address invalidated previous URL links for project ESP8266 server:

WiFi Client/Server Based --ESP8266

Domain Hosted, WiFi Client.Server Based --ESP8266

Fixed FTP transfers from within running sketch for easier admin maintenance of files.

William

NTP_Web_Interface_Data_Logger.zip (20.7 KB)

Created video of Serial Monitor, ESP8266 based server, and Chrome Browse; plus displays of text files.

[Video of Project

"Hosted Web site files.zip" attachment contains php file to be uploaded to a hosted web site to fully use sketch "NTP_Time-Synced_Web_Interface.zip"

William

NTP_Time-synced_Web_Interface.zip (17.1 KB)

Hosted Web site files.zip (2.01 KB)](Narrated NTP Time Synced Web Interface ino - YouTube)

03/18/2019

Back in October last year I was asked if I could add a tipping rain gauge and GPS to the project. After months of endless ESP8266 wdt resets and my limited skills of debugging; I put the addition on the shelf. Months later I purchased ESP32 Dev. Edtion Board.

I was excited to learn the ESP32 has 2 cores; one for wifi operations and one for processing. My project has "allot of moving parts" or so I have been told. To make a long story short. Using the code for from Haroon552; we have impemented a tipping Rain Gauge and a NEO m8n GPS module to the project. Armed with the ESP32 and ESP32 libraries I began work again the addtion to the project. This time I experienced no wdt resets. Project with the requested addtions have been online for a few days now with no wdt resets.

WiFi Client/Server Based --ESP8266

Domain Hosted, WiFi Client.Server Based --ESP8266

Once finished with addtional testing I will post the "Weather_View.ino" file.

William

03/24/2019

WiFi Client/Server Based --ESP8266

Domain Hosted, WiFi Client.Server Based --ESP8266

Have finished work on "Weather_View.ino." Features added include Rain Gauge support, GPS Longitude, GPS Latitude, GPS Altitude, GPS Time, File Transfer using FTP (Filezilla), and Over the Air (OTA) updates.

Existing features of "NTP_Time-Synced_Web_Interface.ino" kept; except for NTP time keeping.

GPS time is used to set the DS3231, Real Time Clock; which can be set at predetermined interval.

"NTP_Time_Synced_Web_Interface.ino" has been renamed "Weather_View.ino."

Zipped file includes "dataCollector.php" to be uploaded to a hosted web site for using webInterface function of sketch.

Project used a ESP32 Dev. Edtion Board, purchased from "Adafruit.com." GPS Module used is a "NEO m8n."

Rain Gauge code and EEPROM routines were developed by Haroon552 of this forum.

WilliamWiFi Client/Server Based --ESP8266

Weather_View..zip (18.4 KB)

"NTP_Time_Synced_Web_Interface.ino" hosted domain website has been visited by users from 67 Countires, thank you for all the visits to the hosted domain website of the project!

Domain Hosted, WiFi Client.Server Based --ESP8266

William

NTP_Time-synced_Web_Interface.zip (17.1 KB)

Hosted Web site files.zip (2.01 KB)

Awesome :slight_smile:

Thank you Bringamosa for the feedback!

I have re-uploaded the current project code. There are two files to the project: "NTP_Time-synced_Web_Interface.zip" and "Hosted Web site files.zip."

Credit for PHP files and concept of sending data to webpage goes to: Stephen Borsay's project Project PHP file is in "Hosted Web site files.zip."

William

"NTP_Time_Synced_Web_Interface.ino" hosted domain website has been visited by users from 75 Countires, thank you for all the visits to the hosted domain website of the project!

Domain Hosted, WiFi Client.Server Based --ESP8266

Project code unchanged since April 24, 2019 POST.

William

ISP forced another WAN, ip address change; so pervious web links are no longer valid. Signed up with Noip.com for "Hostnames" that hopefully will eliminate this issue.

WiFi Client/Server Based --ESP8266

Domain Hosted, WiFi Client.Server Based --ESP8266

My apologies for the inconvenience this caused.

Many thanks to everyone that have visited Project web pages!

William