Démarrer
Câblage vers l’ESP32
| Broche du capteur | Broche ESP32 | Statut | Rôle |
|---|---|---|---|
| GND | GND | Requis | Sol |
| +V | 3.3V or 5V | Requis | Alimentation |
| D0 | GPIO17 | Optionnel | Entrée numérique (n'importe quel GPIO) |
| A0 | GPIO36 | Optionnel | Entrée analogique (broche ADC) |

Code
Aucune bibliothèque à installer.
// Declaration and initialization of the input pins
int analog_input = A0; // Analog output of the sensor
int digital_input = 3; // Digital output of the sensor
void setup() {
pinMode(analog_input, INPUT);
pinMode(digital_input, INPUT);
Serial.begin(9600); // Serial output with 9600 bps
Serial.println("KY-026 Flame detection");
}
void loop() {
float analog_value;
int digital_value;
// Current values are read out, converted to the voltage value...
analog_value = analogRead(analog_input) * (5.0 / 1023.0);
digital_value = digitalRead(digital_input);
//... and printed at this point
Serial.print("Analog voltage value: ");
Serial.print(analog_value, 4);
Serial.print(" V, Threshold value: ");
if (digital_value == 1) {
Serial.println("reached");
} else {
Serial.println("not yet reached");
}
Serial.println("----------------------------------------------------------------");
delay(1000);
}
Brochage
Caractéristiques
Le KY-026 est un module de capteur de flamme capable de détecter la lumière dans la plage de longueurs d'onde de 760 nm à 1 100 nm. Il offre des sorties analogiques et numériques, avec une sensibilité réglable via un potentiomètre intégré, ce qui le rend adapté à diverses applications de détection de flamme.
| Caractéristique | Valeur |
|---|---|
| Weight | 2 g |
| Dimensions | 36 x 15 x 14 mm |
| Detection Angle | Approximately 60 degrees |
| Operating Voltage | 3.3V to 5V |
| Detection Wavelength | 760 nm to 1100 nm |

