Skip to content

lnquy065/OpticalDustSensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optical-Dust-Sensor-Library

Optical Dust Sensor (Sharp GP2Y10) library for Arduino framework. Tested on PlatformIO, ArduinoIDE.

Schematic

Components

  • Arduino Nano
  • Sharp GP2Y10 Dust Sensor
  • 150Ω Resistor
  • 220uF Capacitor

SharpGP2Y10 Library

Using

  • Include SharpGP2Y10 library
#include "SharpGP2Y10.h"
  • Create SharpGP2Y10 Object with parameters
int voPin = A0;
int ledPin = 2;
SharpGP2Y10 dustSensor(voPin, ledPin);
  • Get and print dust density
float dustVal = dustSensor.getDustDensity();
Serial.println(dustVal);

Constructors

  • SharpGP2Y10(int voPin, int ledPin)

    • voPin: Vo (5)
    • ledPin: LED (3)
    • Notice: default vcc is 5.0v
  • SharpGP2Y10(int voPin, int ledPin, float vcc)

    • voPin: Vo (5)
    • ledPin: LED (3)
    • vcc: Voltage reference (5.0, 3.3, ...)

Methods

Get fields value only

  • float getDustDensityField()
  • float getVotageField()
  • int getADCField()

Read new value from sensor before return

  • float getDustDensity()
  • float getVotage()
  • int getADC()

About

Optical Dust Sensor (Sharp GP2Y10) library for Arduino framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages