Sensor PIR compacto para detección sencilla en proyectos pequeños.
SKU: OT2047-B81 Número de artículo: NB111 EAN: 4765791479546 Ubicación: B08.01
Alternativa
Sensor PIR HC-SR501 Sensor de movimiento
€ 2,00
Ver esta alternativa
Así conectas el Mini sensor de movimiento infrarrojo piroeléctrico PIR a un Arduino UNO o ESP32, con un sketch de ejemplo que puedes subir directamente.
Este proyecto detecta movimiento usando un sensor PIR mini y activa el LED integrado del Arduino. Cuando se detecta movimiento, el LED se enciende y se muestra una notificación en el Serial Monitor. Deja un breve tiempo de calentamiento después de encenderlo para que el sensor se estabilice.
/*
* ==================================================================
* 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
Este proyecto detecta movimiento humano usando un sensor de movimiento Mini PIR. Cuando se detecta movimiento, el ESP32 enciende el LED integrado (GPIO 2) y registra un mensaje en el Serial Monitor. Alimentar el sensor con 3.3V garantiza niveles de señal seguros para la entrada del 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
El hermanito pequeño del sensor PIR normal; la cabeza tiene un diámetro de solo 1,1cm
Pines:
- Vin (indicado con "+" y/o "U1")
- Out (pin central)
- GND/ground/min (indicado con "-" y/o "C1")
Dimensiones
Longitud: 2,8cm
Anchura: 1,4cm
Altura: 1,4cm
| Ancho | 1,4 cm |
|---|---|
| Temperatura de trabajo | -20°C - +60°C |
| Tensión de entrada | DC 2.7-12V |
| Tensión de salida | Alto 3.3 V /Bajo 0V |
| Longitud | 2,8 cm |
| Diámetro | 1,1 cm |
| Altura | 1,4cm |
| Dimensiones de la PCB | 10mm*8mm |
| Corriente en reposo | <100uA |
| Distancia de detección | 3 m |
| Tiempo de retardo | aprox. 2 segundos (± 30% desviación) |
| Dimensión total | 12mm*27mm |
| Ángulo del sensor | <100° |
| Tipo de lente | Pequeño |
La potencia es muy baja, dos metros
Genial.......
funciona bien, pero a veces detecta movimiento inexistente
Funciona bien. Zona de detección moderada, por eso va bien para un proyecto, pero menos para una solución real.
¿No te convence? Tienes 30 días desde la recepción para devolver el producto.
Todo sobre devoluciones
Mini sensor de movimiento infrarrojo piroeléctrico PIR