Air Quality Sensor Measurement RGB Matrix Output [P004]



 

https://www.youtube.com/watch?v=BxdZ1Tk4Mmw

 

https://www.youtube.com/watch?v=yhVOXsE28B4

 

 https://www.youtube.com/watch?v=vl9jQZMoH-o


*GitHubhttps://github.com/rdiot/rdiot-p004.git

 

* Parts

- Arduino Mega

- Air Quality Sensor (MQ135) [S037]

- 32x64 RGB LED Matrix P4 (LM-P4-SMD-RGB-LED) [D025]

- SI7021 Humidity Sensor (GY-21) [S068]

- Photo Resistor Module (KY-018) [S002]

 

* Contents

- Key Code

#include <Adafruit_GFX.h>   // Core graphics library

#include <RGBmatrixPanel.h> // Hardware-specific library

#include <MQ135.h>

 

#include <Wire.h>

int pin = A5; // Air Quality Sensor

 

// LED Matrix 

#define OE   9

#define LAT 10

#define CLK 11

#define A   A0

#define B   A1

#define C   A2

#define D   A3

RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64);

 

MQ135 gasSensor = MQ135(pin);

#define RZERO 76.63

 

double rzero;

double result;


int i=0;

 

double rzero;

double result;

 

void setup() {
  matrix.begin(); // LED Matrix init
  matrix.drawPixel(0, 0, matrix.Color333(7, 7, 7));
  delay(500);

  matrix.fillRect(0, 0, 64, 32, matrix.Color333(0, 7, 0));
  delay(3000);
}

 

void loop() {

  matrix.fillScreen(matrix.Color333(0, 0, 0));
  matrix.setCursor(1, 1);    // start at top left, with 8 pixel of spacin


  if (i==0) {
   rzero = gasSensor.getRZero(); // float
  }

  if (i>0) { 
   result = gasSensor.getRZero();
   rzero = (rzero + result)/2;
  }


  float co2_ppm = gasSensor.getPPM();


  matrix.println("rz:"+(String)rzero+" ");
  matrix.setCursor(1, 9);    // start at top left, with 8 pixel of spacing
  matrix.println("rs:"+(String)result+" ");
  matrix.setCursor(1, 16);    // start at top left, with 8 pixel of spacing
  matrix.println("D:"+(String)analogRead(pin)+" ");
  matrix.setCursor(1, 23);    // start at top left, with 8 pixel of spacing
  matrix.println("A:"+(String)co2_ppm+"ppm");

  i++;

  if(co2_ppm > 10)

  {

    matrix.drawRect(0, 0, 64, 32, matrix.Color333(0, 4, 7));

  }

  else

  {

  // matrix.drawRect(0, 0, 64, 32, matrix.Color333(0, 4, 7));

  }

  //cool down
  delay(1000);

}

Posted by RD IoT RDIoT

댓글을 달아 주세요

  1.  댓글주소 수정/삭제 댓글쓰기 2019.10.24 23:24

    비밀댓글입니다

ACS712T Current Sensor Module 20A (ACS712T) [B039]



https://www.youtube.com/watch?v=6NuyGoSPYO4


* Specs

Supply Voltage (VCC) 5Vdc Nominal

Measurement Range -20 to +20 Amps

Voltage at 0A VCC/2 (nominally 2.5Vdc)

Scale Factor 100 mV per Amp

Chip ACS712ELC-10A


* Contents

- Connect

VCC ---- 5V 

OUT ----- A0 

GND ----- GND 


Power+VCC -> Load/Sensor -> ACS712T (UP)

Power GND  ---------------> ACS712T (DOWN)


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004


const int analogIn = A0;

int mVperAmp = 100; // use 100 for 20A Module and 66 for 30A Module

int RawValue= 0;

int ACSoffset = 2512; // default 2500 but i checked when this is disconnected to 2512

double Voltage = 0;

double Amps = 0;


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");


  pinMode(analogIn,INPUT);

  delay(1000);


  lcd.clear();

}


void loop()

{

 

  lcd.setCursor(0,0);

  lcd.print("B039:ACS712T Current");


  RawValue = analogRead(analogIn);

  Voltage = (RawValue / 1023.0) * 5000; // Gets you mV

  Amps = ((Voltage - ACSoffset) / mVperAmp);


  lcd.setCursor(0,1);

  lcd.print("RawValue=" + (String)RawValue + "  ");


  lcd.setCursor(0,2);

  lcd.print("Voltage=" + (String)Voltage + "");


  lcd.setCursor(0,3);

  lcd.print("=>Current=" + (String)Amps + " A ");  


  delay(1500);

}

Posted by RD IoT RDIoT

댓글을 달아 주세요

Air Quality Sensor (MQ135) [S037]



https://www.youtube.com/watch?v=JJonDVX8CYQ


*GitHubhttps://github.com/rdiot/rdiot-s037.git


* Specs

Sensitive material of MQ135 gas sensor is SnO2, which with lower conductivity in clean air. When the

target combustible gas exist, The sensor’s conductivity is more higher along with the gas concentration

rising. Please use simple electrocircuit, Convert change of conductivity to correspond output signal of

gas concentration.

MQ135 gas sensor has high sensitity to Ammonia, Sulfide and Benze steam, also sensitive to smoke

and other harmful gases. It is with low cost and suitable for different application. 



* Contents

- Library : https://github.com/GeorgK/MQ135


- DataSheet : http://www.cooking-hacks.com/skin/frontend/default/cooking/pdf/MQ-135.pdf


- Connect


- Key Code

#include <MQ135.h>

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004

int pin = A0;

int sensorValue;

int ledPin = 13;


MQ135 gasSensor = MQ135(pin);

float rzero = gasSensor.getRZero();

int ppm = gasSensor.getPPM();


void loop()

{

 

  lcd.setCursor(0,0);

  lcd.print("S037:MQ135");



  sensorValue = analogRead(pin);

  lcd.setCursor(0,1);

  lcd.print("A0=" + (String)sensorValue + " Resis="+(String)gasSensor.getResistance() +" ");


  float rzero = gasSensor.getRZero();

  digitalWrite(ledPin, HIGH);      // turn the ledPin on

  delay(100);                      // stop the program for some time

  digitalWrite(ledPin, LOW);       // turn the ledPin off

  delay(100);  // stop the program for some time

 

  lcd.setCursor(0,2);

  lcd.print("rzero=" + (String)rzero + "    ");

 


  float co2_ppm = gasSensor.getPPM();

  int ppm = co2_ppm / 4;

  //Vrl = val * ( 5.00 / 1024.0  );      // V

  //Rs = 20000 * ( 5.00 - Vrl) / Vrl ;   // Ohm 

  //ratio =  Rs/Ro;     

  lcd.setCursor(0,3);

  lcd.print("co2 ppm=" + (String)co2_ppm + "    ");

    

  delay(1000);

}

Posted by RD IoT RDIoT

댓글을 달아 주세요