This week, I chose to use A passive infrared sensor (PIR sensor) as the input device.
PIR sensors allow us to sense motion. They are used to detect whether a human has moved in or out of the sensor's range. They are commonly found in appliances and gadgets used at home or for businesses. They are often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors.
PIRs are basically made of a pyroelectric sensor (which you can see above as the round metal can with a rectangular crystal in the center), which can detect levels of infrared radiation. Everything emits some low level radiation, and the hotter something is, the more radiation is emitted. The sensor in a motion detector is actually split in two halves. The reason for that is that we are looking to detect motion (change) not average IR levels. The two halves are wired up so that they cancel each other out. If one half sees more or less IR radiation than the other, the output will swing high or low.
DYP-ME003 PIR Sensor Module | |
---|---|
Below here are used code to run the above connected PIR Motion Sensor
int motionPin = 3;
int ledPin = 4;
void setup(){
pinMode(motionPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop(){
if (motionPin == HIGH){
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
delay(100);
}
Below here is the taken 'hero shot'
© 2023 | Eric NDAYISHIMIYE | All Rights Reserved