하은gledel김다빈남궁윤
Created November 12, 2018 © GPL3+

Microdust index scale

we made a machine that showed the level of find dust

IntermediateFull instructions provided16 hours105
Microdust index scale

Things used in this project

Story

Read more

Code

dust sensor

Arduino
using dust sensor
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <LCD.h>


#define I2C_ADDR          0x27        
#define BACKLIGHT_PIN      3
#define En_pin             2
#define Rw_pin             1
#define Rs_pin             0
#define D4_pin             4
#define D5_pin             5
#define D6_pin             6
#define D7_pin             7


LiquidCrystal_I2C      lcd(I2C_ADDR, En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

int dustPin=0;
float dustVal=0;
float dustDensity = 0;

int ledPower=2;
int delayTime=280;
int delayTime2=40;
float offTime=9680;

void setup(){
  Serial.begin(9600);
  pinMode(ledPower,OUTPUT);
  pinMode(4, OUTPUT);
  lcd.begin (16,2);
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
}
 
void loop(){
  digitalWrite(ledPower,LOW); // power on the LED
  delayMicroseconds(delayTime);

  dustVal=analogRead(dustPin); // read the dust value via pin 5 on the sensor
  delayMicroseconds(delayTime2);

  digitalWrite(ledPower,HIGH); // turn the LED off
  delayMicroseconds(offTime);
 
  delay(3000);

  dustDensity = 0.17*(dustVal*0.0049)-0.1;
  Serial.print("Dust density(mg/m3) = ");
  Serial.println(dustDensity);

  lcd.setCursor(0,0);
  lcd.print("Fine Dust Density : ");
  lcd.print(dustDensity);
  lcd.print("mg/m3");

}

Credits

하은
1 project • 0 followers
Contact
gledel
100 projects • 116 followers
Looking back on my childhood, I was happy when I was making something and I was proud of myself. "Making is instinct!"
Contact
김다빈
1 project • 0 followers
Contact
남궁윤
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.