Air Quality to TFT monitor

  • admin
  • admin's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
More
1 month 1 week ago #79 by admin
Air Quality to TFT monitor was created by admin
Air Quality to TFT monitor





MQ-135 sensor introduction:

The gas sensitive material used with the MQ135 gas sensor is tin dioxide (SnO2), which has a lower conductivity in clean air. When contaminated gas is present in the environment

where the sensor is located, the conductivity of the sensor increases as the concentration of contaminated gas in the air increases. A simple circuit converts the change in conductivity into an output signal that corresponds to the gas concentration.

The MQ135 sensor is highly sensitive to ammonia, sulphides and benzene vapors and is also ideal for smoke and other harmful monitoring. This sensor can detect a variety of harmful gases, is a low-cost sensor for a variety of applications.

Module application:

It is suitable for the detection of harmful gases such as ammonia, aromatics, sulfides, benzene vapor, smoke and other harmful gas detection devices, gas sensor testing range of concentration: 10 to 1000ppm

/*MQ135 with ST7789 IPS SPI 240X240 display without CS pin.
by somtips.com
*/
#include <Arduino.h>
#include <MQ135.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>    // Core graphics library by Adafruit
#include <Adafruit_ST7789.h>
// ST7789 TFT module connections
#define TFT_CS    10  // define chip select pin
#define TFT_DC     8  // define data/command pin
#define TFT_RST    9  // define reset pin, or set to -1 and connect to Arduino RESET pin
// initialize Adafruit ST7789 TFT library with hardware SPI module
// MOSI(SDA) ---> Arduino digital pin 11
// SCK (SCL) ---> Arduino digital pin 13

Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);

int led1 = 2; // Red
int analogPin = 0;
int val = 0;

void setup() {
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);

  tft.init(240, 240, SPI_MODE2);   // initialize a ST7789 chip, 240x240 pixels
  tft.setRotation(3);
  tft.fillScreen(ST77XX_YELLOW);
  tft.setCursor(45, 90);
  tft.setTextColor(ST77XX_BLACK);
  tft.setTextSize(7);
  tft.println("Wait");

  delay(25000);

  tft.fillScreen(ST77XX_GREEN);
  tft.setCursor(20, 10);
  tft.setTextColor(ST77XX_BLACK);
  tft.setTextSize(3);
  tft.println("Air Quality");
  tft.setCursor(80, 200);
  tft.setTextColor(ST77XX_BLACK);
  tft.setTextSize(4);
  tft.println("PPM");
}

void loop() {
  int sensorValue = analogRead(A0);
  digitalWrite(led1, LOW);

if (sensorValue > 0 && sensorValue < 200) tft.fillRect(0,40,240,150,ST77XX_BLUE); 
 if (sensorValue > 200 && sensorValue < 400)tft.fillRect(0,40,240,150,ST77XX_MAGENTA);
  if (sensorValue > 400)tft.fillRect(0,40,240,150,ST77XX_RED);
  tft.setCursor(45, 90);
  tft.setTextColor(ST77XX_WHITE);
  tft.setTextSize(9);
  tft.println(sensorValue);
  delay(100);
  if (sensorValue > 400)digitalWrite(led1, HIGH);
  delay(1000);

}

Source: Air Quality to TFT monitor
Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.095 seconds
Powered by Kunena Forum