

The SW420 is a tilt switch designed to detect changes in orientation or position. It operates by closing or opening its internal contacts when tilted beyond a specific angle. This component is widely used in applications such as motion detection, anti-theft systems, orientation sensing, and robotics. Its simplicity and reliability make it a popular choice for both hobbyists and professionals.
The SW420 is manufactured by ARDUINO, with the part ID "UNO," and is compatible with a variety of microcontrollers, including the Arduino UNO.








The SW420 tilt switch is a passive component with the following key specifications:
| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V to 5V |
| Operating Current | ≤ 20mA |
| Output Type | Digital (High/Low) |
| Tilt Angle Threshold | Typically 15° to 45° |
| Dimensions | 14mm x 5mm x 5mm (approx.) |
| Operating Temperature | -40°C to +85°C |
The SW420 module typically comes with three pins:
| Pin Name | Description |
|---|---|
| VCC | Power supply pin (3.3V to 5V) |
| GND | Ground connection |
| DO | Digital output pin (HIGH when stable, LOW when tilted) |
The SW420 tilt switch is straightforward to use in a circuit. Below are the steps and best practices for integrating it into your project:
Wiring the Component:
VCC pin to a 3.3V or 5V power source.GND pin to the ground of your circuit.DO (Digital Output) pin to a digital input pin on your microcontroller (e.g., Arduino UNO).Circuit Example:
DO pin to ensure stable readings.VCC and GND to reduce noise.Arduino UNO Example Code: Below is an example code snippet to interface the SW420 with an Arduino UNO:
// SW420 Tilt Switch Example Code
// Connect SW420 DO pin to Arduino digital pin 2
const int tiltPin = 2; // Digital pin connected to SW420 DO pin
const int ledPin = 13; // Built-in LED pin for status indication
void setup() {
pinMode(tiltPin, INPUT); // Set tiltPin as input
pinMode(ledPin, OUTPUT); // Set ledPin as output
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int tiltState = digitalRead(tiltPin); // Read the state of the tilt switch
if (tiltState == LOW) {
// If the switch is tilted, turn on the LED
digitalWrite(ledPin, HIGH);
Serial.println("Tilt detected!");
} else {
// If the switch is stable, turn off the LED
digitalWrite(ledPin, LOW);
Serial.println("No tilt detected.");
}
delay(100); // Small delay for stability
}
Important Considerations:
Issue: The SW420 is not detecting tilt.
VCC and GND pins. Ensure the power supply voltage is within the specified range (3.3V to 5V).Issue: The output is unstable or noisy.
DO pin and a decoupling capacitor (0.1µF) between VCC and GND to stabilize the signal.Issue: The Arduino does not respond to tilt events.
Serial.println() function to debug the tilt state.Issue: False triggers occur due to vibrations.
Q: Can the SW420 detect small tilts?
A: The SW420 is designed to detect tilts within a threshold angle of 15° to 45°. For smaller tilt detection, consider using a more sensitive sensor like an accelerometer.
Q: Is the SW420 suitable for outdoor use?
A: The SW420 is not waterproof or weatherproof. If used outdoors, it must be enclosed in a protective casing.
Q: Can I use the SW420 with a 3.3V microcontroller?
A: Yes, the SW420 operates within a voltage range of 3.3V to 5V, making it compatible with 3.3V microcontrollers.
By following this documentation, you can effectively integrate the SW420 tilt switch into your projects and troubleshoot any issues that arise.