Sensor Debu Sharp GP2Y1010

Sensor Debu Sharp GP2Y1010

Sensor Debu Sharp GP2Y1010

Sensor Debu Sharp GP2Y1010
Sensor Debu Sharp GP2Y1010
Sensor Debu Sharp GP2Y1010
Sensor Debu Sharp GP2Y1010

 

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:

 

Tinggalkan Balasan

Situs ini menggunakan Akismet untuk mengurangi spam. Pelajari bagaimana data komentar Anda diproses.