Introduction: Build Your SPIFFS Temperature Logger & Led Clock
Hi,
Today i am showing you how to build a Offline Browser Temperature & Humidity Graph Viewer from SPIFFS Data.
This Project saves Temp , Hum & Time from I2C DS3231 periodically to Spiffs Flash in three files.
The files are later opened on web browser request and you see a chart.js Line Chart (See Image Below) for all the logged data.
It will have Date Time wise Separate Offline Line Charts of Temp & Hum.
It includes DNS Server so that you can open any website or ip address to view graph after Connecting to AccessPoint "Temperature".
A I2C 7 Segment Led Backpack is connected to show Time (Date & Temp periodically).
The whole program and hardware is tested by me.
I haven't included Spiff Js Data and used the online script, so you have to store it in the Browser Cache Just by Visiting : chart.js tutorial page
Hardware:
I2C 7 Segment 4 Digit Led Backpack
DHT22 / DHT11
Esp8266 Board (Currently D1 Mini)
I2C DS3231 Module
Esp8266 Connected to PC/Laptop Via Serial (Or D1 Mini with cable)
Step 1: Software Libraries & Pinouts...
Software Side:
Arduino 1.6.5 with Esp8266 Addon
7 Segment Esp8266 Library: https://github.com/moeur/Arduino_ESP8266
Esp8266 I2C Ds3231 Library: https://github.com/jcw/rtclib
The newer DHT-sensor-library-master Library Requires:
Copy Adafruit_Sensor.h from https://github.com/adafruit/Adafruit_Sensor to
C:\Users\USERNAME\Documents\Arduino\libraries\DHT-sensor-library-master
Connect Esp8266 / D1 Mini Pins like this
i2c 7 segment <> D1 Mini / Esp8266
Gnd----------------------------------Gnd
Vcc-----------------------------------5V/3V
DIO------------------------------------D5 / IO 14
Clk-------------------------------------D0 / IO 16
i2c DS3231 Module <> D1 Mini / Esp8266
Gnd-------------------------------------Gnd
Vcc--------------------------------------5V/3V
SDA-------------------------------------D2 / IO 5
SCL--------------------------------------D1 / IO 4
DHT22/11 <> D1 Mini / Esp8266
By Front Side
Pin 1--------------------------------5V
Pin 2 -------------------------------D6 / IO 12
Pin3 ---Not Used
Pin4 ---------------------------------Gnd
I have Mentioned Esp8266 IO Pinouts Just for Ease of Readers...
Step 2: Program & Testing...
Open Arduino 1.6.5 and Select Esp12 or D1 Mini
Open the Attached Program File
Program it to board.
View Serial. You will see :
HTTP server started
DATE TIME.
2016/12/24 18:54:30
Let it format SPIFFS for Once Only.
Restart the module (Unplug / Push Reset and Reopen Com Window
, and it will show correct clock (programmed first time to ds3231 )
How to see offline Temp & Hum Data:
Open https://www.sitepoint.com/introduction-chart-js-2-... to cache the chart.js
Connect to "Temperature" open network.
Added DNS Server to * Addresses so you can:
Browse any Website/Page (If you have not assigned DNS Server Manually to PC/ Router)
Or
Browse 192.168.1.1
To See The Beautiful Offline Line Chart.
Refresh to see updated values after some minutes.
The Esp8266 Will Record Temperature & Humidity Time Wise After 1 Minute (Daily) until SPIFF is FULL!
Enjoy.