Professional Documents
Culture Documents
Experiment-5
IoT Domain Analyst
Submitted to:
Prof . Prasanna Bharathi
Temperature and Humidity Monitoring
Aim : Atmospheric monitoring using ESP8266 – NODEMCU 12Ewith MQ135 and
DHT11and Thingspeak Cloud Computing.
Thoery :
1. Introduction:
2. Components:
3. Working Principle:
- The ESP8266 collects data from the MQ135 and DHT11 sensors through analog and
digital interfaces, respectively.
- The MQ135 detects gases in the air based on their resistance changes. These changes
are converted to gas concentration levels.
- The DHT11 measures humidity and temperature and provides digital signals for the
microcontroller to interpret.
4. Calibration:
- Calibration of the sensors is essential for accurate readings. This involves exposing
the sensors to known concentrations of gases and humidity and adjusting the readings
accordingly.
5. Data Transmission:
- Thingspeak enables cloud computing by storing and processing data remotely. Users
can access the data through web interfaces or APIs.
- Cloud computing facilitates the aggregation of data from multiple devices, allowing
for comprehensive analysis and decision-making.
7. Applications:
Procedure :
Connect the MQ135 gas sensor to the analog pin of the ESP8266 (NODEMCU
12E).
Connect the DHT11 sensor to the digital pin of the ESP8266 (NODEMCU 12E).
Power the sensors and ESP8266 appropriately.
Install the Arduino IDE and necessary libraries for ESP8266, MQ135, and DHT11.
Write a program to read data from MQ135 and DHT11 sensors.
Implement calibration for accurate sensor readings.
Configure the ESP8266 to connect to Wi-Fi.
Create a Thingspeak account and set up a new channel.
Note down the API key provided by Thingspeak for data transmission.
Modify the Arduino code to include Thingspeak API key and update frequency.
Expose the sensors to a known concentration of gases for MQ135.
Adjust sensor readings based on calibration results.
Upload the Arduino code to the ESP8266.
Monitor the serial output to ensure the sensors are providing accurate data.
Check if the ESP8266 successfully connects to Wi-Fi and transmits data to
Thingspeak. a. Visit the Thingspeak channel to visualize the real-time data.
Explore different visualization options and configure the channel settings.
If issues arise, check wiring connections and sensor calibration.
Verify the Wi-Fi connectivity of the ESP8266.
Monitor serial output for debugging information. a. Once testing is successful,
deploy the atmospheric monitoring system in the desired location.
b. Ensure continuous power supply for long-term monitoring.
Utilize Thingspeak's analytics tools for in-depth analysis of collected data.
Explore trends and patterns in air quality and environmental conditions.
Document the entire setup, including hardware connections, software code, and
calibration results.
Provide instructions for future maintenance and updates.
Circuit :
Properties :
Code:
#include <DHT.h> // Including library for dht
#include <ESP8266WiFi.h>
String apiKey = ""; // Enter your Write API key from ThingSpeak
const char *ssid = ""; // replace with your wifi ssid and wpa2 key
WiFiClient client;
void setup()
Serial.begin(115200);
delay(10);
dht.begin();
Serial.println("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
}
void loop()
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t))
return;
}
postStr += "&field1=";
postStr += String(t);
postStr += "&field2=";
postStr += String(h);
postStr += "\r\n\r\n";
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(postStr.length());
client.print("\n\n");
client.print(postStr);
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(h);
client.stop();
Serial.println("Waiting...");
delay(1000);
}
Output :
Inference:
The implemented atmospheric monitoring system utilizing ESP8266, MQ135, and DHT11 sensors,
integrated with Thingspeak cloud computing, offers a cost-effective and efficient solution for real-
time data collection, enabling informed decision-making in environmental monitoring.
Result:
Hence, Atmospheric monitoring has been done using ESP8266 – NODEMCU 12Ewith MQ135
and DHT11and Thingspeak Cloud Computing