Ide rangkaian (sumber: Application note of Sharp dust sensor GP2Y1010AU0 :
Berikut ini contoh software ESP32 untuk membaca data dari sensor
Konfigurasi:
- input analog: pin 34
- output untuk kendali LED: pin 23
#define LED_SENSOR 23
#define ADC_INPUT 34
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(115200);
pinMode(LED_SENSOR, OUTPUT);
}
void loop() {
// read the analog in value:
digitalWrite(LED_SENSOR, HIGH);
delayMicroseconds(280);
sensorValue = analogRead(ADC_INPUT); // measurement 280 us after signal start
delayMicroseconds(40); // total signal duration 320 us
digitalWrite(LED_SENSOR, LOW); // turn off LED
// print the results to the Serial Monitor:
Serial.print("sensor = ");
Serial.println(sensorValue);
delay(1000);
}
Literatur:
- https://www.sparkfun.com/products/9689
- https://www.sparkfun.com/datasheets/Sensors/gp2y1010au_e.pdf
- Mirror Datasheet GP2Y10 gp2y1010au_e
- http://arduinodev.woofex.net/2012/12/01/standalone-sharp-dust-sensor/
- Sparkfun: Datasheet Sharp GP2Y1010AU0F
- Sharp Global: Application note of Sharp dust sensor GP2Y1919AU0F