Abstract
Summer is showing its warm red colour, this small exercise of temperature monitoring was carried out to see technically if the Green of trees gives some relief against the Red hot of summer or not. We already know trees make much difference in temperature and weather, we have felt that. With this we also learn how easy it is to make our own temperature monitoring device that can report temperature readings to cloud through WiFi connectivity and we can easily access readings through mobile phone.
How to make our own temperature monitoring device.
We can order below items online to make a Temperature monitoring device with internet connectivity.
1. ESP32 or ESP8266 for WiFi connectivity
2. DHT11 temperature and humidity sensor
3. Power bank to supply 5 V ( you might have this already)
4. Jumper cables
For the software part, we will use Arduino IDE. We will use DHT 11 Arduino library for DHT 11 temperature sensor and Firebase library for internet connectivity. There are so many examples already available for DHT11 for Arduino. We can check separate example libraries separately for DHT and Firebase, once we are able to get the readings of temperature using the DHT library, we can use the Firebase library to send it to the Firebase real-time database. For that, we need to create a project in the Google Firebase. We can also make a simple web server-based program without using Firebase if we want data only on the local network without the internet.
Below is the sample Arduino code that can be used directly.
#include <WiFi.h>
#include <FirebaseESP32.h>
#include "DHT.h"
#define DHTPIN 4 // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
// Change the following info
#define FIREBASE_HOST "https://xxxxxxx.firebaseio.com/"
#define FIREBASE_AUTH "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
#define WIFI_SSID "XXXXXXXX"
#define WIFI_PASSWORD "XXXXXXXX"
// Define FirebaseESP8266 data object for data sending and receiving
FirebaseData firebaseData;
void setup()
{
Serial.begin(115200);
dht.begin();
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
Firebase.reconnectWiFi(true);
}
void loop()
{
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
float hi = dht.computeHeatIndex(f, h);
float hiDegC = dht.convertFtoC(hi);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
else
{
Serial.println(h);
Serial.println(F("%"));
Serial.println(t);
Serial.println(F("c"));
Serial.println(f);
Serial.println(F("f"));
Serial.print("Heat index: ");
Serial.print(hiDegC);
Serial.print(" *C ");
Serial.print(hi);
Serial.print(" *F ");
Firebase.setInt(firebaseData, "/Celcius", t))
Firebase.setInt(firebaseData, "/Fahrenheit", f))
Firebase.setInt(firebaseData, "/Humidity", h))
Firebase.setInt(firebaseData, "/HeatIndex", hiDegC))
}
}
Once we are ready with the software, we need to program the ESP32 with our software and make connections as per the circuit block diagram then power on using the power bank. You can also program the ESP32 to connect with your mobile hot spot so that you can carry the device with your mobile phone and observe the real-time monitoring of the temperature and humidity in your mobile screen.
Figure 1: Hardware Connections.
Below is the circuit diagram and the screenshot showing the temperature and humidity readings on the firebase console on the mobile screen.
Figure 2: Circuit Block Diagram
Figure 3: real-time temperature monitoring in firebase
Now, it's time to monitor the temperature in different surroundings and the environment to see the effect. This is for our personal experience only, for getting actual effect and conclusion, there are so many factors to be considered and there are so many researches available and ongoing. So let’s see if we can get some difference or not.
Before starting our exercise let's check some facts, even though the results of measuring air temperature in areas with more trees and comparing them with results from nearby areas without trees are not sufficient and are disappointing, it is a fact that trees provide cooling through shades and evapotranspiration. Trees cool down the ground surface by protecting it from direct sunlight and they cool down the air by evaporating water through their leaves. Through evaporative cooling, they can decrease the air temperature by several Fahrenheit. This effect is most effective at midday and peak summer.
Test Cases
We will monitor temperature, humidity, and heat index at various environments and surroundings like, inside the home, outside home, under the tree shadow, without shadow, with concrete shadow, in area with more trees, near by roads, near bare soil, farms, land with green grass, near pond, in-car parked under the tree shadow, parked without any shadow, parked under concrete shadow, etc. Below are some test results for the test carried out so far. These test results are average of so many readings carried out during that time.
Below table shows readings between 9 to 10 AM :
Environment | Celsius | Fahrenheit | heat index | humidity |
online weather update | 33 | 92 | 37 | 53 |
in a room with fan | 32 | 90 | 45 | 77 |
outside direct sunlight | 45 | 114 | 64 | 39 |
outside with concrete shadow | 34 | 93 | 47 | 70 |
under small tree shadow | 33 | 91 | 47 | 76 |
Table:1 Temperature readings between 9 to 10 AM
Below table shows readings at around 3 to 4 PM
Environment | Celsius | Fahrenheit | heat index | humidity |
online weather update | 38 | 100 | 39 | 25 |
in room with fan | 34 | 94 | 44 | 61 |
outside direct sunlight | 47 | 116 | 67 | 40 |
outside with concrete shadow | 38 | 100 | 49 | 50 |
outside under small tree shadow | 35 | 95 | 50 | 67 |
Table:2 Temperature readings between 3 to 4 PM
We can see that there is no much difference in temperature even though we feel the difference in the morning time but we can easily identify the difference at afternoon readings, and still, these readings are not enough to come to a conclusion but still the test is going on with different environments and different factors. Below is the graph plotted based on temperature reported half-hourly to the database from the forest village area vs the nearby city area using two temperature monitoring devices. Again we need to consider that there are multiple factors on which the temperature depends and not only on trees.
Figure 4: Graph showing the temperature of forest vs city area throughout the day
Conclusion
Yet to be concluded, but from a small set of observations and test cases, we can say that the Green can win Red. And we learn how to make a temperature monitoring system with IoT connectivity and can utilize it in different applications as well.
References
[1] https://medium.com/@vibrologic/serverless-iots-with-firebase-realtime-database-and-esp32-2d86eda06ff1.
[2] https://create.arduino.cc/projecthub/pibots555/how-to-connect-dht11-sensor-with-arduino-uno-f4d239.
[3] https://climate-woodlands.extension.org/trees-and-local-temperature/