Maker Pro
Arduino

Interfacing GP2Y1014AU0F Sensor with Arduino

June 09, 2021 by rasika Joshi
 
Share
banner

Let's Interface the Sharp GP2Y1014AU0F Sensor with Arduino to estimate the Dust Density in Air.

Summery

Let's Interface the Sharp GP2Y1014AU0F Sensor with Arduino to estimate the Dust Density in Air.

About Project

Sharp's GP2Y1014AU0F is basically a six-pin analog output optical air quality analyzer that is specifically outlined to sense dust particles in the air. It operates on the principle of laser scattering. When air involving dust particles enters into the specific sensor chamber, the dust particles disperse the IR LED light towards the photodetector. The intensity of the scattered light relies on the dust particles. The higher the dust particles in the air, the significant the intensity of light.

GP2Y1014AU0F Sensor.jpg

Organic Light-Emitting Diodes is a self-light-emitting technology, designed by placing a series of organic thin films in between two conductors. A bright light is generated when an electric current is implemented in these films. OLEDs are utilizing the same technology as televisions, but have fewer pixels than most TVs.

While doing soldering, make sure your solder wires should be at a sufficient distance from each other.

Learn more about the Internet of Things Training

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
 
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
 
// Declaration for SSD1306 display connected using software SPI (default case):
#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
 
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
  OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
 
int measurePin = A5;
int ledPower = 7;
  
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
  
void setup(){
  Serial.begin(9600);
  pinMode(ledPower,OUTPUT);
  display.begin(SSD1306_SWITCHCAPVCC);
  display.clearDisplay();
  display.display();
}
  
void loop(){
  digitalWrite(ledPower,LOW);
  delayMicroseconds(280);
 
  voMeasured = analogRead(measurePin);
 
  delayMicroseconds(40);
  digitalWrite(ledPower,HIGH);
  delayMicroseconds(9680);
 
  calcVoltage = voMeasured*(5.0/1024);
  dustDensity = 0.17*calcVoltage-0.1;
 
  if ( dustDensity < 0)
  {
    dustDensity = 0.00;
  }
  
  Serial.println("Raw Signal Value (0-1023):");
  Serial.println(voMeasured);
 
  Serial.println("Voltage:");
  Serial.println(calcVoltage);
 
  Serial.println("Dust Density:");
  Serial.println(dustDensity);
   
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(85,22);
  display.println("Dust");
  display.setCursor(85,38);
  display.println("Density");
  display.setTextSize(3);
  display.setCursor(0,13);
  display.println(dustDensity);
  display.setCursor(6,43);
  display.setTextSize(2);
  display.println("ug/m3");
  display.display();
  display.clearDisplay();
  
  delay(1000);
}

Author

Avatar
rasika Joshi

hIoTron offers an End-to-End IoT Training with live use cases using IoT hardware kit.

Related Content

Comments


You May Also Like