Git Product home page Git Product logo

gp2y1010_dustsensor's Introduction

GP2Y1010_DustSensor

Arduino IDE library for operating SHARP GP2Y1010AU0F dust sensor in ESP-WROOM-02/32(esp8266/ESP32) or Arduino
version 0.4

Credits and license

License MIT

How to use

  • Include this library to your Arduino IDE.

  • Wiring GP2Y1010AU0F sensor to your Arduino or ESP-WROOM-02/32.

    From left side,
    GP2Y1010AU0F blue wire -> Arduino Vout(5V or 3.3V) via 150 ohm register, and Arduino GND via 220uF Capacitor
    GP2Y1010AU0F green wire -> Arduino GND
    GP2Y1010AU0F white wire -> Arduino Digital pin
    GP2Y1010AU0F yellow wire -> Arduino GND
    GP2Y1010AU0F black wire -> Arduino Analog pin (if you use ESP-WROOM-02(esp8266), connect TOUT pin.) # show below warning.
    GP2Y1010AU0F red wire -> Arduino Vout(5V or 3.3V)

    warning:

    • ESP-WROOM-02(esp8266) analog(TOUT) pin support under 1V , you must make 1V from 5V or 3.3V using a voltage divider.
    • you must blue/red wires(Vin) and black wire(Analog out) are wiring same voltage pins. (DO not wire 5V input and 3.3V outout.)
    • ESP32 ADC GPIOs support under 3.3V. so, it's easy to blue/red wires(Vin) wiring to 3.3V output, and black wire(analog out) wiring to ADC GPIO.
  • Read sample source code. It's very simple !

caution

  • this library DOES NOT support GP2Y1014AU0F dust sensor.

GP2Y1010_DustSensor library function

Constractor

  • GP2Y1010_DustSensor
    normal constractor. if you use this constractor, you must execute begin() function after this constractor execute.

  • GP2Y1010_DustSensor(int ledPin, int measurePin)
    setting pins, and initialize sensor.
    ledPin: set white wire digital pin no.
    measurePin: set black wire analog pin no.

public function

  • void begin(int ledPin, int measurePin)
    setting pins, and initialize sensor.
    ledPin: set white wire digital pin no.
    measurePin: set black wire analog pin no.

  • void setADCbit(int bit)
    set ADC bit digit.
    ESP-WROOM-02(esp8266) and AVR Arduino platform are 10bit, ESP-WROOM-32(ESP32) is 12bit.
    default value is 10(bit).

  • int getADCbit()
    get established ADC bit digit.

  • void setInputVolts(float volts)
    set input voltage (5V or 3.3V).
    if you set input voltage to 5V, Analog output voltage is 5V, too.
    if you get analog voltage to 3,3V, you set input voltage to 5V, or 5V to 3.3V using a voltage divider.
    default value is 5(V).

  • float getInputVolts()
    get established input voltage value.

  • float getDustDensity()
    get dust density (the unit is ug/m3)

link

history

  • ver. 0.1: closed version.
  • ver. 0.2: first release version.
  • ver. 0.3: support ESP-WROOM-32(ESP32), add set/getADCbit, set/getInputVolts functions.
  • ver. 0.31: write "does not support GP2Y1014AU0F", not minus value as getDustDensity().
  • ver. 0.4: support AVR Arduino (and clones) platforms, and delete getDustDensityAvg() and setDustDensityHistoryMaxSize() function.

gp2y1010_dustsensor's People

Contributors

nara256 avatar

Stargazers

Vladislav Vanyuk avatar

Watchers

James Cloos avatar king avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.