Go Down

Topic: ESP8266 --Internet Weather Datalogger and Dynamic Web Server (Read 20467 times) previous topic - next topic

Techno500

#45
Aug 17, 2017, 05:46 am Last Edit: Sep 05, 2017, 12:14 pm by Techno500 Reason: Embed video

Techno500

#46
Aug 31, 2017, 06:29 am Last Edit: Aug 31, 2017, 06:33 am by Techno500 Reason: Add image
Current version has been online since 08/08/2017  @ 23:31 EST with little interruption.  Developement board is a RobotDyn Wifi D1 R2 from Source of board



Project web page


Attached "NTP_Observations_SPIFFS.zip" is the 08/08/2017 @ 23:31 EST version.

Techno500

October 2, 2017 Update:

"NTP_Observations_SPIFFS.ino"    08/08/2017  @ 23:31 EST continues to remain online.  Last version change date was 08/08/2017 @ 23:31 EST. 

Current version has performed above and beyond my expectations.  Very good reliability.  Fast downloads.  Fast Watchdog resets on the rare occurrence when one happens.


William


Techno500

Improved Wake time in response to page request. 

Improvements to simplify editing page links.

List of line numbers requiring editing.


Project webpage --Observations

Project webpage --Graphs

Techno500

#49
Nov 23, 2017, 06:31 pm Last Edit: Dec 09, 2017, 06:43 pm by Techno500 Reason: Update 12/9/2017 adding attachment
Update 11/23/2017

Added code for occasion when no NTP Packet is received, to request a new Packet to be sent.

Added SERVER.TXT file for date and time of Server starts.  

Previous version of project code is:  "Nov_23_2017__NTP_Observations_SPIFFS.ino."


Project web page

Project's Graphing capabilities


Installed version of project code is:  "Dec_9_2017__NTP_Observations_SPIFFS.ino."


Techno500

Some how my device was blocked at my Gateway.

Apologies to anyone that tried to connect and was unable to connect.

No changes to software since the last update.

Project website


William

Techno500

#51
Jan 07, 2018, 11:58 pm Last Edit: Jan 10, 2018, 11:09 pm by Techno500 Reason: Re-upload attachment
New feature:  Hosted website gets updates every 15 minutes.  Very little additional code to project by using ESP8266HTTPClient library.

Website is on ".000webhostapp.com" free, educational Domain:
Hosted project website.

Stephan Borsay's  article on Hackster.io was the inspiration for this additional feature.

William

zoomx

Thanks for the update William,
I will read the links you provided!

Techno500

Completed design of Website for project.  Driving element of web sit is the following code:

Code: [Select]
<?php

/*
  ESP8266: send data to your Domain 

  Uses POST command to send BME280 data to a designated website
  The circuit:
  * BME280
  * Post to Domain 
  
  Original version of this code by Stephan Borsay
  Modified with HTML and CSS by techno500 for use with BME280 along with Arduino/ESP8266 sketch:  
  "NTP_Web_Interface.ino."
  
*/

date_default_timezone_set("America/Indianapolis");
$TimeStamp date("Y-m-d   h:i:sa");

   if( 
$_REQUEST["fahren"] ||  $_REQUEST["heat"] ||  $_REQUEST["hum"] ||  $_REQUEST["dewpt"]
       ||  
$_REQUEST["cpressure"] ||  $_REQUEST["bars"] ) 
   {
      echo 
" The Temperature is: "$_REQUEST['fahren']. "F. <br />";
      echo 
" The Heat Index is: "$_REQUEST['heat']. " Heat Index <br />";
      echo 
" The Temperature is: "$_REQUEST['hum']. " hum <br />";
      echo 
" The Dew Point is: "$_REQUEST['dewpt']. " Dew Point<br />";
      echo 
" The Barometric Pressure is: "$_REQUEST['cpressure']. " in. HG. <br />";
      echo 
" The Barometric Pressure is: "$_REQUEST['bars']. " millibars <br />";
      echo 
" The Altitude is: 824 Feet <br />";
 
   }
  
 
$var1 $_REQUEST['fahren']; 
$var2 $_REQUEST['heat'];
$var3 $_REQUEST['hum'];
$var4 $_REQUEST['dewpt'];
$var5 $_REQUEST['cpressure'];
$var6 $_REQUEST['bars'];
//$var7 = $_REQUEST['altit'];

$WriteMyRequest=

"<html>".
"<head>".
"<body>".
"<style>"
"body { background: #561C0E no-repeat fixed center;}".
"a,h2,h3 {color: #ffffff;}"
"font-weight: bold;}".
"</style>"
"<title>Observations</title>".
"<h2>".
"Observations".
"<p>Treyburn Lakes<br />".
"Indianapolis, IN<br />".
"46239</p></h2><br />".
"<p><h3>Last update:   " $TimeStamp "</p>".
"<p> The Temperature is : "   $var1 " F. </p>".
"<p>And the Heat Index is : " $var2 " F. </p>".
"<p>And the Humidity : "       $var3 " % </p>".
"<p>And The Dew Point is : "   $var4 " F. </p>".
"<p>And The Barometric Pressure is : "  $var5 " in. HG. </p>".
"<p>And The Barometric Pressure is : "  $var6 " mb</p>".
"<p>And The Altitude is : 824 Feet </p><br/><br/>".  // Altitude as read by GPS for project location
"<a href='https://pathToAbout.php'>About</h3></a>".
"</head>".
"</body>".
"</html>";

file_put_contents('display.html'$WriteMyRequest);

?>


This is the PHP code that creates the "Observations" menu option of the website.

Hosted project website



PHP code above receives the POST from the "NTP_Web_Interface.ino" sketch.  POST is developed with use of the "ESP8266HTTPClient" library.  Project is unique in the fact that it does not use a Real Time Clock.  Every 15 minutes; PHP code rewrites the "Observations" HTML page.  Only the "ESP8266" development board and the BME280 are required making for a real low cost project!  All timing requirements are provided by using Network Time Protocol and a time server to derive the time and date used in the sketch.

Over the time I have been developing this project; have had allot of help from members of the various forums.  Without their help this project would have been impossible.  To those that helped and the owners of the various forums; thank you, your help most appreciated!

Attached is the sketch and the php code.

William



Add screen capture

rxpc

Nice project Techno!!!

That BME280 sensor is really nice! I noticed on your observations page the temp is off the scale:

Treyburn Lakes
Indianapolis, IN, US

Last update: 2018-02-06 05:30:02pm

The Temperature is : -230.62 F.

And the Heat Index is : -228.32 F.

And the Humidity : 100.00 %

And The Dew Point is : -230.62 F.

And The Barometric Pressure is : 35.13 in. HG.

And The Barometric Pressure is : 1189.80 mb

And The Altitude is : 824 Feet

Techno500

@rxpc  Thank you for bringing this to my attention; caused by faulty Dupont jumper on the BME280 sensor.  I need to get this project off of breadboard and on to a printed circuit board.  Have started "Eagle" class on "Udemy.com" for creating printed circuit boards.  First project in "Eagle" will be to create a PCB for "NTP_Web_Interface.ino" project!

William

rxpc

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.

Techno500

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.

Full features of project:  Data is displayed and updated every fifteen minutes, File browser and file downloads of collected, weekly Data files and associated files.  Data is collected every fifthteen minutes.  Web site "lives" in RobotDyn WiFi D1 R2 SPIFFS, flash memory.

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.

Techno500

#58
Apr 12, 2018, 12:34 am Last Edit: Apr 12, 2018, 12:44 am by Techno500 Reason: Add second file attachment
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.

Project, hosted web site

"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.

Website running RobotDyn WiFi D1 board costing less than $5.00 can be viewed here:

Project web site

zoomx

I will check these libraries!

Thanks William!

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

Go Up