Arduino Forum

Using Arduino => Project Guidance => Topic started by: dave-in-nj on Mar 24, 2019, 06:15 pm

Title: max reading last day
Post by: dave-in-nj on Mar 24, 2019, 06:15 pm
I want to show the highest and lowest temperature for the last day.
this is for a simple DS18B20 in a greenhouse.
using an ESP8266,  WiFi to store data on the web

localweb server to show simple data
local Nokia 5110 display showing current temp,  highest  last 24 hrs and lowest last 24 hrs
Really tying to get this information to display on the local display.

if take the current reading and compare to the stored highest, I can keep increasing  the max reading
if I log the time,  I can then wait 24 hours and replace that value.

My question is that I would need to replace that 'more than 24 hrs' with a value that is the highest, but 'less than 24 hrs'  I am thinking along the lines of  'yesterdays highest'

If I used a few threshold.  80F, 85F, 90F and above 95F
I could do
minutes over 95
minutes over 90
minutes over 85
minutes over 80

two very different approaches.

Can you offer any suggestions ?  is there a better way ?

Title: Re: max reading last day
Post by: wildbill on Mar 24, 2019, 06:41 pm
When you push data to the web server, have it respond with the current 24hr high & low.
Title: Re: max reading last day
Post by: johnwasser on Mar 24, 2019, 06:43 pm
I think I would keep an array of 24 Max-for-the-Hour temperatures.  At the end of each hour, replace the oldest value with the value for the just past hour.  A quick scan through the 24 values will give you the Max  for the previous 24 hours.  Display the max for the previous 24 hours or the max for the current hour, whichever is higher.  You could do the same for Min temperatures.  You could draw graphs of the data.  If you have enough memory and want finer resolution, use smaller time intervals: 48 half-hours, 96 quarter hours, 144 10-minute intervals...
Title: Re: max reading last day
Post by: swe-dude on Mar 24, 2019, 08:01 pm
Take a look at this: (

The datalogger part of that code are useful for logging data and finding highest lowest values. I use it myself to display temp for the last 12h and keeping track of mm rain last day/week/

Best of luck
Title: Re: max reading last day
Post by: Wawa on Mar 24, 2019, 08:28 pm
Most ESP8266 boards have enough internal memory (SPIFFS) to store months (years) of hourly temp data with NTP timestamps.
Look at the temp logger project in this guide (