The RCWL-1670 ultrasonic sensor is a sophisticated motion detection component that integrates ultrasonic sensing with microwave radar technology. This sensor is capable of detecting motion through the measurement of changes in high-frequency radio waves and ultrasonic waves, offering a reliable method for sensing movement within its detection range. It is commonly used in applications such as automatic lighting, security systems, and industrial automation.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply input (4.5V to 28V) |
2 | GND | Ground connection |
3 | OUT | Digital output signal (high when motion is detected) |
4 | CDS | Light-dependent resistor (LDR) input for enabling operation in darkness |
// Define the RCWL-1670 output pin
const int sensorPin = 2;
void setup() {
// Initialize the sensor output pin as an input
pinMode(sensorPin, INPUT);
// Begin serial communication at 9600 baud rate
Serial.begin(9600);
}
void loop() {
// Read the sensor output
int sensorValue = digitalRead(sensorPin);
// If motion is detected, the output pin goes HIGH
if (sensorValue == HIGH) {
Serial.println("Motion detected!");
} else {
Serial.println("No motion detected.");
}
// Wait for a short period before reading again
delay(500);
}
Note: The above code is a simple example to demonstrate how to interface the RCWL-1670 ultrasonic sensor with an Arduino UNO. The sensorPin
should be connected to the OUT pin of the sensor, and the sensor should be powered according to the technical specifications. Adjust the delay
as needed for your specific application.