SKU: OT2047-B81 Αριθμός είδους: NB111 EAN: 4765791479546
Ο μικρός αδελφός του συνηθισμένου PIR αισθητήρα, η κεφαλή έχει διάμετρο μόλις 1,1cm
Πίροι:
- Vin (υποδεικνύεται με "+" και/ή "U1")
- Out (μεσαίος πείρος)
- GND/ground/min (υποδεικνύεται με "-" και/ή "C1")
Διαστάσεις
Μήκος: 2,8cm
Πλάτος: 1,4cm
Ύψος: 1,4cm
Έτσι συνδέεις το Mini PIR πυροηλεκτρικός υπέρυθρος αισθητήρας κίνησης σε ένα Arduino UNO ή ESP32, με ένα παράδειγμα sketch που μπορείς να ανεβάσεις αμέσως.
Αυτό το project ανιχνεύει κίνηση χρησιμοποιώντας έναν Mini PIR αισθητήρα και ενεργοποιεί το ενσωματωμένο LED του Arduino. Όταν ανιχνευθεί κίνηση, το LED ανάβει και εμφανίζεται μια ειδοποίηση στο Serial Monitor. Αφήστε έναν σύντομο χρόνο προθέρμανσης μετά την τροφοδοσία, ώστε ο αισθητήρας να σταθεροποιηθεί.
/*
* ==================================================================
* Generated by Codey.online — https://www.codey.online
* ==================================================================
* Project : Mini PIR Motion Detector
* Board : Arduino UNO (arduino:avr:uno)
* Parts : Mini PIR
* Libraries : none (built-in)
*
* Codey Online is an AI-powered browser IDE for Arduino and ESP32.
* Describe your project and Codey writes the code, draws the wiring
* diagram and uploads it to your board, straight from the browser.
* This code is free to use, modify and share, without warranty.
* ==================================================================
*/
// Pin definitions
const int pirPin = 2;
const int ledPin = 13;
void setup() {
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(115200);
Serial.println(F("Mini PIR Sensor Initializing..."));
Serial.println(F("Waiting 5 seconds for sensor to settle..."));
delay(5000);
Serial.println(F("Ready! Monitoring for motion..."));
}
void loop() {
int motionDetected = digitalRead(pirPin);
if (motionDetected == HIGH) {
digitalWrite(ledPin, HIGH);
Serial.println(F("Motion detected!"));
} else {
digitalWrite(ledPin, LOW);
Serial.println(F("Scanning... No motion."));
}
delay(300);
}
Wiring diagram and example code generated by Codey.online — https://www.codey.online
Αυτό το project ανιχνεύει ανθρώπινη κίνηση χρησιμοποιώντας έναν Mini PIR αισθητήρα κίνησης. Όταν ανιχνευθεί κίνηση, το ESP32 ανάβει το onboard LED (GPIO 2) και καταγράφει ένα μήνυμα στο Serial Monitor. Η τροφοδοσία του αισθητήρα με 3.3V εξασφαλίζει ασφαλή επίπεδα σήματος για την είσοδο του ESP32.
/*
* ==================================================================
* Generated by Codey.online — https://www.codey.online
* ==================================================================
* Project : Mini PIR Motion Detector with ESP32
* Board : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
* Parts : Mini PIR
* Libraries : none (built-in)
*
* Codey Online is an AI-powered browser IDE for Arduino and ESP32.
* Describe your project and Codey writes the code, draws the wiring
* diagram and uploads it to your board, straight from the browser.
* This code is free to use, modify and share, without warranty.
* ==================================================================
*/
// Mini PIR Motion Detection with ESP32
const int PIR_PIN = 13; // Connected to Mini PIR OUT
const int LED_PIN = 2; // ESP32 onboard LED
int lastState = LOW;
void setup() {
Serial.begin(115200);
pinMode(PIR_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
Serial.println("PIR Sensor Initializing... Please wait 10-30s for sensor warm-up.");
}
void loop() {
int currentState = digitalRead(PIR_PIN);
if (currentState != lastState) {
lastState = currentState;
if (currentState == HIGH) {
digitalWrite(LED_PIN, HIGH);
Serial.println("Motion detected!");
} else {
digitalWrite(LED_PIN, LOW);
Serial.println("Motion ended.");
}
}
delay(50);
}
Wiring diagram and example code generated by Codey.online — https://www.codey.online