Aller au contenu
Bamba IoT

KY-018 : câblage ESP32, code et brochage

Modules KY-0xxAnalogique

Le KY-018 est un module photorésistant qui détecte les niveaux de lumière ambiante.

Photo du KY-018

Démarrer

Câblage vers l’ESP32

Câblage vers l’ESP32
Broche du capteurBroche ESP32StatutRôle
Pin (-)GNDRequisSol
Pin (middle)3.3V or 5VRequisAlimentation
Pin (S)GPIO36RequisEntrée analogique (broche ADC)
Schéma de câblage du KY-018

Code

Aucune bibliothèque à installer.

basic.ino
int sensorPin = A0; // Photoresistor connected to analog pin A0
int sensorValue = 0;

void setup() {
    Serial.begin(9600);
    Serial.println("KY-018 Photoresistor Test");
}

void loop() {
    sensorValue = analogRead(sensorPin);
    Serial.print("Light Intensity: ");
    Serial.println(sensorValue);
    delay(500);
}

Brochage

Brochage
BrocheTypeDescription
Pin (-)PowerConnexion à la terre
Pin (middle)PowerAlimentation3,3 V à 5 V
Pin (S)CommunicationSortie de signal analogiqueLa tension augmente avec l'intensité lumineuse
Brochage du KY-018

Caractéristiques

Le KY-018 est un module photorésistant qui détecte les niveaux de lumière ambiante. Il émet un signal analogique correspondant à l'intensité lumineuse, ce qui le rend adapté aux projets nécessitant des capacités de détection de la lumière.

Caractéristiques
CaractéristiqueValeur
Dimensions21 x 15 x 6 mm
Output TypeAnalog
Operating Voltage3.3V - 5V
Fixed Resistor Value10 kΩ