PIR bewegingssensor voor het detecteren van beweging, met instelbare tijd en detectieafstand.
SKU: OT704-C87 Artikelnummer: AB039 EAN: 8029313760373 Locatie: C08.07
Alternatief
Bewegingssensor met microgolf radar RCWL-051
€ 2,45
Bekijk dit alternatief
Zo sluit je de PIR Sensor HC-SR501 Bewegingssensor aan op een Arduino UNO of ESP32, met een voorbeeldsketch die je direct kunt uploaden.
Dit project detecteert menselijke beweging met behulp van de HC-SR501 PIR-sensor. Wanneer beweging wordt gedetecteerd, gaat de uitgangspin van de sensor HIGH, waardoor de onboard LED oplicht en er een melding naar de Serial Monitor wordt geprint. Open de Serial Monitor op 115200 baud om de bewegingsstatus in realtime te bekijken.
/*
* ==================================================================
* Generated by Codey.online — https://www.codey.online
* ==================================================================
* Project : HC-SR501 Motion Detection with Arduino Uno
* Board : Arduino UNO (arduino:avr:uno)
* Parts : HC-SR501 PIR Motion Sensor
* 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.
* ==================================================================
*/
// HC-SR501 PIR Motion Sensor Demo
const int PIR_PIN = 2;
const int LED_PIN = 13;
int lastState = LOW;
void setup() {
pinMode(PIR_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
Serial.begin(115200);
Serial.println(F("HC-SR501 PIR Motion Sensor Initialized"));
Serial.println(F("Warming up sensor (approx. 30-60 seconds)..."));
}
void loop() {
int motionState = digitalRead(PIR_PIN);
if (motionState != lastState) {
if (motionState == HIGH) {
digitalWrite(LED_PIN, HIGH);
Serial.println(F("Motion detected!"));
} else {
digitalWrite(LED_PIN, LOW);
Serial.println(F("Motion ended."));
}
lastState = motionState;
}
delay(100);
}
Wiring diagram and example code generated by Codey.online — https://www.codey.online
Dit project detecteert beweging met een HC-SR501 PIR-sensor. De sensor wordt gevoed via de 5V VIN-pin, en een spanningsdeler met 1kΩ/2kΩ weerstand zorgt voor een veilige koppeling van de sensoruitgang met de 3.3V-ingang van de ESP32. Wanneer beweging wordt gedetecteerd, gaat de onboard LED branden en wordt er een melding naar de Serial Monitor gestuurd.
/*
* ==================================================================
* Generated by Codey.online — https://www.codey.online
* ==================================================================
* Project : Motion Detection with HC-SR501 and ESP32
* Board : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
* Parts : HC-SR501 PIR Motion Sensor
* 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.
* ==================================================================
*/
// HC-SR501 PIR Motion Sensor Demo
const int PIR_PIN = 13; // Connected to HC-SR501 OUT via divider
const int LED_PIN = 2; // Onboard LED
int lastState = LOW;
void setup() {
Serial.begin(115200);
pinMode(PIR_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
Serial.println("HC-SR501 Sensor warming up (approx. 30-60s)...");
delay(2000);
Serial.println("Ready to detect motion.");
}
void loop() {
int motion = digitalRead(PIR_PIN);
if (motion != lastState) {
if (motion == HIGH) {
digitalWrite(LED_PIN, HIGH);
Serial.println("Motion detected!");
} else {
digitalWrite(LED_PIN, LOW);
Serial.println("Motion ended.");
}
lastState = motion;
}
delay(50);
}
Wiring diagram and example code generated by Codey.online — https://www.codey.online
HC-SR501 PIR Bewegingssensor is een infrarood bewegingssensor met de volgende specificaties:
– Detectieafstand: 3-7m.
– Vertraging: 5-200s
– Output voltage: 3.3V
- Werkt op: 4.5-20V
– Detectiehoek: <140°.
HC-SR501 PIR Bewegingssensor infrarood PIR detecteert beweging. Als de beweging word gedetecteerd geeft deze een 3.3v signaal op de output pin de tijd is instelbaar via de potmeter VR1. De detectieafstand is instelbaar van 3-7 meter via potmeter VR2.
| Uitgangsspanning | 3.3 V |
|---|---|
| Detectieafstand | 3-7 m |
| Vertraging | 5-200 s |
Werkt perfect en ziet er fantastisch uit, in een opstelling.
deze versie komt helaas niet met de jumpers om de stand van H en L te kiezen. maar voor de rest werkt het prima.
Niet tevreden? Je hebt 30 dagen bedenktijd na ontvangst om het product terug te sturen.
Alles over retourneren
PIR Sensor HC-SR501 Bewegingssensor