The Passive Infrared (PIR) Sensor SB312A is an electronic sensor that detects motion by measuring the infrared (IR) light radiating from objects in its environment. It is particularly sensitive to the IR light emitted by humans and animals, which makes it an ideal component for security systems, automatic lighting controls, and home automation projects.
The SB312A PIR sensor is designed to be a reliable and cost-effective solution for motion detection. Below are the key technical specifications and pin configuration details.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply input (4.5V to 20V) |
2 | OUT | Digital output signal (High/Low) |
3 | GND | Ground connection |
// Define the connection pin
const int PIRPin = 2; // Connect the OUT pin of the PIR sensor to digital pin 2
void setup() {
pinMode(PIRPin, INPUT); // Set the PIR pin as an input
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int motionState = digitalRead(PIRPin); // Read the PIR sensor's state
if (motionState == HIGH) {
// Motion detected
Serial.println("Motion detected!");
// Add your code here to handle motion detection event
} else {
// No motion detected
Serial.println("No motion.");
}
delay(1000); // Wait for 1 second before reading again
}
Q: Can the SB312A PIR sensor be used outdoors? A: The SB312A is not specifically designed for outdoor use and may be affected by environmental factors. It should be placed in a protective enclosure if used outside.
Q: How can I extend the output delay time beyond the default setting? A: The output delay time can be adjusted by adding external components or modifying the sensor's board, but this is an advanced modification and not recommended for beginners.
Q: Is it possible to power the SB312A with a battery? A: Yes, the SB312A can be powered with a battery as long as the voltage is within the 4.5V to 20V range. Keep in mind that battery life will depend on the sensor's usage and the battery's capacity.