The SW 420 is a tilt switch designed to detect changes in orientation or position. It activates when tilted beyond a certain angle, making it ideal for applications requiring motion or tilt detection. This component is widely used in alarm systems, anti-theft devices, robotics, and other projects where detecting movement or inclination is essential.
The SW 420 tilt switch is a simple and reliable component with the following key specifications:
The SW 420 module typically comes with three pins. Below is the pin configuration:
Pin | Name | Description |
---|---|---|
1 | VCC | Power supply pin. Connect to 3.3V or 5V. |
2 | GND | Ground pin. Connect to the ground of the circuit. |
3 | DO (OUT) | Digital output pin. Outputs HIGH when the switch is tilted, otherwise LOW. |
Below is an example of how to connect and use the SW 420 with an Arduino UNO:
// SW 420 Tilt Switch Example with Arduino UNO
// This code reads the digital output of the SW 420 and prints the status to the Serial Monitor.
const int tiltPin = 2; // Pin connected to the DO (OUT) pin of the SW 420
int tiltState = 0; // Variable to store the tilt state
void setup() {
pinMode(tiltPin, INPUT); // Set the tilt pin as an input
Serial.begin(9600); // Initialize serial communication at 9600 baud
}
void loop() {
tiltState = digitalRead(tiltPin); // Read the state of the tilt switch
if (tiltState == HIGH) {
// If the switch is tilted, print "Tilt Detected"
Serial.println("Tilt Detected");
} else {
// If the switch is not tilted, print "No Tilt"
Serial.println("No Tilt");
}
delay(500); // Wait for 500ms before reading again
}
No Output Signal:
Unstable or Noisy Output:
Output Always HIGH or LOW:
Q: Can the SW 420 detect precise angles?
A: No, the SW 420 is designed to detect general tilt or orientation changes, not precise angles.
Q: Can I use the SW 420 with a 3.3V microcontroller?
A: Yes, the SW 420 operates at both 3.3V and 5V, making it compatible with most microcontrollers.
Q: How do I reduce false triggers caused by vibrations?
A: Use a software debounce routine or add a small capacitor (e.g., 0.1µF) across the output pin and ground.
By following this documentation, you can effectively integrate the SW 420 tilt switch into your projects and troubleshoot common issues with ease.