Home
About Us
Achievement
Home
Raspberry-Pi Projects
_Raspberry Pi 4 Complete Guide
Arduino Project
_All Projects
Esp8266 Project
_All Projects
Esp32 Project
_Automation-with-feedback
IoT Based Air Quality Monitoring
Just Do Electronics
May 05, 2020
Circuit Diagram :-
Code :-
//Prateek //www.prateeks.in #include
#include
#include
#include "MQ135.h" #include
#include
#define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 #define OLED_RESET -1 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); String apiKey = "3GXEV3B944KWTGQU"; const char* ssid = "justDo"; const char* password = "pratik123"; const char* server = "api.thingspeak.com"; WiFiClient client; void setup() { Serial.begin(115200); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.clearDisplay(); delay(10); Serial.println("Connecting to "); Serial.println(ssid); display.clearDisplay(); display.setCursor(0,0); display.setTextSize(1); display.setTextColor(WHITE); display.println("Connecting to "); display.setTextSize(2); display.print(ssid); display.display(); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); display.clearDisplay(); display.setCursor(0,0); display.setTextSize(1); display.setTextColor(WHITE); display.print("WiFi connected"); display.display(); delay(4000); } void loop() { MQ135 gasSensor = MQ135(A0); float air_quality = gasSensor.getPPM(); Serial.print("Air Quality: "); Serial.print(air_quality); Serial.println(" PPM"); Serial.println(); display.clearDisplay(); display.setCursor(0,0); display.setTextSize(1); display.setTextColor(WHITE); display.println("Air Quality Index"); display.setCursor(0,20); display.setTextSize(2); display.setTextColor(WHITE); display.print(air_quality); display.setTextSize(1); display.setTextColor(WHITE); display.println(" PPM"); display.display(); if (client.connect(server, 80)) { String postStr = apiKey; postStr += "&field1="; postStr += String(air_quality); postStr += "r\n"; client.print("POST /update HTTP/1.1\n"); client.print("Host: api.thingspeak.com\n"); client.print("Connection: close\n"); client.print("X-THINGSPEAKAPIKEY: " + apiKey + "\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.println("Data Send to Thingspeak"); } client.stop(); Serial.println("Waiting..."); delay(2000); }
Photo
1 Comments
Unknown
6 June 2021 at 02:22
Hi, where do you draw the circuit diagram?
Reply
Delete
Replies
Reply
Add comment
Load more...
Newer
Older
ESP32 Interfacing With LDR Sensor
Build Your Own Gps Tracking System using Arduino
IoT Based Fingerprint Biometric Attendance System Using NodeMCU (Esp8266)
Ultrasonic Sensor as a Counter with Arduino
ESP32 Led Blink With Push Button
ESP32 Interfacing Potentiometer
Measure CO2 Level in Air Using Arduino
Play Audio Sound With Esp8266 With Blink App
IoT Based Patient Health Monitoring System Using Blynk App
Vehicle Accident Alert System Using Accelerometer GPS And GSM
YouTube
Like on Facebook
Follow on Twitter
Follow on Google+
Follow on Instagram
Subscribe on Youtube
Hi WelCome To My Website If you have a creative mind and want to learn Electronics even without studying it then FRIENDS this Website And Youtube Channel is for you, I am crazy creators who love making Electronics things. I have a bunch of more than 130 Tutorial Videos on My YouTube Channel and I upload a new Tutorial every Sunday.
Tags
Arduino Project
Esp32 Project
Esp8266 Project
1 Comments
Hi, where do you draw the circuit diagram?
ReplyDelete