-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kube_v0_5_6.ino
479 lines (418 loc) · 31.7 KB
/
Kube_v0_5_6.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
// Modified Sketch for "The Kube" sensor, incorporating the ESP8266 with OLED screen, DHT22 sensor, OTA and the ability to incorporate other external sensors.
// ------------------------------------------------------------------------
// Created by:
// Jacques Laroche
// https://github.com/jlar0che
// ------------------------------------------------------------------------
// Current Version:
// 0.5.6
// Last Modified: 2/3/2022
// ------------------------------------------------------------------------
// Inspiration and base project:
// bkpsu:
// https://www.thingiverse.com/thing:2539897
//
// Borya:
// https://www.instructables.com/id/ESP8266-GMail-Sender/
// ------------------------------------------------------------------------
// NodeMCU Installation in Arduino IDE:
// ------------------------------------
// Start Arduino and open Preferences window.
// Enter https://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
// Open Boards Manager from Tools > Board menu and find esp8266 platform.
// Select the version you need from a drop-down box.
// Click install button.
// Don’t forget to select your ESP8266 board from Tools > Board menu after installation.
// ------------------------------------------------------------------------
// Necessary Libraries: Install the following
// ------------------------------------------
// Adafruit Unified Sensor by Adafruit (v 1.0.2 or higher)
// ArduinoOTA by Juraj Andrassy (v 1.0.0 or higher)
// DHT Sensor Library by Adafruit (v 1.3.0 or higher)
// ESP8266 and ESP32 Oled Driver for SSD1306 Display by ThingPulse, Fabrice Weinberg (v 4.0.0 or higher)
// ESP8266_mDNS by Mr. Dunk (v 1.17 or higher)
// WiFiManager by tzapu and maintained by tablatronix (v 0.12.0 or higher)
// ------------------------------------------------------------------------
// Important Resources:
// --------------------
// https://www.base64encode.org/ - For encoding your username (email) and email password into Base64
// http://tomeko.net/online_tools/cpp_text_escape.php?lang=en - For converting Text to C or C++ strings
/************ HARDWARE CONFIG (CHANGE THESE FOR YOUR SENSOR SETUP) ******************/
#define REMOTE //Uncomment to enable remote sensor functionality via Webserver (Wifi)
//#define OLED_SPI //Uncomment if using SPI OLED screen (assuming I2C otherwise)
#define CELSIUS //Uncomment if you want temperature displayed in Celsius, Comment out if you want Fahrenheit
//#define DEEP_SLEEP //Uncomment if you want sensor to sleep after every update (Does NOT work with MOTION_ON, LED_ON or OTA_UPDATE which require constant uptime)
//#define FLIP_SCREEN //Uncomment if mounting to wall with USB connector on top
//#define MOTION_ON //Uncomment if using motion sensor
//#define OLED_MOTION //Uncomment if you want screen to turn on only if motion is detected
//#define LED_ON //Uncomment if using as LED controller
//#define PRESS_ON //Uncomment if using as Pressure monitor
#define ANTI_BURNIN //Uncomment if you want the OLED to invert colors every time the sensor is updated (to prevent burnin)
/************ WIFI and OTA INFORMATION (CHANGE THESE FOR YOUR SETUP) ******************/
//#define wifi_ssid "your_wifi_ssid_here_(keep_the_quotes)" //enter your WIFI SSID
//#define wifi_password "your_wifi_password_here_(keep_the_quotes)" //enter your WIFI Password
#define device_name "Server Room" //device name displayed on LCD
/********************************************************************************************/
/****************************** DHT 22 Calibration settings *************/
float temp_offset = -7.0;
//float hum_offset = 14.9;
/************************************************************************/
/****************************** Declarations for Web Server *************/
float Temperature;
float TemperatureF;
float Humidity;
/************************************************************************/
/****************************** Declarations for Progress Bar ***********/
int counter = 1;
/************************************************************************/
#define DHTPIN 12 // (D6) what digital pin we're connected to (NodeMCU Breakout v1.2)
//#define MOTIONPIN 5 // (D1) what digital pin the motion sensor is connected to
#define PRESSPIN A0 // (A0) what analog pin the pressure sensor is connected to
#define DHTTYPE DHT22 // DHT 22/11 (AM2302), AM2321
#include "DHT.h"
#include <ESP8266WiFi.h>
#include <WiFiManager.h> //testing Wifimanager
#include <ESP8266WebServer.h> // For Web Server
ESP8266WebServer server(80);
#ifdef OLED_SPI
#include "SSD1306Spi.h" //OLED Lib for SPI version
#else
#include <Wire.h> // Only needed for Arduino 1.6.5 and earlier
#include "SSD1306.h" //OLED Lib for I2C version
#endif
#ifdef REMOTE
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#endif
DHT dht(DHTPIN, DHTTYPE);
unsigned long currentMillis = 60001; //Set so temperature is read on first scan of program
unsigned long previousMillis = 0;
unsigned long interval = 10000;
float h,t,f,p,h2,t2,f2,p2;//Added %2 for error correction
int motionState;
WiFiClient espClient;
//PubSubClient client(espClient);
#ifdef OLED_SPI
SSD1306Spi display(D10, D9, D8); //RES, DC, CS (SPI Initialization)
#else
SSD1306 display(0x3c, 0 /*D3*/, 2 /*D4*/); //Recommended Setup: to be able to use the USB Serial Monitor, use the configuration on this line
#endif
void setup() {
Serial.begin(9600);
dht.begin();
#ifdef MOTION_ON
pinMode(MOTIONPIN, INPUT);
#endif
#ifdef PRESS_ON
//pinMode(PRESSPIN, INPUT);
#endif
display.init(); // Initialize the Display
#ifdef FLIP_SCREEN
display.flipScreenVertically();
#endif
display.setFont(ArialMT_Plain_10);
display.setTextAlignment(TEXT_ALIGN_LEFT);
#ifdef REMOTE
setup_wifi();
#else
WiFi.mode(WIFI_OFF);
#endif
}
void setup_wifi() {
delay(10);
Serial.println();
Serial.println("Connecting to SSID: ");
Serial.println(wifi_ssid);
display.clear(); // clear the display
display.drawString(17, 10, "Connecting to SSID:"); // display.drawString(Horizontal, Vertical, "String");
display.drawString(0, 45, String(wifi_ssid));
display.display(); // write the buffer to the display
// Attempt to connect to Wifi, attempt connection for 10 seconds and show progress bar during this time
WiFi.mode(WIFI_STA);
WiFi.begin(wifi_ssid, wifi_password);
while (counter < 11) {
display.drawString(0, 20, "");
int progress = counter * 10;
display.drawProgressBar(0, 32, 120, 10, progress);
counter++;
display.display();
delay(1000);
}
// Test Connection
if (WiFi.status() != WL_CONNECTED) {
WiFi.mode(WIFI_OFF);
display.clear(); // clear the display
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString(5, 45, "[ WiFi NOT CONNECTED ]");
display.display(); // write the buffer to the display
delay(10000); // delay 10 seconds
display.clear(); // clear the display
}
else if (WiFi.status() == WL_CONNECTED) {
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
// Create String of IP Address
String currentIP = WiFi.localIP().toString();
display.clear(); // clear the display
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString(0, 5, "WiFi Connected");
display.drawString(0, 20, "IP: " + currentIP);
display.drawString(14, 45, "[ SYSTEM BOOTING ]");
display.display(); // write the buffer to the display
delay(5500); // delay 5.5 seconds
display.clear(); // clear the display
WiFiManager wifiManager;
wifiManager.autoConnect("AutoConnectAP");
server.on("/", handle_OnConnect);
server.onNotFound(handle_NotFound);
server.begin();
Serial.println("HTTP server started");
}
}
void drawDHT(float h, float t, float f, float p)
{
display.setFont(ArialMT_Plain_10);
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString(18,0, String(device_name));
// if statement logic for IP address
if (WiFi.status() == WL_CONNECTED) {
String currentIP = WiFi.localIP().toString();
display.drawString(22,9, "IP: " + String(currentIP));
}
else {
display.drawString(22,9, "IP: n/a");
}
display.setFont(ArialMT_Plain_24);
display.setTextAlignment(TEXT_ALIGN_CENTER);
#ifdef CELSIUS
display.drawString(60,24, String(t,1) + " *C");
#else
display.drawString(60,24, String(f,1) + " *F");
#endif
display.setFont(ArialMT_Plain_10);
#ifdef PRESS_ON
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString(0,44,"Prs: ");
display.setTextAlignment(TEXT_ALIGN_RIGHT);
display.drawString(120,44, String(p) + "i");
#endif
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString(0,53,"Humidity:");
display.setTextAlignment(TEXT_ALIGN_RIGHT);
display.drawString(124,53, String(h,1) + " %");
}
// Web Server Code --------------[ BEGIN ]-------------------
void handle_OnConnect() {
Temperature = dht.readTemperature() + temp_offset; // Gets the values of the Temperature in Celcius
TemperatureF = (Temperature * 1.8) + 32; // Converts the Temperature from Celcius to Fahrenheit
Humidity = dht.readHumidity(); // Gets the values of the humidity
server.send(200, "text/html", SendHTML(Temperature, TemperatureF, Humidity));
}
void handle_NotFound() {
server.send(404, "text/plain", "Not found");
}
String SendHTML(float Temperature, float TemperatureF, float Humidity) {
String ptr = "<!DOCTYPE html> <html>\n";
ptr += "<title>ESP8266: FMK Server Room</title>\n";
ptr += "<meta charset=\"UTF-8\">\n";
ptr += "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n";
ptr += "<META HTTP-EQUIV=\"refresh\" CONTENT=\"15\">\n";
ptr += "<link rel=\"stylesheet\" href=\"https://www.w3schools.com/w3css/4/w3.css\">\n";
ptr += "<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Montserrat\">\n";
ptr += "<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css\">\n";
ptr += "<style>\n";
ptr += "body, h1,h2,h3,h4,h5,h6 {font-family: \"Montserrat\", sans-serif}\n";
ptr += ".w3-row-padding img {margin-bottom: 12px}\n";
ptr += ".bgimg {\n";
ptr += " background-position: center;\n";
ptr += " background-repeat: no-repeat;\n";
ptr += " background-size: cover;\n";
ptr += " background-image: url(\"https://fmk.singidunum.ac.rs/wp-content/uploads/2020/01/FMK-Server_Room-medium.jpg\");\n";
ptr += " min-height: 100%;\n";
ptr += "}\n";
ptr += "</style>\n";
ptr += "<body>\n";
ptr += "\n";
ptr += "<!-- Hidden Sidebar (reveals when clicked on menu icon)-->\n";
ptr += "<nav class=\"w3-sidebar w3-black w3-animate-right w3-xxlarge\" style=\"display:none;padding-top:150px;right:0;z-index:2\" id=\"mySidebar\">\n";
ptr += " <a href=\"javascript:void(0)\" onclick=\"closeNav()\" class=\"w3-button w3-black w3-xxxlarge w3-display-topright\" style=\"padding:0 12px;\">\n";
ptr += " <i class=\"fa fa-remove\"></i>\n";
ptr += " </a>\n";
ptr += " <div class=\"w3-bar-block w3-center\">\n";
ptr += " This site was created by Jacques Laroche\n";
ptr += " <a href=\"https://www.linkedin.com/in/jacques-laroche-07032b174/\" target=\"_blank\" class=\"w3-bar-item w3-button w3-text-grey w3-hover-red\" >Linkedin</a>\n";
ptr += " </div>\n";
ptr += "</nav>\n";
ptr += "\n";
ptr += "<!-- Page Content -->\n";
ptr += "<div class=\"w3-main w3-padding-large\">\n";
ptr += "\n";
ptr += " <!-- Menu icon to open sidebar -->\n";
ptr += " <span class=\"w3-button w3-top w3-white w3-xxlarge w3-text-grey w3-hover-text-black\" style=\"width:auto;right:0;\" onclick=\"openNav()\"><i class=\"fa fa-bars\"></i></span>\n";
ptr += "\n";
ptr += " <!-- Header -->\n";
ptr += " <header class=\"w3-container w3-center\" style=\"padding:35px 16px\" id=\"home\">\n";
ptr += " <h1 class=\"w3-jumbo\"><img alt=\"\" src=\"data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAAyAAD/4QNzaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjYtYzE0NSA3OS4xNjM0OTksIDIwMTgvMDgvMTMtMTY6NDA6MjIgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6ODUxMjlDRjVEQTVGRTcxMUIzQTQ5NTU3RkRDRDM0QzIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RjcwNTc1MDQzQUM4MTFF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RSlKIRSlKIT/2Q==\" /><b>Server Room Temp Reading</b></h1>\n";
ptr += " </header>\n";
ptr += "\n";
ptr += "<center><h1>\n";
ptr += "<p>Temperature: ";
ptr += (int)Temperature;
ptr += " C | ";
ptr += (int)TemperatureF;
ptr += " F</p>";
ptr += "<p>Humidity: ";
ptr += (float)Humidity;
ptr += "%</p>";
ptr += "</center></h1>\n";
ptr += "\n";
ptr += " <!-- About Section -->\n";
ptr += " <div class=\"w3-content w3-justify w3-text-grey w3-padding-32\" id=\"about\">\n";
ptr += " <h2>About</h2>\n";
ptr += " <hr class=\"w3-opacity\">\n";
ptr += " <p>Temperature and Humidy readings from a <a href=\"https://www.adafruit.com/product/385\">DHT22 sensor</a> running on a <a href=\"https://www.nodemcu.com/index_en.html\">ESP8266 NodeMCU</a> microcontroller. The details of this project can be found on my Github page.\n";
ptr += " <br><br><b>NOTE:</b> <u>This page automatically refreshes every 15 seconds.</u>\n";
ptr += " </p>\n";
ptr += "\n";
ptr += "\n";
ptr += " <button onclick=\"window.open('https://github.com/jlar0che/NodeMCU-Interface','_blank');\" class=\"w3-button w3-light-grey w3-padding-large w3-section\">\n";
ptr += " <i class=\"fa fa-github\"></i> Follow this Project on Github\n";
ptr += " </button>\n";
ptr += "\n";
ptr += "\n";
ptr += "\n";
ptr += "\n";
ptr += " <!-- End About Section -->\n";
ptr += " </div>\n";
ptr += "\n";
ptr += "\n";
ptr += "\n";
ptr += " <!-- Footer -->\n";
ptr += " <footer class=\"w3-container w3-padding-64 w3-light-grey w3-center w3-opacity w3-xlarge\" style=\"margin:-24px\">\n";
ptr += " Follow me:\n";
ptr += " <a href=\"https://github.com/jlar0che\" target=\"_blank\"><i class=\"fa fa-github w3-hover-opacity\"></i></a>\n";
ptr += " <a href=\"https://www.linkedin.com/in/jacques-laroche-07032b174/\" target=\"_blank\"><i class=\"fa fa-linkedin w3-hover-opacity\"></i></a>\n";
ptr += " <p class=\"w3-medium\">Powered by <a href=\"https://www.w3schools.com/w3css/default.asp\" target=\"_blank\" class=\"w3-hover-text-green\">w3.css</a></p>\n";
ptr += " <!-- End footer -->\n";
ptr += " </footer>\n";
ptr += "\n";
ptr += "<!-- END PAGE CONTENT -->\n";
ptr += "</div>\n";
ptr += "\n";
ptr += "<script>\n";
ptr += "// Open and close sidebar\n";
ptr += "function openNav() {\n";
ptr += " document.getElementById(\"mySidebar\").style.width = \"100%\";\n";
ptr += " document.getElementById(\"mySidebar\").style.display = \"block\";\n";
ptr += "}\n";
ptr += "\n";
ptr += "function closeNav() {\n";
ptr += " document.getElementById(\"mySidebar\").style.display = \"none\";\n";
ptr += "}\n";
ptr += "</script>\n";
ptr += "\n";
ptr += "</body>\n";
ptr += "</html>\n";
return ptr;
}
// Web Server Code --------------[ END ]---------------------
void loop() {
char strCh[10];
String str;
//#ifdef REMOTE
// if (!client.loop()) {
// reconnect();
// }
//#endif
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
h = dht.readHumidity();
// Read temperature as Celsius (the default)
t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
//f = dht.readTemperature(true);
f = ((t + temp_offset) * 1.8) + 32;
// Read pressure (if external pressure sensor connected)
p = analogRead(PRESSPIN);
p = ((p/1023)*16.6246)-8.3123; //Convert analog value from MPXV7002 differential pressure sensor to psi range (-8...8 in/h2O) via formula ((ain/max_analog)*full range)-offset
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
//h=t=f=-1;
t=t2;//Writes previous read values if the read attempt failed
f=f2;
h=h2;
}
else { //add offsets, if any
//t = t + ((5 / 9) * temp_offset);
t = t + temp_offset;
//f = f + temp_offset;
//h = h + hum_offset;
h2=h;//Store values encase next read fails
t2=t;
f2=f;
}
// Compute heat index in Fahrenheit (the default)
float hif = dht.computeHeatIndex(f, h);
// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);
Serial.print("Humidity: ");
Serial.print(h,1);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t,1);
Serial.print(" *C ");
Serial.print(f,1);
Serial.print(" *F\t");
Serial.print("Heat index: ");
Serial.print(hic,1);
Serial.print(" *C ");
Serial.print(hif,1);
Serial.println(" *F");
Serial.print(p,1);
Serial.println(" in/H2O");
Serial.println(""); // space out Serial info so it is easier to read
#ifdef ANTI_BURNIN
display.invertDisplay();
display.display();
#endif
display.clear();
display.normalDisplay();
#ifdef OLED_MOTION //Clears display on each loop if OLED Motion is active, otherwise prints display as usual
display.clear();
#else
drawDHT(h,t,f,p);
#endif
display.display();
}
currentMillis = millis();
#ifdef MOTION_ON
motionState = digitalRead(MOTIONPIN);
// print out the state of the button:
if (motionState == 1)
{
Serial.println("Motion Event:");
display.setTextAlignment(TEXT_ALIGN_RIGHT);
display.drawString(120,0, "M");
#ifdef OLED_MOTION//Writes the whole display if motion is sensed, otherwise just the "M"
drawDHT(h,t,f,p);
#endif
display.display();
delay (10000);
display.clear();
drawDHT(h,t,f,p);
display.display();
}
#else
#ifdef DEEP_SLEEP
#ifndef OTA
ESP.deepSleep(60000000,WAKE_RF_DEFAULT); //If a motion sensor is not being used, we can put ESP into deep-sleep to save energy/wifi channel
#endif
#endif
#endif
if (WiFi.status() == WL_CONNECTED) {
server.handleClient();
}
}