Optical Dust Sensor (Sharp GP2Y10) library for Arduino framework.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
readme
LICENSE
README.md
SharpGP2Y10.cpp
SharpGP2Y10.h

README.md

Optical-Dust-Sensor-Library

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

Examples: https://github.com/lnquy065/Optical-Dust-Sensor-Library/blob/master/example/

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()